archrelease: copy trunk to community-any
[ArchLinux/community.git] / stern / trunk / PKGBUILD
blob0585db99661b303616f1fea5011521885759cea9
1 # Maintainer: Andreas 'Segaja' Schleifer <segaja at archlinux dot org>
3 pkgname=stern
4 pkgdesc="Multi pod and container log tailing for Kubernetes"
5 pkgver=1.25.0
6 pkgrel=1
7 arch=('x86_64')
8 url="https://github.com/stern/stern"
9 license=('apache')
10 options=(!lto)
11 depends=('glibc')
12 makedepends=('go')
13 optdepends=('bash-completion: for bash completion support')
14 source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
15 sha512sums=('c7fc531c9d01b32cd5edfdb2f036f7524fee2fb13eec35d01e7c053a383db3f3f98454329bfcc8660cb5b1f851364e8adb5637539035712e6defbf3a6cd0d9b3')
16 b2sums=('089b3fe36f452c3fa8b44b924af59de129284d189d42088cd272253d6f1b52a5fa96c0a09b7153f63e739724899ab20f35cb4cdd6aa78ce9100f90e4cccf56e6')
18 build() {
19   cd "${pkgname}-${pkgver}"
21   export CGO_CPPFLAGS="${CPPFLAGS}"
22   export CGO_CFLAGS="${CFLAGS}"
23   export CGO_CXXFLAGS="${CXXFLAGS}"
24   export CGO_LDFLAGS="${LDFLAGS}"
25   export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
27   go build -v -x \
28     -ldflags "-linkmode external -X \"github.com/stern/stern/cmd.version=${pkgver}\"" \
29     -o "./out/${pkgname}"
32 check() {
33   cd "${pkgname}-${pkgver}"
35   go test -v ./...
38 package() {
39   cd "${pkgname}-${pkgver}"
41   install --verbose -D --mode=0755 "./out/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
43   "${pkgdir}/usr/bin/${pkgname}" --completion=bash | install --verbose -D --mode=0644 /dev/stdin "${pkgdir}/usr/share/bash-completion/completions/${pkgname}"
44   "${pkgdir}/usr/bin/${pkgname}" --completion=fish | install --verbose -D --mode=0644 /dev/stdin "${pkgdir}/usr/share/fish/vendor_completions.d/${pkgname}.fish"
45   "${pkgdir}/usr/bin/${pkgname}" --completion=zsh | install --verbose -D --mode=0644 /dev/stdin "${pkgdir}/usr/share/zsh/site-functions/_${pkgname}"
47   install --verbose -D --mode=0644 *.md --target-directory "${pkgdir}/usr/share/doc/${pkgname}"