Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 11 | SRC_URI += "file://containerd.service" |
| 12 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 13 | S = "${WORKDIR}/git" |
| 14 | |
| 15 | PV = "${CONTAINERD_VERSION}+git${SRCREV}" |
| 16 | |
| 17 | inherit go |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 18 | inherit goarch |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 19 | |
| 20 | RRECOMMENDS_${PN} = "lxc docker" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 21 | CONTAINERD_PKG="github.com/containerd/containerd" |
| 22 | |
| 23 | INSANE_SKIP_${PN} += "ldflags" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 24 | |
| 25 | do_configure[noexec] = "1" |
| 26 | |
| 27 | do_compile() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 28 | # 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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 35 | |
| 36 | export GOPATH="${WORKDIR}/git/" |
| 37 | export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 38 | |
| 39 | # Pass the needed cflags/ldflags so that cgo |
| 40 | # can find the needed headers files and libraries |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 41 | export GOARCH="${TARGET_GOARCH}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 42 | 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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 47 | export GO_GCFLAGS="" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 48 | 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 | |
| 59 | do_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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 72 | install -m 644 ${WORKDIR}/containerd.service ${D}/${systemd_unitdir}/system |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 73 | # adjust from /usr/local/bin to /usr/bin/ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 74 | sed -e "s:/usr/local/bin/containerd:${bindir}/docker-containerd:g" -i ${D}/${systemd_unitdir}/system/containerd.service |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 75 | fi |
| 76 | } |
| 77 | |
| 78 | FILES_${PN} += "${systemd_system_unitdir}/*" |
| 79 | |
| 80 | INHIBIT_PACKAGE_STRIP = "1" |