diff options
Diffstat (limited to 'recipes-containers/containerd/containerd_git.bb')
-rw-r--r-- | recipes-containers/containerd/containerd_git.bb | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/recipes-containers/containerd/containerd_git.bb b/recipes-containers/containerd/containerd_git.bb new file mode 100644 index 00000000..c683fbeb --- /dev/null +++ b/recipes-containers/containerd/containerd_git.bb | |||
@@ -0,0 +1,105 @@ | |||
1 | HOMEPAGE = "https://github.com/containerd/containerd" | ||
2 | SUMMARY = "containerd is a daemon to control runC" | ||
3 | DESCRIPTION = "containerd is a daemon to control runC, built for performance and density. \ | ||
4 | containerd leverages runC's advanced features such as seccomp and user namespace \ | ||
5 | support as well as checkpoint and restore for cloning and live migration of containers." | ||
6 | |||
7 | |||
8 | SRCREV = "06b99ca80cdbfbc6cc8bd567021738c9af2b36ce" | ||
9 | SRC_URI = "git://github.com/containerd/containerd;branch=release/2.0;protocol=https;destsuffix=git/src/github.com/containerd/containerd/v2 \ | ||
10 | file://0001-Makefile-allow-GO_BUILD_FLAGS-to-be-externally-speci.patch \ | ||
11 | file://0001-build-don-t-use-gcflags-to-define-trimpath.patch \ | ||
12 | file://cni-containerd-net.conflist \ | ||
13 | " | ||
14 | |||
15 | # Apache-2.0 for containerd | ||
16 | LICENSE = "Apache-2.0" | ||
17 | LIC_FILES_CHKSUM = "file://LICENSE;md5=1269f40c0d099c21a871163984590d89" | ||
18 | |||
19 | CONTAINERD_VERSION = "v2.0.2" | ||
20 | CVE_VERSION = "v2.0.2" | ||
21 | |||
22 | # EXTRA_OEMAKE += "GODEBUG=1" | ||
23 | |||
24 | # containerd-opencontainers is to provide compatibility with external | ||
25 | # packagegroups / recipes that depend on the existing split of containerd | ||
26 | # between docker and opencontainers. We can drop it in the future. | ||
27 | PROVIDES += "virtual/containerd containerd-opencontainers" | ||
28 | RPROVIDES:${PN} = "virtual-containerd containerd-opencontainers" | ||
29 | |||
30 | S = "${WORKDIR}/git/src/github.com/containerd/containerd/v2" | ||
31 | |||
32 | PV = "${CONTAINERD_VERSION}+git" | ||
33 | |||
34 | inherit go | ||
35 | inherit goarch | ||
36 | |||
37 | GO_IMPORT = "import" | ||
38 | |||
39 | INSANE_SKIP:${PN} += "ldflags" | ||
40 | |||
41 | do_configure[noexec] = "1" | ||
42 | |||
43 | do_compile() { | ||
44 | export GOARCH="${TARGET_GOARCH}" | ||
45 | |||
46 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go:${WORKDIR}/git/" | ||
47 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
48 | |||
49 | # Pass the needed cflags/ldflags so that cgo | ||
50 | # can find the needed headers files and libraries | ||
51 | export CGO_ENABLED="1" | ||
52 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
53 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
54 | export BUILDTAGS="no_btrfs static_build netgo" | ||
55 | export CFLAGS="${CFLAGS}" | ||
56 | export LDFLAGS="${LDFLAGS}" | ||
57 | export SHIM_CGO_ENABLED="${CGO_ENABLED}" | ||
58 | # fixes: | ||
59 | # cannot find package runtime/cgo (using -importcfg) | ||
60 | # ... recipe-sysroot-native/usr/lib/aarch64-poky-linux/go/pkg/tool/linux_amd64/link: | ||
61 | # cannot open file : open : no such file or directory | ||
62 | export GO_BUILD_FLAGS="-trimpath -a -pkgdir dontusecurrentpkgs" | ||
63 | export GO111MODULE=off | ||
64 | |||
65 | cd ${S} | ||
66 | |||
67 | oe_runmake binaries | ||
68 | } | ||
69 | |||
70 | inherit systemd | ||
71 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | ||
72 | SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','containerd.service','',d)}" | ||
73 | |||
74 | do_install() { | ||
75 | mkdir -p ${D}/${bindir} | ||
76 | |||
77 | cp ${S}/bin/containerd ${D}/${bindir}/containerd | ||
78 | cp ${S}/bin/containerd-shim-runc-v2 ${D}/${bindir}/containerd-shim-runc-v2 | ||
79 | cp ${S}/bin/ctr ${D}/${bindir}/containerd-ctr | ||
80 | |||
81 | ln -sf containerd ${D}/${bindir}/docker-containerd | ||
82 | ln -sf containerd-ctr ${D}/${bindir}/docker-containerd-ctr | ||
83 | |||
84 | ln -sf containerd-ctr ${D}/${bindir}/ctr | ||
85 | |||
86 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
87 | install -d ${D}${systemd_unitdir}/system | ||
88 | install -m 644 ${S}/containerd.service ${D}/${systemd_unitdir}/system | ||
89 | # adjust from /usr/local/bin to /usr/bin/ | ||
90 | sed -e "s:/usr/local/bin/containerd:${bindir}/containerd:g" -i ${D}/${systemd_unitdir}/system/containerd.service | ||
91 | fi | ||
92 | } | ||
93 | |||
94 | FILES:${PN} += "${systemd_system_unitdir}/*" | ||
95 | |||
96 | INSANE_SKIP:${PN} += "ldflags already-stripped" | ||
97 | |||
98 | COMPATIBLE_HOST = "^(?!(qemu)?mips).*" | ||
99 | |||
100 | RDEPENDS:${PN} += " ${VIRTUAL-RUNTIME_container_runtime}" | ||
101 | |||
102 | ## This may need to be made conditional on K3S or similar being | ||
103 | ## configured in the distro, since we may have collisions. | ||
104 | CNI_NETWORKING_FILES ?= "${UNPACKDIR}/cni-containerd-net.conflist" | ||
105 | inherit cni_networking | ||