2024-03-12 19:09:38 +01:00

71 lines
2.1 KiB
Plaintext

# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=linkerd-cli
pkgver=2.14.10
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"
options="net" # download go modules
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/}"
# XXX: remove this in the next release.
go mod tidy
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
# TestGet, TestGetProfiles fail occasionally due to flaky network calls
GOFLAGS="${GOFLAGS/-trimpath/}" go test -skip TestGet ./...
}
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="
ecc2c2096feb3a1bc3fa8e1a5dd9ecf0681450ad226eda466a21ddc6014a6587d0ce8add1fc42fef491b896bc1f08d8ba899a6cb455010e2a84c5020d6428475 linkerd2-2.14.10.tar.gz
"