distributable:
  url: https://github.com/ethereum/solidity/releases/download//v{{version}}/solidity_{{version}}.tar.gz
  strip-components: 1

versions:
  github: ethereum/solidity/releases/tags

provides:
  - bin/solc
  - bin/yul-phaser

dependencies:
  boost.org: ^1.70

interprets:
  extensions: sol
  args: solc --bin

build:
  dependencies:
    linux/aarch64:
      # Prevents ld.lld: error: relocation R_AARCH64_ABS64 cannot be used against local symbol; recompile with -fPIC
      llvm.org: '<15'
    cmake.org: 3
    freedesktop.org/pkg-config: ^0.29
    gnu.org/patch: '*'
  working-directory: build
  script:
    # New libsolidity/lsb/DocumentHoverHandler.cpp doesn't like some versions of clang
    # (default argument issue)
    # https://github.com/ethereum/solidity/issues/13854
    - run: patch -p1 -d.. <../props/clang-error.diff
      if: =0.8.18

    - cmake .. $ARGS
    - make --jobs {{hw.concurrency}}
    - make install

    - run: rm {{prefix}}/bin/solidity-upgrade
      if: <0.8.18
  test:
    make test
  env:
    ARGS:
    - -DCMAKE_BUILD_TYPE=Release
    - -DCMAKE_INSTALL_PREFIX={{prefix}}
    - -DPEDANTIC=OFF  # otherwise fails due to deprecations in boost ^1.81
    - -DSTRICT_Z3_VERSION=OFF # otherwise complains about Z3 version in cmake

test: solc --bin fixture.sol
