diff options
Diffstat (limited to 'recipes-containers/containerd/containerd.inc')
| -rw-r--r-- | recipes-containers/containerd/containerd.inc | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/recipes-containers/containerd/containerd.inc b/recipes-containers/containerd/containerd.inc new file mode 100644 index 00000000..a128fbde --- /dev/null +++ b/recipes-containers/containerd/containerd.inc | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | HOMEPAGE = "https://github.com/docker/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 | # Apache-2.0 for containerd | ||
| 8 | LICENSE = "Apache-2.0" | ||
| 9 | LIC_FILES_CHKSUM = "file://LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7" | ||
| 10 | |||
| 11 | S = "${WORKDIR}/git" | ||
| 12 | |||
| 13 | PV = "${CONTAINERD_VERSION}+git${SRCREV}" | ||
| 14 | |||
| 15 | DEPENDS = "go-cross-${TARGET_ARCH} \ | ||
| 16 | " | ||
| 17 | |||
| 18 | RRECOMMENDS_${PN} = "lxc docker" | ||
| 19 | CONTAINERD_PKG="github.com/docker/containerd" | ||
| 20 | |||
| 21 | do_configure[noexec] = "1" | ||
| 22 | |||
| 23 | do_compile() { | ||
| 24 | export GOARCH="${TARGET_ARCH}" | ||
| 25 | # supported amd64, 386, arm arm64 | ||
| 26 | if [ "${TARGET_ARCH}" = "x86_64" ]; then | ||
| 27 | export GOARCH="amd64" | ||
| 28 | fi | ||
| 29 | if [ "${TARGET_ARCH}" = "aarch64" ]; then | ||
| 30 | export GOARCH="arm64" | ||
| 31 | fi | ||
| 32 | if [ "${TARGET_ARCH}" = "i586" ]; then | ||
| 33 | export GOARCH="386" | ||
| 34 | fi | ||
| 35 | |||
| 36 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | ||
| 37 | # docker to download its dependencies but rather | ||
| 38 | # use dependencies packaged independently. | ||
| 39 | cd ${S} | ||
| 40 | rm -rf .gopath | ||
| 41 | mkdir -p .gopath/src/"$(dirname "${CONTAINERD_PKG}")" | ||
| 42 | ln -sf ../../../.. .gopath/src/"${CONTAINERD_PKG}" | ||
| 43 | export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | ||
| 44 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
| 45 | cd - | ||
| 46 | |||
| 47 | # Pass the needed cflags/ldflags so that cgo | ||
| 48 | # can find the needed headers files and libraries | ||
| 49 | export CGO_ENABLED="1" | ||
| 50 | export CFLAGS="" | ||
| 51 | export LDFLAGS="" | ||
| 52 | export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 53 | export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 54 | export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
| 55 | export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
| 56 | |||
| 57 | oe_runmake static | ||
| 58 | } | ||
| 59 | |||
| 60 | # Note: disabled for now, since docker is launching containerd | ||
| 61 | # inherit systemd | ||
| 62 | # SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | ||
| 63 | # SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','containerd.service','',d)}" | ||
| 64 | |||
| 65 | do_install() { | ||
| 66 | mkdir -p ${D}/${bindir} | ||
| 67 | |||
| 68 | cp ${S}/bin/containerd ${D}/${bindir}/containerd | ||
| 69 | cp ${S}/bin/containerd-shim ${D}/${bindir}/containerd-shim | ||
| 70 | cp ${S}/bin/ctr ${D}/${bindir}/containerd-ctr | ||
| 71 | |||
| 72 | ln -sf containerd ${D}/${bindir}/docker-containerd | ||
| 73 | ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim | ||
| 74 | ln -sf containerd-ctr ${D}/${bindir}/docker-containerd-ctr | ||
| 75 | |||
| 76 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
| 77 | install -d ${D}${systemd_unitdir}/system | ||
| 78 | install -m 644 ${S}/hack/containerd.service ${D}/${systemd_unitdir}/system | ||
| 79 | # adjust from /usr/local/bin to /usr/bin/ | ||
| 80 | sed -e "s:/usr/local/bin/containerd:${bindir}/docker-containerd -l \"unix\:///var/run/docker/libcontainerd/docker-containerd.sock\":g" -i ${D}/${systemd_unitdir}/system/containerd.service | ||
| 81 | fi | ||
| 82 | } | ||
| 83 | |||
| 84 | FILES_${PN} += "${systemd_system_unitdir}/*" | ||
| 85 | |||
| 86 | INHIBIT_PACKAGE_STRIP = "1" | ||
