Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | HOMEPAGE = "https://github.com/opencontainers/runc" |
| 2 | SUMMARY = "runc container cli tools" |
| 3 | DESCRIPTION = "runc is a CLI tool for spawning and running containers according to the OCI specification." |
| 4 | |
| 5 | # Apache-2.0 for containerd |
| 6 | LICENSE = "Apache-2.0" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 7 | LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=435b266b3899aa8a959f17d41c56def8" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 8 | |
| 9 | S = "${WORKDIR}/git" |
| 10 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 11 | PV = "${RUNC_VERSION}+git${SRCPV}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 12 | |
| 13 | inherit go |
| 14 | RRECOMMENDS_${PN} = "lxc docker" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 15 | PROVIDES += "virtual/runc" |
| 16 | RPROVIDES_${PN} = "virtual/runc" |
| 17 | |
| 18 | GO_IMPORT = "import" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 19 | |
| 20 | LIBCONTAINER_PACKAGE="github.com/opencontainers/runc/libcontainer" |
| 21 | |
| 22 | do_configure[noexec] = "1" |
| 23 | EXTRA_OEMAKE="BUILDTAGS=''" |
| 24 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | do_compile() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on |
| 27 | # docker to download its dependencies but rather |
| 28 | # use dependencies packaged independently. |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 29 | cd ${S}/src/import |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 30 | rm -rf .gopath |
| 31 | dname=`dirname "${LIBCONTAINER_PACKAGE}"` |
| 32 | bname=`basename "${LIBCONTAINER_PACKAGE}"` |
| 33 | mkdir -p .gopath/src/${dname} |
| 34 | |
| 35 | (cd .gopath/src/${dname}; ln -sf ../../../../../${bname} ${bname}) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 36 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" |
| 37 | |
| 38 | # Fix up symlink for go-cross compiler |
| 39 | rm -f ${S}/src/import/vendor/src |
| 40 | ln -sf ./ ${S}/src/import/vendor/src |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 41 | |
| 42 | # Pass the needed cflags/ldflags so that cgo |
| 43 | # can find the needed headers files and libraries |
| 44 | export CGO_ENABLED="1" |
| 45 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" |
| 46 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" |
| 47 | export CFLAGS="" |
| 48 | export LDFLAGS="" |
| 49 | |
| 50 | oe_runmake static |
| 51 | } |
| 52 | |
| 53 | do_install() { |
| 54 | mkdir -p ${D}/${bindir} |
| 55 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 56 | cp ${S}/src/import/runc ${D}/${bindir}/runc |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 57 | ln -sf runc ${D}/${bindir}/docker-runc |
| 58 | } |
| 59 | |
| 60 | INHIBIT_PACKAGE_STRIP = "1" |