commit: 11916e7708abbca389394653f28d659bc817cd05 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> AuthorDate: Sun Feb 8 10:38:30 2026 +0000 Commit: William Hubbs <williamh <AT> gentoo <DOT> org> CommitDate: Fri Feb 13 17:27:51 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11916e77
sys-cluster/kubeadm: Fix cross-compiling Closes: https://github.com/gentoo/gentoo/pull/45684 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> Signed-off-by: William Hubbs <williamh <AT> gentoo.org> sys-cluster/kubeadm/kubeadm-1.35.0.ebuild | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/sys-cluster/kubeadm/kubeadm-1.35.0.ebuild b/sys-cluster/kubeadm/kubeadm-1.35.0.ebuild index effd9786f81c..00fd7946d6e0 100644 --- a/sys-cluster/kubeadm/kubeadm-1.35.0.ebuild +++ b/sys-cluster/kubeadm/kubeadm-1.35.0.ebuild @@ -3,7 +3,7 @@ EAPI=8 -inherit go-module toolchain-funcs shell-completion +inherit go-env go-module shell-completion sysroot DESCRIPTION="CLI to Easily bootstrap a secure Kubernetes cluster" HOMEPAGE="https://kubernetes.io" @@ -25,23 +25,23 @@ BDEPEND=">=dev-lang/go-1.25.4" QA_PRESTRIPPED=usr/bin/kubeadm src_compile() { - CGO_LDFLAGS="$(usex hardened '-fno-PIC ' '')" FORCE_HOST_GO=yes \ - emake -j1 GOFLAGS="${GOFLAGS}" GOLDFLAGS="" LDFLAGS="" 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 - fi + 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} + + 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 } src_install() { - dobin _output/bin/${PN} - - if ! tc-is-cross-compiler; then - newbashcomp ${PN}.bash ${PN} - newzshcomp ${PN}.zsh _${PN} - else - ewarn "Shell completion files not installed! Install them manually with '${PN} completion --help'" - fi + dobin ${bin} + + [[ -s ${PN}.bash ]] && newbashcomp ${PN}.bash ${PN} + [[ -s ${PN}.zsh ]] && newzshcomp ${PN}.zsh _${PN} }
