summaryrefslogtreecommitdiff
blob: f55d3182b8504beb6016c6e49ba641e12795de3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6
PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )

inherit python-any-r1 golang-build golang-vcs-snapshot

EGO_PN="k8s.io/minikube"
ARCHIVE_URI="https://github.com/kubernetes/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64"

DESCRIPTION="Single Node Kubernetes Cluster"
HOMEPAGE="https://github.com/kubernetes/minikube https://kubernetes.io"
SRC_URI="${ARCHIVE_URI}"

LICENSE="Apache-2.0"
SLOT="0"
IUSE="hardened libvirt"

DEPEND="dev-go/go-bindata
	${PYTHON_DEPS}
	libvirt? ( app-emulation/libvirt[qemu] )"
RDEPEND=">=sys-cluster/kubectl-1.10.0"

RESTRICT="test"

src_prepare() {
	default
	sed -i -e 's/ -s -w/ -w/' -e 's#.*GOBIN=$(GOPATH)/bin go get github.com/jteeuwen/go-bindata/...##' -e 's#$(GOPATH)/bin/go-bindata#/usr/bin/go-bindata#g' src/${EGO_PN}/Makefile || die
	sed -i -e "s/get_commit(), get_tree_state(), get_version()/get_commit(), 'gitTreeState=clean', get_version()/"  src/${EGO_PN}/hack/get_k8s_version.py || die
}

src_compile() {
	export CGO_LDFLAGS="$(usex hardened '-fno-PIC ' '')"
	LDFLAGS="" GOFLAGS="-v" GOPATH="${WORKDIR}/${P}" emake -C src/${EGO_PN}  $(usex libvirt "out/docker-machine-driver-kvm2" "") out/minikube-linux-amd64
}

src_install() {
	pushd src/${EGO_PN} || die
	newbin out/minikube-linux-amd64 minikube
	dobin $(usex libvirt "out/docker-machine-driver-kvm2" "")
	dodoc -r docs CHANGELOG.md README.md
	popd || die
}

pkg_postinst() {
	elog "You may want to install the following optional dependency:"
	elog "  app-emulation/virtualbox or app-emulation/virtualbox-bin"
}