# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

PortGroup           github 1.0
PortGroup           cmake 1.1
PortGroup           boost 1.0

boost.version       1.88

github.setup        argotorg solidity 0.8.38 v
revision            0

categories          lang
license             GPL-3+
maintainers         {@kaimingguo kaiming.io:me} \
                    openmaintainer

description         Solidity, the Smart Contract Programming Language

long_description    Solidity is a statically typed, contract-oriented, \
                    high-level language for implementing smart contracts \
                    on the Ethereum platform.

homepage            https://soliditylang.org
github.tarball_from releases
distname            ${github.project}_${github.version}

checksums           rmd160  4b07c32ea0ae6c6275f8e07eb5fe000c7c23b9d4 \
                    sha256  a96f89d20525724acd9717032a0315466078c0176d5d13016d81f4cc81fd4115 \
                    size    9417846

set port_libfmt     libfmt12

compiler.cxx_standard 2023
# Upstream's CMake refuses AppleClang before 17 and clang before 19.
compiler.blacklist-append \
                    {clang < 1700} \
                    {macports-clang-1[0-8]} \
                    {macports-clang-[3-9].*}
compiler.fallback-append macports-clang-21

depends_build-append \
                    port:${port_libfmt} \
                    port:range-v3 \
                    port:nlohmann-json

cmake.prefix_path-append \
                    ${prefix}/lib/${port_libfmt}/cmake

configure.args      -DBoost_USE_STATIC_LIBS=OFF \
                    -DTESTS=OFF \
                    -DIGNORE_VENDORED_DEPENDENCIES=ON \
                    -DPEDANTIC=OFF \
                    -DCCACHE=OFF

# solc runs the z3 executable from PATH for its SMT checker.
default_variants    +z3

variant z3 description {SMT Checker via Z3} {
    depends_run-append \
        port:z3
}

variant tests description {Enable testing} {
    configure.args-replace \
        -DTESTS=OFF \
        -DTESTS=ON
}

test.run            yes
test.cmd            ${cmake.build_dir}/solc/solc
test.target
test.args           --bin ${filespath}/test.sol
