gentoo-overlay/sys-cluster/openshift-clients/openshift-clients-4.11.0_p2...

41 lines
955 B
Bash

# Copyright 2021-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit bash-completion-r1 go-module
OS_VERSION=${PV//_p/-}
BN=oc
DESCRIPTION="The OpenShift Command Line, part of OKD"
HOMEPAGE="https://www.okd.io/"
SRC_URI="https://github.com/openshift/oc/archive/refs/tags/${PN}-${OS_VERSION}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 ~arm64"
IUSE="hardened"
BDEPEND=">=dev-lang/go-1.19
virtual/krb5
app-crypt/gpgme"
RESTRICT+=" test"
S="${WORKDIR}/${BN}-${PN}-${OS_VERSION}"
src_compile() {
CGO_LDFLAGS="$(usex hardened '-fno-PIC ' '')" \
emake OS_GIT_VERSION="v${OS_VERSION}" OS_GIT_COMMIT='' OS_GIT_TREE_STATE=''
}
src_install() {
${BN} completion bash > ${BN}.bash || die
${BN} completion zsh > ${BN}.zsh || die
newbashcomp ${BN}.bash ${BN}
insinto /usr/share/zsh/site-functions
newins ${BN}.zsh _${BN}
./genman docs/generated oc
doman docs/generated/*
dobin ${BN}
}