diff options
Diffstat (limited to 'recipes-containers/docker/docker.inc')
| -rw-r--r-- | recipes-containers/docker/docker.inc | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/recipes-containers/docker/docker.inc b/recipes-containers/docker/docker.inc index 65b7368d..a011366f 100644 --- a/recipes-containers/docker/docker.inc +++ b/recipes-containers/docker/docker.inc | |||
| @@ -46,7 +46,96 @@ PACKAGECONFIG[seccomp] = "seccomp,,libseccomp" | |||
| 46 | PACKAGECONFIG[docker-init] = ",,,docker-init" | 46 | PACKAGECONFIG[docker-init] = ",,,docker-init" |
| 47 | PACKAGECONFIG[transient-config] = "transient-config" | 47 | PACKAGECONFIG[transient-config] = "transient-config" |
| 48 | 48 | ||
| 49 | |||
| 50 | GO_IMPORT = "import" | ||
| 51 | S = "${WORKDIR}/git" | ||
| 52 | |||
| 53 | |||
| 49 | inherit systemd update-rc.d | 54 | inherit systemd update-rc.d |
| 55 | inherit go | ||
| 56 | inherit goarch | ||
| 57 | inherit pkgconfig | ||
| 58 | |||
| 59 | do_configure[noexec] = "1" | ||
| 60 | |||
| 61 | DOCKER_PKG="github.com/docker/docker" | ||
| 62 | # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056 | ||
| 63 | BUILD_TAGS ?= "exclude_graphdriver_btrfs exclude_graphdriver_devicemapper" | ||
| 64 | |||
| 65 | do_compile() { | ||
| 66 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | ||
| 67 | # docker to download its dependencies but rather | ||
| 68 | # use dependencies packaged independently. | ||
| 69 | cd ${S}/src/import | ||
| 70 | rm -rf .gopath | ||
| 71 | mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" | ||
| 72 | ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" | ||
| 73 | |||
| 74 | mkdir -p .gopath/src/github.com/docker | ||
| 75 | ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork | ||
| 76 | ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli | ||
| 77 | |||
| 78 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | ||
| 79 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
| 80 | |||
| 81 | # Pass the needed cflags/ldflags so that cgo | ||
| 82 | # can find the needed headers files and libraries | ||
| 83 | export GOARCH=${TARGET_GOARCH} | ||
| 84 | export CGO_ENABLED="1" | ||
| 85 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 86 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 87 | export DOCKER_BUILDTAGS='${BUILD_TAGS} ${PACKAGECONFIG_CONFARGS}' | ||
| 88 | export GO111MODULE=off | ||
| 89 | |||
| 90 | export DISABLE_WARN_OUTSIDE_CONTAINER=1 | ||
| 91 | |||
| 92 | cd ${S}/src/import/ | ||
| 93 | |||
| 94 | # this is the unsupported built structure | ||
| 95 | # that doesn't rely on an existing docker | ||
| 96 | # to build this: | ||
| 97 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_moby}" ./hack/make.sh dynbinary | ||
| 98 | |||
| 99 | # build the cli | ||
| 100 | cd ${S}/src/import/.gopath/src/github.com/docker/cli | ||
| 101 | export CFLAGS="" | ||
| 102 | export LDFLAGS="" | ||
| 103 | export DOCKER_VERSION=${DOCKER_VERSION} | ||
| 104 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_moby}" make dynbinary | ||
| 105 | |||
| 106 | # build the proxy | ||
| 107 | cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork | ||
| 108 | oe_runmake cross-local | ||
| 109 | } | ||
| 110 | |||
| 111 | do_install() { | ||
| 112 | mkdir -p ${D}/${bindir} | ||
| 113 | cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker | ||
| 114 | cp ${S}/src/import/bundles/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd | ||
| 115 | cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy | ||
| 116 | |||
| 117 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
| 118 | install -d ${D}${systemd_unitdir}/system | ||
| 119 | install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system | ||
| 120 | # replaces one copied from above with one that uses the local registry for a mirror | ||
| 121 | install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system | ||
| 122 | rm -f ${D}/${systemd_unitdir}/system/docker.service.rpm | ||
| 123 | else | ||
| 124 | install -d ${D}${sysconfdir}/init.d | ||
| 125 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init | ||
| 126 | fi | ||
| 127 | # TLS key that docker creates at run-time if not found is what resides here | ||
| 128 | if ${@bb.utils.contains('PACKAGECONFIG','transient-config','true','false',d)}; then | ||
| 129 | install -d ${D}${sysconfdir} | ||
| 130 | ln -s ..${localstatedir}/run/docker ${D}${sysconfdir}/docker | ||
| 131 | else | ||
| 132 | install -d ${D}${sysconfdir}/docker | ||
| 133 | fi | ||
| 134 | |||
| 135 | mkdir -p ${D}${datadir}/docker/ | ||
| 136 | install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/ | ||
| 137 | } | ||
| 138 | |||
| 50 | 139 | ||
| 51 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | 140 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" |
| 52 | SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.socket','',d)}" | 141 | SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.socket','',d)}" |
| @@ -63,3 +152,9 @@ GROUPADD_PARAM_${PN} = "-r docker" | |||
| 63 | COMPATIBLE_HOST = "^(?!(qemu)?mips).*" | 152 | COMPATIBLE_HOST = "^(?!(qemu)?mips).*" |
| 64 | 153 | ||
| 65 | INSANE_SKIP_${PN} += "ldflags textrel" | 154 | INSANE_SKIP_${PN} += "ldflags textrel" |
| 155 | |||
| 156 | FILES_${PN} += "${systemd_unitdir}/system/* ${sysconfdir}/docker" | ||
| 157 | |||
| 158 | PACKAGES =+ "${PN}-contrib" | ||
| 159 | FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" | ||
| 160 | RDEPENDS_${PN}-contrib += "bash" | ||
