aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-containers/cri-tools/cri-tools_git.bb
blob: 07ba2580648dc38568e124950f695796cb4bb9f8 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
HOMEPAGE = "https://github.com/kubernetes-sigs/cri-tools"
SUMMARY = "CLI and validation tools for Kubelet Container Runtime Interface (CRI)"
DESCRIPTION = "What is the scope of this project? \
\
cri-tools aims to provide a series of debugging and validation tools for \
Kubelet CRI, which includes: \
\
  * crictl: CLI for kubelet CRI. \
  * critest: validation test suites for kubelet CRI. \
\
What is not in scope for this project? \
\
  * Building a new kubelet container runtime based on CRI. \
  * Managing pods/containers for CRI-compatible runtimes by end-users, e.g. \
    pods created by crictl may be removed automatically by kubelet because of \
    non-exist on the kube-apiserver. \
 "

SRCREV_cri-tools = "a989838814805e1053688e0e94adf13d60e716c6"
SRC_URI = "\
	git://github.com/kubernetes-sigs/cri-tools.git;branch=master;name=cri-tools;protocol=https \
        file://0001-build-allow-environmental-CGO-settings-and-pass-dont.patch \
	"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"

GO_IMPORT = "import"

PV = "1.22.0+git${SRCREV_cri-tools}"

RPROVIDES:${PN} += "crictl"
PACKAGES =+ "${PN}-critest"

inherit go
inherit goarch
inherit pkgconfig

EXTRA_OEMAKE="BUILDTAGS=''"

do_compile() {
	# link fixups for compilation
	rm -f ${S}/src/import/vendor/src
	ln -sf ./ ${S}/src/import/vendor/src

	export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
	cd ${S}/src/import

	# Build the target binaries
	export GOARCH="${TARGET_GOARCH}"
	# Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries
	export CGO_ENABLED="1"
	export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
	export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
	export CFLAGS=""
	export LDFLAGS=""
	export CC="${CC}"
	export LD="${LD}"
	export GOBIN=""

	oe_runmake crictl
}

do_install() {
    install -d ${D}${bindir}
    install -m 755 -D ${S}/src/import/build/bin/* ${D}/${bindir}
}

FILES:${PN}-critest = "${bindir}/critest"

# don't clobber hooks.d
ALLOW_EMPTY:${PN} = "1"

INSANE_SKIP:${PN} += "ldflags already-stripped textrel"

deltask compile_ptest_base

COMPATIBLE_HOST = "^(?!(qemu)?mips).*"