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