# Template file for 'kubernetes-helm'
pkgname=kubernetes-helm
version=4.2.0
revision=1
build_style=go
build_helper=qemu
go_import_path="helm.sh/helm/v4"
go_package="./cmd/helm"
go_mod_mode=off
go_ldflags="-X helm.sh/helm/v4/internal/version.version=v${version%.*}"
make_check_args="-skip=^TestInstallRelease_Wait$"
checkdepends="git"
short_desc="Kubernetes Package Manager"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://helm.sh/"
changelog="https://github.com/helm/helm/releases"
distfiles="https://github.com/helm/helm/archive/refs/tags/v${version}.tar.gz"
checksum=98d6b09a7dce667d0638bd293b6ef768cfc6ba51afda42b0fe0be1c7a021ceb7
conflicts="helm"
nopie=yes

LDFLAGS="-fuse-ld=bfd"

# Skip WASM plugin tests on i686
if [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
	make_check_args="-skip TestRuntimeExtismV1InvokePlugin"
fi

post_install() {
	if [ "$XBPS_TARGET_MACHINE" != aarch64-musl ]; then
		# qemu-aarch64-static segfaults
		# https://build.voidlinux.org/builders/aarch64-musl_builder/builds/49864/steps/shell_3/logs/stdio
		for shell in bash zsh; do
			vtargetrun "${DESTDIR}/usr/bin/helm" completion "${shell}" > "helm.${shell}"
			vcompletion "helm.${shell}" "${shell}"
		done
	fi
}
