# -*- 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

version             5.11.0
revision            0

if {${os.major} >= 17} {
    set source_build    yes
} else {
    set source_build    no
}

if ${source_build} {
    PortGroup           golang 1.0

    go.setup            github.com/symfony-cli/symfony-cli ${version} v
} else {
    PortGroup           github 1.0

    github.setup        symfony-cli symfony-cli ${version} v
}

name                symfony-cli

homepage            https://symfony.com/download

description         The Symfony CLI tool

long_description    The Symfony CLI tool is a must-have tool when developing \
                    Symfony applications on your local machine.

categories          devel
installs_libs       no
license             AGPL-3+
maintainers         {@antalaron antalaron.hu:antalaron} \
                    openmaintainer

if ${source_build} {
    # Allow Go to fetch dependencies at build time
    go.offline_build    no
    build.env           CGO_ENABLED=0
    build.args          -o ${workpath}/symfony -trimpath -ldflags="-s -w -X 'main.version=${version}' -X 'main.channel=stable'"

    use_parallel_build  no

    checksums           rmd160  da1f3a46d647090ba6718dc01bc7b3d6f7a355a1 \
                        sha256  29996a4f7f2032fe1e3b1d8df734843f84ee7e2ac9db10e1e690ffc37df88713 \
                        size    276515

    github.tarball_from archive
} else {
    build {}

    distname            symfony-cli_darwin_all

    checksums           rmd160  b02e90d27dcce76ef57372e16c8d34c3812985b6 \
                        sha256  d7fc4d0c2e03d12f741c9dd71d7f3f441230a86285df84fd0c446e5251ccf74a \
                        size    12171160

    github.tarball_from releases

    use_configure       no
}

destroot {
    if ${source_build} {
        if {${configure.build_arch} eq {arm64}} {
            system "codesign -f -s - ${workpath}/symfony"
        }
    }

    xinstall -m 0755 -W ${workpath} symfony ${destroot}${prefix}/bin
}

github.livecheck.regex {([0-9.]+)}
