mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-21 10:37:22 -08:00
sys-cluster/kubectl: Fix cross-compiling
Closes: https://github.com/gentoo/gentoo/pull/45684 Signed-off-by: James Le Cuirot <chewi@gentoo.org> Signed-off-by: William Hubbs <williamh@gentoo.org>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit go-module toolchain-funcs shell-completion
|
||||
inherit go-env go-module shell-completion sysroot
|
||||
|
||||
DESCRIPTION="CLI to run commands against Kubernetes clusters"
|
||||
HOMEPAGE="https://kubernetes.io"
|
||||
@@ -23,26 +23,25 @@ BDEPEND=">=dev-lang/go-1.25.4"
|
||||
QA_PRESTRIPPED=usr/bin/kubectl
|
||||
|
||||
src_compile() {
|
||||
local GOOS=$(go-env_goos)
|
||||
|
||||
CGO_LDFLAGS="$(usex hardened '-fno-PIC ' '')" \
|
||||
emake -j1 GOFLAGS="${GOFLAGS}" GOLDFLAGS="" LDFLAGS="" FORCE_HOST_GO=yes \
|
||||
KUBE_BUILD_PLATFORMS="${GOOS}/${GOARCH}" KUBE_${GOOS@U}_${GOARCH@U}_CC="${CC}" \
|
||||
WHAT=cmd/${PN}
|
||||
|
||||
if ! tc-is-cross-compiler; then
|
||||
einfo "generating shell completion files"
|
||||
_output/bin/${PN} completion bash > ${PN}.bash || die
|
||||
_output/bin/${PN} completion zsh > ${PN}.zsh || die
|
||||
_output/bin/${PN} completion fish > ${PN}.fish || die
|
||||
fi
|
||||
bin=_output/local/bin/${GOOS}/${GOARCH}/${PN}
|
||||
|
||||
einfo "generating shell completion files"
|
||||
sysroot_try_run_prefixed ${bin} completion bash > ${PN}.bash || die
|
||||
sysroot_try_run_prefixed ${bin} completion zsh > ${PN}.zsh || die
|
||||
sysroot_try_run_prefixed ${bin} completion fish > ${PN}.fish || die
|
||||
}
|
||||
|
||||
src_install() {
|
||||
dobin _output/bin/${PN}
|
||||
dobin ${bin}
|
||||
|
||||
if ! tc-is-cross-compiler; then
|
||||
newbashcomp ${PN}.bash ${PN}
|
||||
newzshcomp ${PN}.zsh _${PN}
|
||||
dofishcomp ${PN}.fish
|
||||
else
|
||||
ewarn "Shell completion files not installed! Install them manually with '${PN} completion --help'"
|
||||
fi
|
||||
[[ -s ${PN}.bash ]] && newbashcomp ${PN}.bash ${PN}
|
||||
[[ -s ${PN}.zsh ]] && newzshcomp ${PN}.zsh _${PN}
|
||||
[[ -s ${PN}.fish ]] && dofishcomp ${PN}.fish
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user