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" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 9 | LIC_FILES_CHKSUM = "file://src/import/LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 20 | GO_IMPORT = "import" |
| 21 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | RRECOMMENDS_${PN} = "lxc docker" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 23 | CONTAINERD_PKG="github.com/containerd/containerd" |
| 24 | |
| 25 | INSANE_SKIP_${PN} += "ldflags" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | |
| 27 | do_configure[noexec] = "1" |
| 28 | |
| 29 | do_compile() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 30 | export GOARCH="${TARGET_GOARCH}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 31 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 32 | # link fixups for compilation |
| 33 | rm -f ${S}/src/import/vendor/src |
| 34 | ln -sf ./ ${S}/src/import/vendor/src |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 35 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 36 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 39 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 40 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 61 | } |
| 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 | |
| 68 | do_install() { |
| 69 | mkdir -p ${D}/${bindir} |
| 70 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 71 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 74 | |
| 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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 81 | install -m 644 ${WORKDIR}/containerd.service ${D}/${systemd_unitdir}/system |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 82 | # adjust from /usr/local/bin to /usr/bin/ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 83 | 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] | 84 | fi |
| 85 | } |
| 86 | |
| 87 | FILES_${PN} += "${systemd_system_unitdir}/*" |
| 88 | |
| 89 | INHIBIT_PACKAGE_STRIP = "1" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 90 | INSANE_SKIP_${PN} += "ldflags already-stripped" |