diff options
3 files changed, 68 insertions, 32 deletions
diff --git a/recipes-containers/containerd/containerd-opencontainers_git.bb b/recipes-containers/containerd/containerd-opencontainers_git.bb index 37f85472..316eea74 100644 --- a/recipes-containers/containerd/containerd-opencontainers_git.bb +++ b/recipes-containers/containerd/containerd-opencontainers_git.bb | |||
| @@ -1,9 +1,11 @@ | |||
| 1 | SRCREV = "cfd04396dc68220d1cecbe686a6cc3aa5ce3667c" | ||
| 2 | SRC_URI = "git://github.com/containerd/containerd;nobranch=1 \ | ||
| 3 | file://0001-containerd-shim-build-with-CGO.patch \ | ||
| 4 | " | ||
| 5 | |||
| 1 | include containerd.inc | 6 | include containerd.inc |
| 2 | 7 | ||
| 3 | SRCREV = "0ac3cd1be170d180b2baed755e8f0da547ceb267" | 8 | CONTAINERD_VERSION = "v1.0.2" |
| 4 | SRC_URI = "git://github.com/docker/containerd.git;nobranch=1 \ | ||
| 5 | " | ||
| 6 | CONTAINERD_VERSION = "0.2.2" | ||
| 7 | 9 | ||
| 8 | PROVIDES += "virtual/containerd" | 10 | PROVIDES += "virtual/containerd" |
| 9 | RPROVIDES_${PN} = "virtual/containerd" | 11 | RPROVIDES_${PN} = "virtual/containerd" |
diff --git a/recipes-containers/containerd/containerd.inc b/recipes-containers/containerd/containerd.inc index e7a37192..9f66e46e 100644 --- a/recipes-containers/containerd/containerd.inc +++ b/recipes-containers/containerd/containerd.inc | |||
| @@ -6,7 +6,7 @@ DESCRIPTION = "containerd is a daemon to control runC, built for performance and | |||
| 6 | 6 | ||
| 7 | # Apache-2.0 for containerd | 7 | # Apache-2.0 for containerd |
| 8 | LICENSE = "Apache-2.0" | 8 | LICENSE = "Apache-2.0" |
| 9 | LIC_FILES_CHKSUM = "file://LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7" | 9 | LIC_FILES_CHKSUM = "file://src/import/LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7" |
| 10 | 10 | ||
| 11 | SRC_URI += "file://containerd.service" | 11 | SRC_URI += "file://containerd.service" |
| 12 | 12 | ||
| @@ -17,6 +17,8 @@ PV = "${CONTAINERD_VERSION}+git${SRCREV}" | |||
| 17 | inherit go | 17 | inherit go |
| 18 | inherit goarch | 18 | inherit goarch |
| 19 | 19 | ||
| 20 | GO_IMPORT = "import" | ||
| 21 | |||
| 20 | RRECOMMENDS_${PN} = "lxc docker" | 22 | RRECOMMENDS_${PN} = "lxc docker" |
| 21 | CONTAINERD_PKG="github.com/containerd/containerd" | 23 | CONTAINERD_PKG="github.com/containerd/containerd" |
| 22 | 24 | ||
| @@ -25,30 +27,35 @@ INSANE_SKIP_${PN} += "ldflags" | |||
| 25 | do_configure[noexec] = "1" | 27 | do_configure[noexec] = "1" |
| 26 | 28 | ||
| 27 | do_compile() { | 29 | do_compile() { |
| 28 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | 30 | export GOARCH="${TARGET_GOARCH}" |
| 29 | # docker to download its dependencies but rather | 31 | |
| 30 | # use dependencies packaged independently. | 32 | # link fixups for compilation |
| 31 | cd ${S} | 33 | rm -f ${S}/src/import/vendor/src |
| 32 | rm -rf .gopath | 34 | ln -sf ./ ${S}/src/import/vendor/src |
| 33 | mkdir -p .gopath/src/"$(dirname "${CONTAINERD_PKG}")" | 35 | |
| 34 | ln -sf ../../../.. .gopath/src/"${CONTAINERD_PKG}" | 36 | mkdir -p ${S}/src/import/vendor/src/github.com/containerd/containerd/ |
| 35 | 37 | # without this, the stress test parts of the build fail | |
| 36 | export GOPATH="${WORKDIR}/git/" | 38 | cp ${S}/src/import/*.go ${S}/src/import/vendor/src/github.com/containerd/containerd |
| 37 | export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" | 39 | |
| 38 | 40 | for c in content errdefs fs images mount snapshots linux api runtimes defaults progress \ | |
| 39 | # Pass the needed cflags/ldflags so that cgo | 41 | protobuf reference diff platforms runtime remotes version archive dialer gc metadata \ |
| 40 | # can find the needed headers files and libraries | 42 | metrics filters identifiers labels leases plugin server services \ |
| 41 | export GOARCH="${TARGET_GOARCH}" | 43 | cmd cio containers namespaces oci events log reaper sys rootfs; do |
| 42 | export CGO_ENABLED="1" | 44 | ln -sfn ${S}/src/import/${c} ${S}/src/import/vendor/github.com/containerd/containerd/${c} |
| 43 | export CFLAGS="" | 45 | done |
| 44 | export LDFLAGS="" | 46 | |
| 45 | export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | 47 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" |
| 46 | export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | 48 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" |
| 47 | export GO_GCFLAGS="" | 49 | |
| 48 | export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | 50 | # Pass the needed cflags/ldflags so that cgo |
| 49 | export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | 51 | # can find the needed headers files and libraries |
| 50 | 52 | export CGO_ENABLED="1" | |
| 51 | oe_runmake static | 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 | |||
| 57 | cd ${S}/src/import | ||
| 58 | oe_runmake binaries | ||
| 52 | } | 59 | } |
| 53 | 60 | ||
| 54 | # Note: disabled for now, since docker is launching containerd | 61 | # Note: disabled for now, since docker is launching containerd |
| @@ -59,9 +66,9 @@ do_compile() { | |||
| 59 | do_install() { | 66 | do_install() { |
| 60 | mkdir -p ${D}/${bindir} | 67 | mkdir -p ${D}/${bindir} |
| 61 | 68 | ||
| 62 | cp ${S}/bin/containerd ${D}/${bindir}/containerd | 69 | cp ${S}/src/import/bin/containerd ${D}/${bindir}/containerd |
| 63 | cp ${S}/bin/containerd-shim ${D}/${bindir}/containerd-shim | 70 | cp ${S}/src/import/bin/containerd-shim ${D}/${bindir}/containerd-shim |
| 64 | cp ${S}/bin/ctr ${D}/${bindir}/containerd-ctr | 71 | cp ${S}/src/import/bin/ctr ${D}/${bindir}/containerd-ctr |
| 65 | 72 | ||
| 66 | ln -sf containerd ${D}/${bindir}/docker-containerd | 73 | ln -sf containerd ${D}/${bindir}/docker-containerd |
| 67 | ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim | 74 | ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim |
| @@ -78,3 +85,4 @@ do_install() { | |||
| 78 | FILES_${PN} += "${systemd_system_unitdir}/*" | 85 | FILES_${PN} += "${systemd_system_unitdir}/*" |
| 79 | 86 | ||
| 80 | INHIBIT_PACKAGE_STRIP = "1" | 87 | INHIBIT_PACKAGE_STRIP = "1" |
| 88 | INSANE_SKIP_${PN} += "ldflags already-stripped" | ||
diff --git a/recipes-containers/containerd/files/0001-containerd-shim-build-with-CGO.patch b/recipes-containers/containerd/files/0001-containerd-shim-build-with-CGO.patch new file mode 100644 index 00000000..3b890834 --- /dev/null +++ b/recipes-containers/containerd/files/0001-containerd-shim-build-with-CGO.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | From a1d2db9037b1302c4ce4cfc170a4fa443f68e594 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Bruce Ashfield <bruce.ashfield@windriver.com> | ||
| 3 | Date: Thu, 29 Mar 2018 15:48:41 -0400 | ||
| 4 | Subject: [PATCH] containerd-shim: build with CGO | ||
| 5 | |||
| 6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> | ||
| 7 | --- | ||
| 8 | Makefile | 2 +- | ||
| 9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 10 | |||
| 11 | diff --git a/src/import/Makefile b/src/import/Makefile | ||
| 12 | index 9d8cf8a18fbc..1dff4e3c2043 100644 | ||
| 13 | --- a/src/import/Makefile | ||
| 14 | +++ b/src/import/Makefile | ||
| 15 | @@ -134,7 +134,7 @@ bin/%: cmd/% FORCE | ||
| 16 | |||
| 17 | bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220 | ||
| 18 | @echo "$(WHALE) bin/containerd-shim" | ||
| 19 | - @CGO_ENABLED=0 go build -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim | ||
| 20 | + @go build -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim | ||
| 21 | |||
| 22 | binaries: $(BINARIES) ## build binaries | ||
| 23 | @echo "$(WHALE) $@" | ||
| 24 | -- | ||
| 25 | 2.4.0.53.g8440f74 | ||
| 26 | |||
