blob: e7a371926f01b706c2ced3cd3659642f63a24ac5 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001HOMEPAGE = "https://github.com/docker/containerd"
2SUMMARY = "containerd is a daemon to control runC"
3DESCRIPTION = "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
8LICENSE = "Apache-2.0"
9LIC_FILES_CHKSUM = "file://LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7"
10
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011SRC_URI += "file://containerd.service"
12
Brad Bishop6e60e8b2018-02-01 10:27:11 -050013S = "${WORKDIR}/git"
14
15PV = "${CONTAINERD_VERSION}+git${SRCREV}"
16
17inherit go
Brad Bishopd7bf8c12018-02-25 22:55:05 -050018inherit goarch
Brad Bishop6e60e8b2018-02-01 10:27:11 -050019
20RRECOMMENDS_${PN} = "lxc docker"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021CONTAINERD_PKG="github.com/containerd/containerd"
22
23INSANE_SKIP_${PN} += "ldflags"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050024
25do_configure[noexec] = "1"
26
27do_compile() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028 # Set GOPATH. See 'PACKAGERS.md'. Don't rely on
29 # docker to download its dependencies but rather
30 # use dependencies packaged independently.
31 cd ${S}
32 rm -rf .gopath
33 mkdir -p .gopath/src/"$(dirname "${CONTAINERD_PKG}")"
34 ln -sf ../../../.. .gopath/src/"${CONTAINERD_PKG}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050035
36 export GOPATH="${WORKDIR}/git/"
37 export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050038
39 # Pass the needed cflags/ldflags so that cgo
40 # can find the needed headers files and libraries
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041 export GOARCH="${TARGET_GOARCH}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050042 export CGO_ENABLED="1"
43 export CFLAGS=""
44 export LDFLAGS=""
45 export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
46 export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050047 export GO_GCFLAGS=""
Brad Bishop6e60e8b2018-02-01 10:27:11 -050048 export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
49 export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
50
51 oe_runmake static
52}
53
54# Note: disabled for now, since docker is launching containerd
55# inherit systemd
56# SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
57# SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','containerd.service','',d)}"
58
59do_install() {
60 mkdir -p ${D}/${bindir}
61
62 cp ${S}/bin/containerd ${D}/${bindir}/containerd
63 cp ${S}/bin/containerd-shim ${D}/${bindir}/containerd-shim
64 cp ${S}/bin/ctr ${D}/${bindir}/containerd-ctr
65
66 ln -sf containerd ${D}/${bindir}/docker-containerd
67 ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim
68 ln -sf containerd-ctr ${D}/${bindir}/docker-containerd-ctr
69
70 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
71 install -d ${D}${systemd_unitdir}/system
Brad Bishopd7bf8c12018-02-25 22:55:05 -050072 install -m 644 ${WORKDIR}/containerd.service ${D}/${systemd_unitdir}/system
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073 # adjust from /usr/local/bin to /usr/bin/
Brad Bishopd7bf8c12018-02-25 22:55:05 -050074 sed -e "s:/usr/local/bin/containerd:${bindir}/docker-containerd:g" -i ${D}/${systemd_unitdir}/system/containerd.service
Brad Bishop6e60e8b2018-02-01 10:27:11 -050075 fi
76}
77
78FILES_${PN} += "${systemd_system_unitdir}/*"
79
80INHIBIT_PACKAGE_STRIP = "1"