68 lines
1.9 KiB
Plaintext

# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=linkerd-cli
pkgver=2.13.3
pkgrel=1
pkgdesc="CLI utility for Linkerd service mesh"
url="https://linkerd.io/"
arch="all"
license="Apache-2.0"
makedepends="go"
subpackages="
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
"
source="linkerd2-$pkgver.tar.gz::https://github.com/linkerd/linkerd2/archive/refs/tags/stable-$pkgver.tar.gz"
builddir="$srcdir/linkerd2-stable-$pkgver"
export CGO_ENABLED=0
export GO111MODULE=on
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
prepare() {
default_prepare
# https://github.com/linkerd/linkerd2/blob/main/pkg/charts/static/helpers.go
# runtime.Caller(0) returns the module path (not the absolute file system path) when '-trimpath' is presented
# => FATA[0000]: github.com/linkerd/linkerd2/charts: no such file or directory
local GOFLAGS="${GOFLAGS/-trimpath/}"
for target in pkg/charts jaeger multicluster viz; do
go generate ./"$target"/static
done
}
build() {
go build -v \
-tags prod \
-o ./linkerd \
-ldflags "-X github.com/linkerd/linkerd2/pkg/version.Version=stable-$pkgver" \
./cli
for shell in bash fish zsh; do
./linkerd completion $shell > linkerd.$shell
done
}
check() {
# Static template files are referenced the same way as they were in `go generate` commands
GOFLAGS="${GOFLAGS/-trimpath/}" go test ./...
}
package() {
install -Dm755 linkerd -t "$pkgdir"/usr/bin/
install -Dm644 linkerd.bash \
"$pkgdir"/usr/share/bash-completion/completions/linkerd
install -Dm644 linkerd.fish \
"$pkgdir"/usr/share/fish/vendor_completions.d/linkerd.fish
install -Dm644 linkerd.zsh \
"$pkgdir"/usr/share/zsh/site-functions/_linkerd
}
sha512sums="
c535483a7a558bd5fc6c69a1c858021bb343cba5189261e8a4bb26bf409a42e5eeef012dbd7a0ce7ba73818039b3809a169f031a2329ff0975d4fb6ee2d13d6f linkerd2-2.13.3.tar.gz
"