summaryrefslogtreecommitdiff
path: root/app-containers/k3d/k3d-5.8.3.ebuild
blob: 38dc7be011949ab363183c989f26550a771f68a4 (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
51
52
# Copyright 2021-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit shell-completion go-module

K3D_K3S_TAG=v1.31.5-k3s1

DESCRIPTION="k3d creates k3s clusters in docker"
HOMEPAGE="https://github.com/rancher/k3d"
SRC_URI="https://github.com/rancher/k3d/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT Apache-2.0 BSD BSD-2 MPL-2.0 ISC"
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc"

src_prepare() {
	default
	rm Makefile || die
}

src_compile() {
	local ldflags=(
		-w -s
		-X "github.com/k3d-io/k3d/v5/version.Version=v${PV}"
		-X "github.com/k3d-io/k3d/v5/version.K3sVersion=${K3D_K3S_TAG}"
	)
	local -x GOWORK="" CGO_ENABLED=1
	ego build -mod=vendor -ldflags "${ldflags[*]}" -o bin/k3d

	./bin/k3d completion bash > ${PN}.bash || die
	./bin/k3d completion zsh > ${PN}.zsh || die
	./bin/k3d completion fish > ${PN}.fish || die
}

src_test() {
	ego test -v ./... -skip "TestGetK3sVersion"
}

src_install() {
	dobin bin/${PN}

	newbashcomp ${PN}.bash ${PN}
	newzshcomp ${PN}.zsh _${PN}
	dofishcomp ${PN}.fish

	DOCS=( *.md )
	use doc && DOCS+=( docs )
	default_src_install
}