# -*- 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.41 v
go.offline_build    no
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  35bbb161a13a3e89ac58340b7a2fb23697ebaa8e \
                    sha256  daec27ad58abcb8a823ad21862b4143eaa8a8fd03b3c7f3621e8fca61eb8e68e \
                    size    1801087

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