void-packages/srcpkgs/kubernetes-helm/template
2019-05-21 15:59:32 +02:00

76 lines
2.2 KiB
Bash

# Template file for 'kubernetes-helm'
pkgname=kubernetes-helm
version=2.14.0
revision=1
wrksrc="helm-${version}"
hostmakedepends="go make git mercurial"
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=5ee68580431254044996da0d2347a394e917e18a81047cc1b0f3d8949a371d75
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}
}
pre_build() {
export GOPATH="$(pwd)/golib"
## The current version of glide in the repository has
## a bug that prevents building, so pull the current
## version from git.
CC=/bin/gcc go get github.com/Masterminds/glide
CC=/bin/gcc go get github.com/mitchellh/gox
CC=/bin/gcc go install github.com/Masterminds/glide
CC=/bin/gcc go install github.com/mitchellh/gox
PATH="$PATH:$(pwd)/golib/bin/"
export PATH
}
do_build() {
cd golib/src/k8s.io/helm
TARGETS="linux/${_go_target_arch} linux/${_go_host_arch}" make bootstrap build-cross APP="..." LDFLAGS="-X k8s.io/helm/pkg/version.Version=v${version} -X k8s.io/helm/pkg/version.BuildMetadata="
_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 documentation and examples.
vmkdir usr/share/examples/$pkgname
vcopy "docs/examples/*" usr/share/examples/$pkgname
for file in docs/man/man1/*.1; do
vman ${file}
done
vinstall completion.bash 644 usr/share/bash-completion/completions helm
vinstall completion.zsh 644 usr/share/$pkgname
# Copy binaries and license
vbin _dist/linux-${_go_target_arch}/helm
vbin _dist/linux-${_go_target_arch}/tiller
vlicense LICENSE
}