# Template file for 'minikube'
pkgname=minikube
version=1.38.1
revision=1
archs="x86_64* i686* aarch64*"
build_style=go
build_helper=qemu
go_ldflags="-X k8s.io/minikube/pkg/version.version=$version"
go_import_path="k8s.io/minikube"
go_package="./cmd/minikube"
# integration/stress suites require a prebuilt minikube binary; run only unit tests
make_check_target="./cmd/... ./pkg/..."
hostmakedepends="go-bindata pkg-config"
makedepends="libvirt-devel"
depends="kubectl"
short_desc="Tool to make it easy to run Kubernetes locally"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://github.com/kubernetes/minikube"
changelog="https://raw.githubusercontent.com/kubernetes/minikube/master/CHANGELOG.md"
distfiles="https://github.com/kubernetes/minikube/archive/v$version.tar.gz"
checksum=f3401ff708235441d12ee47f5e8b5e7f55e7944585ae2a9bdb4b8cb629838f7c

# TestGetUsername expects $USER, unset in the xbps-src build sandbox
make_check_pre="env USER=xbps"

pre_build() {
	local storage_provisioner_tag= iso_version=

	storage_provisioner_tag=$(sed -n '/^STORAGE_PROVISIONER_TAG/s/.*=\W*//p' Makefile)
	iso_version=$(sed -n '/^ISO_VERSION/s/.*=\W*//p' Makefile)

	go_ldflags+="
	 -X k8s.io/minikube/pkg/version.version=${version}
	 -X k8s.io/minikube/pkg/version.isoVersion=${iso_version}
	 -X k8s.io/minikube/pkg/version.storageProvisionerVersion=${storage_provisioner_tag}
	"
}

do_install() {
	vbin $GOPATH/bin/minikube

	for shell in bash zsh fish; do
		vtargetrun $GOPATH/bin/minikube completion $shell > completion.$shell
		vcompletion completion.$shell $shell
	done
	vdoc "${FILESDIR}/README.voidlinux"
}
