# -*- 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.45 v
go.offline_build    no
go.toolchain_min    1.25.11
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  2dde7ec4f26aed0175487312681543fc911af423 \
                    sha256  32f884ea2be99f70a4c2c81dd63dd923cf15996e494c046b9d4e019917658b79 \
                    size    5336415

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}/
}
