2023-11-12 08:49:29 +00:00

67 lines
1.9 KiB
Plaintext

# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=linkerd-cli
pkgver=2.14.3
pkgrel=0
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 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="
7ca4d9d4f84a6d148447ef34c4883ff28aef7698b4f5a4d6fd10d0ed76cefb7c67f4aab028d908a01103bef46a4907de7b9907aea601da84eca457377d16636d linkerd2-2.14.3.tar.gz
"