blob: eb47cc9eec33493b5d30203dd0db181656da3c81 [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"
Brad Bishop316dfdd2018-06-25 12:45:53 -04009LIC_FILES_CHKSUM = "file://src/import/LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010
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
Brad Bishop316dfdd2018-06-25 12:45:53 -040020GO_IMPORT = "import"
21
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022RRECOMMENDS_${PN} = "lxc docker"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050023CONTAINERD_PKG="github.com/containerd/containerd"
24
25INSANE_SKIP_${PN} += "ldflags"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026
27do_configure[noexec] = "1"
28
29do_compile() {
Brad Bishop316dfdd2018-06-25 12:45:53 -040030 export GOARCH="${TARGET_GOARCH}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050031
Brad Bishop316dfdd2018-06-25 12:45:53 -040032 # link fixups for compilation
33 rm -f ${S}/src/import/vendor/src
34 ln -sf ./ ${S}/src/import/vendor/src
Brad Bishop6e60e8b2018-02-01 10:27:11 -050035
Brad Bishop316dfdd2018-06-25 12:45:53 -040036 mkdir -p ${S}/src/import/vendor/src/github.com/containerd/containerd/
37 # without this, the stress test parts of the build fail
38 cp ${S}/src/import/*.go ${S}/src/import/vendor/src/github.com/containerd/containerd
Brad Bishop6e60e8b2018-02-01 10:27:11 -050039
Brad Bishop316dfdd2018-06-25 12:45:53 -040040 for c in content errdefs fs images mount snapshots linux api runtimes defaults progress \
41 protobuf reference diff platforms runtime remotes version archive dialer gc metadata \
42 metrics filters identifiers labels leases plugin server services \
43 cmd cio containers namespaces oci events log reaper sys rootfs; do
44 ln -sfn ${S}/src/import/${c} ${S}/src/import/vendor/github.com/containerd/containerd/${c}
45 done
46
47 export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
48 export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
49
50 # Pass the needed cflags/ldflags so that cgo
51 # can find the needed headers files and libraries
52 export CGO_ENABLED="1"
53 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
54 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
55 export BUILDTAGS="no_btrfs static_build netgo"
56 export CFLAGS="${CFLAGS}"
57 export LDFLAGS="${LDFLAGS}"
58
59 cd ${S}/src/import
60 oe_runmake binaries
Brad Bishop6e60e8b2018-02-01 10:27:11 -050061}
62
63# Note: disabled for now, since docker is launching containerd
64# inherit systemd
65# SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
66# SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','containerd.service','',d)}"
67
68do_install() {
69 mkdir -p ${D}/${bindir}
70
Brad Bishop316dfdd2018-06-25 12:45:53 -040071 cp ${S}/src/import/bin/containerd ${D}/${bindir}/containerd
72 cp ${S}/src/import/bin/containerd-shim ${D}/${bindir}/containerd-shim
73 cp ${S}/src/import/bin/ctr ${D}/${bindir}/containerd-ctr
Brad Bishop6e60e8b2018-02-01 10:27:11 -050074
75 ln -sf containerd ${D}/${bindir}/docker-containerd
76 ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim
77 ln -sf containerd-ctr ${D}/${bindir}/docker-containerd-ctr
78
79 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
80 install -d ${D}${systemd_unitdir}/system
Brad Bishopd7bf8c12018-02-25 22:55:05 -050081 install -m 644 ${WORKDIR}/containerd.service ${D}/${systemd_unitdir}/system
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082 # adjust from /usr/local/bin to /usr/bin/
Brad Bishopd7bf8c12018-02-25 22:55:05 -050083 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 -050084 fi
85}
86
87FILES_${PN} += "${systemd_system_unitdir}/*"
88
89INHIBIT_PACKAGE_STRIP = "1"
Brad Bishop316dfdd2018-06-25 12:45:53 -040090INSANE_SKIP_${PN} += "ldflags already-stripped"