void-packages/srcpkgs/kubernetes-helm/template

57 lines
1.6 KiB
Bash

# Template file for 'kubernetes-helm'
pkgname=kubernetes-helm
version=3.5.3
revision=2
wrksrc="helm-${version}"
hostmakedepends="go make git mercurial tar"
short_desc="Kubernetes Package Manager"
maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
license="Apache-2.0"
homepage="https://helm.sh/"
distfiles="https://github.com/helm/helm/archive/v${version}.tar.gz"
checksum=bd3e2488011e0a73650e810cf540fcfcfcb828ff1480cc2c5a1e50934cad9d82
conflicts="helm"
nopie=true
_convert_arch() {
case "$1" in
aarch64*) echo arm64;;
armv6*) echo arm;;
armv7*) echo arm;;
i686*) echo 386;;
x86_64*) echo amd64;;
ppc64le*) echo ppc64le;;
esac
}
export _go_target_arch=$(_convert_arch $XBPS_TARGET_MACHINE)
export _go_host_arch=$(_convert_arch $XBPS_MACHINE)
do_extract() {
mkdir -p golib/src/k8s.io/helm
tar -xvzf ${XBPS_SRCDISTDIR}/${pkgname}-${version}/v${version}.tar.gz \
-C golib/src/k8s.io/helm \
--strip-components 1 \
helm-${version}
}
do_build() {
cd golib/src/k8s.io/helm
go mod tidy # can be removed with 3.6.0; see https://github.com/helm/helm/issues/9479
make build-cross TARGETS="linux/${_go_target_arch} linux/${_go_host_arch}" APP="..." LDFLAGS="-X helm.sh/helm/v3/internal/version.version=v${version} -X helm.sh/helm/v3/internal/version.metadata="
_dist/linux-${_go_host_arch}/helm completion bash > completion.bash
_dist/linux-${_go_host_arch}/helm completion zsh > completion.zsh
}
do_install() {
cd golib/src/k8s.io/helm
# Copy helm binary
vbin _dist/linux-${_go_target_arch}/helm
# Copy completion files
vinstall completion.bash 644 usr/share/bash-completion/completions helm
vinstall completion.zsh 644 usr/share/$pkgname
}