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

name                azure-kubelogin
go.setup            github.com/azure/kubelogin 0.2.12 v
revision            0

categories          sysutils
maintainers         @baarde openmaintainer
license             MIT

description         A Kubernetes credential plugin implementing Azure authentication
long_description    kubelogin is a client-go credential plugin implementing Azure authentication for Kubernetes. \
                    This plugin provides features that are not available in kubectl.
homepage            https://azure.github.io/kubelogin/

checksums           rmd160  4be23bd08129b27acc28d6424c2dadabaab7cb68 \
                    sha256  ab8a0795a758426ce2f351c08e44e7417bd4600e06d5abf25184e9cf0736c443 \
                    size    174452

# FIXME: This port currently can't be built without allowing go mod to fetch
# dependencies during the build phase. See
# https://trac.macports.org/ticket/61192
go.offline_build no

build.cmd           make
build.pre_args      GIT_TAG="${version}" CGO_ENABLED=1
build.target        kubelogin

test.run            yes
test.cmd            bin/${goos}_${goarch}/kubelogin
test.target
test.args           --version

destroot {
    xinstall -m 0755 ${worksrcpath}/bin/${goos}_${goarch}/kubelogin ${destroot}${prefix}/bin/

    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} \
        CHANGELOG.md LICENSE \
        ${destroot}${prefix}/share/doc/${name}
}
