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

go.setup            github.com/infracost/infracost 0.10.46 v
go.offline_build    no
go.toolchain_min    1.26.0
revision            0

homepage            https://www.infracost.io

description         Cloud cost estimates for Terraform in your CLI

long_description    Infracost shows hourly and monthly cost estimates for a \
                    Terraform project. This helps developers, DevOps et al. \
                    quickly see the cost breakdown and compare different \
                    deployment options upfront.

categories          sysutils net
installs_libs       no
license             Apache-2
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  d48437de09edd082f67f829d1fdd03aefd538eb0 \
                    sha256  d182674008b72da1e374a63d3a9e0b6bcdb6c43ccaaa947ca73b31b2eca39aad \
                    size    5338326

build.cmd           make
build.pre_args      VERSION=v${version}
build.args          darwin

use_parallel_build  no

patch {
    reinplace "s|CGO_ENABLED=0||g" Makefile
    # Fix dumb assumption both arm64 and amd64 should always be built for darwin ...
    if {${build_arch} eq "arm64"} {
        set disa "amd64"
    } else {
        set disa "arm64"
    }
    reinplace "s|env GOOS=darwin GOARCH=${disa}|#env GOOS=darwin GOARCH=${disa}|g" Makefile
}

destroot {
    xinstall -m 0755 \
        ${worksrcpath}/build/${name}-darwin-${goarch} \
        ${destroot}${prefix}/bin/${name}

    xinstall -d ${destroot}${prefix}/share/${name}
    copy ${worksrcpath}/examples ${destroot}${prefix}/share/${name}/
}
