summaryrefslogtreecommitdiff
path: root/azure-kubelogin/PKGBUILD
blob: 5da3f324a497f9fd908169cea84e23a7330eb905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Maintainer: Erich Eckner <arch at eckner dot net>
# Contributor: Carl Smedstad <carl.smedstad at protonmail dot com>
# Contributor: William Aass Dahlen <cznk@protonmail.com>

pkgname=azure-kubelogin
_name=kubelogin
pkgver=0.0.32
pkgrel=1
pkgdesc="A Kubernetes credential (exec) plugin implementing azure authentication"
arch=(x86_64)
url="https://github.com/Azure/kubelogin"
license=(MIT)
makedepends=(go)
_pinned_dependencies=(
  'glibc>=2.38'
)
depends=("${_pinned_dependencies[@]}")
conflicts=(kubelogin)

source=("$pkgname-$pkgver.tar.gz::https://github.com/Azure/$_name/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('4ca487d104280d012643c00cf4d250c1c8b55f28adaab0aad8696974a4e21b14')

_archive="$_name-$pkgver"

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=" \
    -linkmode external \
    -X main.version=v$pkgver/? \
    -X main.goVersion=$_go_version \
    -X 'main.platform=linux/amd64' \
  "
  go build -ldflags "$_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"
}