# Maintainer: Carl Smedstad # Contributor: William Aass Dahlen pkgname=azure-kubelogin _pkgname=kubelogin pkgver=0.0.26 pkgrel=1 pkgdesc="A Kubernetes credential (exec) plugin implementing azure authentication" arch=('x86_64') url="https://github.com/Azure/kubelogin" license=('MIT') makedepends=('go') conflicts=('kubelogin') source=("$pkgname-$pkgver.tar.gz::https://github.com/Azure/$_pkgname/archive/refs/tags/v$pkgver.tar.gz") sha256sums=('d885b24fee8835269982ce9db4b3193e99ae7ddfb29fe198833e1a1c3a3c5399') _archive="$_pkgname-$pkgver" _git_hash="584497114d74eca24f55f078befb11d8955bb0ba" build() { cd "$_archive" export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" _go_version=$(go version | cut -d " " -f 3) _ld_flags="-X main.version=v$pkgver/$_git_hash -X main.goVersion=$_go_version -X 'main.platform=linux/amd64'" go build -ldflags "-linkmode external $_ld_flags" . } check() { cd "$_archive" go test ./... } package() { cd "$_archive" install -Dm755 kubelogin $pkgdir/usr/bin/kubelogin install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" }