summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 97f4e7080a4d78295110527d245c24c00d8640ca (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
# Maintainer: Vianney Bouchaud <aur dot vianney at bouchaud dot org>

pkgname=k8s-ldap-auth
pkgdesc="Kubernetes webhook token authentication plugin implementation using ldap."
pkgver=4.0.0
pkgrel=2
arch=('x86_64' 'armv7l' 'armv7h' 'aarch64')
url="https://github.com/HopopOps/k8s-ldap-auth"
license=('MPL2')
makedepends=(
    'go'
)

source=(
    "${pkgname}-${pkgver}.tar.gz::https://github.com/HopopOps/k8s-ldap-auth/archive/v${pkgver}.tar.gz"
)

sha256sums=(
    "404606ac6ce95ceebbc30e5df1fc2a4dbec50cdf00e26c907129677903f7340b"
)

prepare(){
  cd $pkgname-$pkgver
  mkdir -p build/
}

build() {
    cd $pkgname-$pkgver
    export GOPATH="$srcdir/gopath"
    export CGO_CPPFLAGS="${CPPFLAGS}"
    export CGO_CFLAGS="${CFLAGS}"
    export CGO_CXXFLAGS="${CXXFLAGS}"

    goversion=$(go version | sed -r 's/go version go(.+)\s.+/\1/')
    gopkg=hopopops/$pkgname

    go build \
      -trimpath \
      -buildmode=pie \
      -mod=readonly \
      -modcacherw \
      -ldflags "\
        -linkmode=external \
        -buildid=''
        -extldflags \"${LDFLAGS}\" \
        -X $gopkg/version.APPNAME=${pkgname} \
        -X $gopkg/version.VERSION=v${pkgver} \
        -X $gopkg/version.GOVERSION=${goversion}" \
      -o build .
}

package() {
    install -D -m0755 "${srcdir}/$pkgname-$pkgver/build/k8s-ldap-auth" "${pkgdir}/usr/bin/k8s-ldap-auth"
}