# -*- 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.19 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  7fa7c88cf0e02717874914e649be63ef98e8e5eb \
                    sha256  074b5e8ed993b7dada71ffd4917d28a0e5a59ff215e55b29287f4bdd8c40f4eb \
                    size    191737

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