summaryrefslogtreecommitdiffstats
path: root/recipes-containers/docker/docker.inc
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-containers/docker/docker.inc')
-rw-r--r--recipes-containers/docker/docker.inc95
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"
46PACKAGECONFIG[docker-init] = ",,,docker-init" 46PACKAGECONFIG[docker-init] = ",,,docker-init"
47PACKAGECONFIG[transient-config] = "transient-config" 47PACKAGECONFIG[transient-config] = "transient-config"
48 48
49
50GO_IMPORT = "import"
51S = "${WORKDIR}/git"
52
53
49inherit systemd update-rc.d 54inherit systemd update-rc.d
55inherit go
56inherit goarch
57inherit pkgconfig
58
59do_configure[noexec] = "1"
60
61DOCKER_PKG="github.com/docker/docker"
62# in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056
63BUILD_TAGS ?= "exclude_graphdriver_btrfs exclude_graphdriver_devicemapper"
64
65do_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
111do_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
51SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" 140SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
52SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.socket','',d)}" 141SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.socket','',d)}"
@@ -63,3 +152,9 @@ GROUPADD_PARAM_${PN} = "-r docker"
63COMPATIBLE_HOST = "^(?!(qemu)?mips).*" 152COMPATIBLE_HOST = "^(?!(qemu)?mips).*"
64 153
65INSANE_SKIP_${PN} += "ldflags textrel" 154INSANE_SKIP_${PN} += "ldflags textrel"
155
156FILES_${PN} += "${systemd_unitdir}/system/* ${sysconfdir}/docker"
157
158PACKAGES =+ "${PN}-contrib"
159FILES_${PN}-contrib += "${datadir}/docker/check-config.sh"
160RDEPENDS_${PN}-contrib += "bash"