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