diff options
author | Carl Smedstad | 2022-12-17 17:39:02 +0100 |
---|---|---|
committer | Carl Smedstad | 2022-12-17 17:58:35 +0100 |
commit | d6d6a8cb541eb071a12b7e8840cd5a2a441fe30b (patch) | |
tree | ab4295fc684c5525b13f7a8c0f20e8c4a21b0d43 | |
parent | 735b44225187535c0a83f8bb3f43a08e60084035 (diff) | |
download | aur-d6d6a8cb541eb071a12b7e8840cd5a2a441fe30b.tar.gz |
Report the correct version from executable
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 21 |
2 files changed, 15 insertions, 8 deletions
@@ -1,7 +1,7 @@ pkgbase = azure-kubelogin pkgdesc = A Kubernetes credential (exec) plugin implementing azure authentication pkgver = 0.0.24 - pkgrel = 1 + pkgrel = 2 url = https://github.com/Azure/kubelogin arch = x86_64 license = MIT @@ -4,7 +4,7 @@ pkgname=azure-kubelogin _pkgname=kubelogin pkgver=0.0.24 -pkgrel=1 +pkgrel=2 pkgdesc="A Kubernetes credential (exec) plugin implementing azure authentication" arch=('x86_64') url="https://github.com/Azure/kubelogin" @@ -15,26 +15,33 @@ conflicts=('kubelogin') source=("$pkgname-$pkgver.tar.gz::https://github.com/Azure/$_pkgname/archive/refs/tags/v$pkgver.tar.gz") sha256sums=('a961e82d79054ca8bc6054455ad354a811da0309b6fe31508810b03242950f44') +_archive="$_pkgname-$pkgver" +_git_hash="bbb308d4255c4a29a17c9bec0f2f89586d084c42" + build() { - cd "$_pkgname-$pkgver" + cd "$_archive" export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" - export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" - go build -o build/kubelogin + 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 "$_pkgname-$pkgver" + cd "$_archive" go test ./... } package() { - cd "$_pkgname-$pkgver" + cd "$_archive" - install -Dm755 "build/kubelogin" $pkgdir/usr/bin/kubelogin + install -Dm755 kubelogin $pkgdir/usr/bin/kubelogin install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } |