1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 EGO_PN="github.com/docker/docker-ce"
8 if [[ ${PV} = *9999* ]]; then
9 # Docker cannot be fetched via "go get", thanks to autogenerated code
10 EGIT_REPO_URI="https://${EGO_PN}.git"
11 EGIT_CHECKOUT_DIR="${WORKDIR}/${P}/src/${EGO_PN}"
14 DOCKER_GITCOMMIT="6247962"
15 SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
16 KEYWORDS="amd64 ~arm ~arm64"
17 [ "$DOCKER_GITCOMMIT" ] || die "DOCKER_GITCOMMIT must be added manually for each bump!"
18 inherit golang-vcs-snapshot
20 inherit bash-completion-r1 golang-base linux-info systemd udev user
22 DESCRIPTION="The core functions you need to create Docker images and run Docker containers"
23 HOMEPAGE="https://dockerproject.org"
26 IUSE="apparmor aufs btrfs +container-init device-mapper hardened +overlay pkcs11 seccomp"
28 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
30 >=dev-db/sqlite-3.7.9:3
32 >=sys-fs/lvm2-2.02.89[thin]
34 seccomp? ( >=sys-libs/libseccomp-2.2.1 )
35 apparmor? ( sys-libs/libapparmor )
44 >=sys-fs/btrfs-progs-3.16.1
48 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
49 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#optional-dependencies
52 >=net-firewall/iptables-1.4
55 >=app-arch/xz-utils-4.9
57 ~app-emulation/containerd-1.2.2
58 ~app-emulation/runc-1.0.0_rc6_p20181203[apparmor?,seccomp?]
59 >=app-emulation/runc-1.0.0_rc6_p20181203-r1
60 ~app-emulation/docker-proxy-0.8.0_p20181207
61 container-init? ( >=sys-process/tini-0.18.0[static] )
64 RESTRICT="installsources strip"
66 S="${WORKDIR}/${P}/src/${EGO_PN}"
68 # see "contrib/check-config.sh" from upstream's sources
70 ~NAMESPACES ~NET_NS ~PID_NS ~IPC_NS ~UTS_NS
71 ~CGROUPS ~CGROUP_CPUACCT ~CGROUP_DEVICE ~CGROUP_FREEZER ~CGROUP_SCHED ~CPUSETS ~MEMCG
73 ~VETH ~BRIDGE ~BRIDGE_NETFILTER
74 ~NF_NAT_IPV4 ~IP_NF_FILTER ~IP_NF_TARGET_MASQUERADE
75 ~NETFILTER_XT_MATCH_ADDRTYPE ~NETFILTER_XT_MATCH_CONNTRACK ~NETFILTER_XT_MATCH_IPVS
76 ~IP_NF_NAT ~NF_NAT ~NF_NAT_NEEDED
82 ~MEMCG_SWAP ~MEMCG_SWAP_ENABLED
84 ~BLK_CGROUP ~BLK_DEV_THROTTLING ~IOSCHED_CFQ ~CFQ_GROUP_IOSCHED
88 ~CFS_BANDWIDTH ~FAIR_GROUP_SCHED ~RT_GROUP_SCHED
89 ~IP_VS ~IP_VS_PROTO_TCP ~IP_VS_PROTO_UDP ~IP_VS_NFCT ~IP_VS_RR
92 ~CRYPTO ~CRYPTO_AEAD ~CRYPTO_GCM ~CRYPTO_SEQIV ~CRYPTO_GHASH ~XFRM_ALGO ~XFRM_USER
97 ERROR_KEYS="CONFIG_KEYS: is mandatory"
98 ERROR_MEMCG_SWAP="CONFIG_MEMCG_SWAP: is required if you wish to limit swap usage of containers"
99 ERROR_RESOURCE_COUNTERS="CONFIG_RESOURCE_COUNTERS: is optional for container statistics gathering"
101 ERROR_BLK_CGROUP="CONFIG_BLK_CGROUP: is optional for container statistics gathering"
102 ERROR_IOSCHED_CFQ="CONFIG_IOSCHED_CFQ: is optional for container statistics gathering"
103 ERROR_CGROUP_PERF="CONFIG_CGROUP_PERF: is optional for container statistics gathering"
104 ERROR_CFS_BANDWIDTH="CONFIG_CFS_BANDWIDTH: is optional for container statistics gathering"
105 ERROR_XFRM_ALGO="CONFIG_XFRM_ALGO: is optional for secure networks"
106 ERROR_XFRM_USER="CONFIG_XFRM_USER: is optional for secure networks"
109 if kernel_is lt 3 10; then
111 ewarn "Using Docker with kernels older than 3.10 is unstable and unsupported."
112 ewarn " - http://docs.docker.com/engine/installation/binaries/#check-kernel-dependencies"
115 if kernel_is le 3 18; then
121 if kernel_is le 3 13; then
131 if kernel_is lt 4 5; then
135 ERROR_MEMCG_KMEM="CONFIG_MEMCG_KMEM: is optional"
138 if kernel_is lt 4 7; then
140 ~DEVPTS_MULTIPLE_INSTANCES
147 ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
149 ERROR_AUFS_FS="CONFIG_AUFS_FS: is required to be set if and only if aufs-sources are used instead of aufs4/aufs3"
159 if use device-mapper; then
161 ~BLK_DEV_DM ~DM_THIN_PROVISIONING ~EXT4_FS ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
167 ~OVERLAY_FS ~EXT4_FS_SECURITY ~EXT4_FS_POSIX_ACL
173 # create docker group for the code checking for it in /etc/group
178 export GOPATH="${WORKDIR}/${P}"
180 # setup CFLAGS and LDFLAGS for separate build target
181 # see https://github.com/tianon/docker-overlay/pull/10
182 export CGO_CFLAGS="-I${ROOT}/usr/include"
183 export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
185 # if we're building from a tarball, we need the GITCOMMIT value
186 [ "$DOCKER_GITCOMMIT" ] && export DOCKER_GITCOMMIT
189 ln -s docker-ce/components/engine ../docker || die
190 ln -s docker-ce/components/cli ../cli || die
192 # let's set up some optional features :)
193 export DOCKER_BUILDTAGS=''
194 for gd in aufs btrfs device-mapper overlay; do
196 DOCKER_BUILDTAGS+=" exclude_graphdriver_${gd//-/}"
200 for tag in apparmor pkcs11 seccomp; do
202 DOCKER_BUILDTAGS+=" $tag"
206 pushd components/engine || die
208 if use hardened; then
209 sed -i "s/EXTLDFLAGS_STATIC='/&-fno-PIC /" hack/make.sh || die
210 grep -q -- '-fno-PIC' hack/make.sh || die 'hardened sed failed'
211 sed "s/LDFLAGS_STATIC_DOCKER='/&-extldflags -fno-PIC /" \
212 -i hack/make/dynbinary-daemon || die
213 grep -q -- '-fno-PIC' hack/make/dynbinary-daemon || die 'hardened sed failed'
217 VERSION="$(cat ../../VERSION)" \
218 ./hack/make.sh dynbinary || die 'dynbinary failed'
220 popd || die # components/engine
222 pushd components/cli || die
226 LDFLAGS="$(usex hardened '-extldflags -fno-PIC' '')" \
227 VERSION="$(cat ../../VERSION)" \
228 GITCOMMIT="${DOCKER_GITCOMMIT}" \
229 DISABLE_WARN_OUTSIDE_CONTAINER=1 \
233 go build -o gen-manpages github.com/docker/cli/man || die
234 ./gen-manpages --root . --target ./man/man1 || die
235 ./man/md2man-all.sh -q || die
236 rm gen-manpages || die
237 # see "components/cli/scripts/docs/generate-man.sh" (which also does "go get" for go-md2man)
239 popd || die # components/cli
243 dosym containerd /usr/bin/docker-containerd
244 dosym containerd-shim /usr/bin/docker-containerd-shim
245 dosym runc /usr/bin/docker-runc
246 use container-init && dosym tini /usr/bin/docker-init
248 pushd components/engine || die
249 newbin "$(readlink -f bundles/latest/dynbinary-daemon/dockerd)" dockerd
251 newinitd contrib/init/openrc/docker.initd docker
252 newconfd contrib/init/openrc/docker.confd docker
254 systemd_dounit contrib/init/systemd/docker.{service,socket}
256 udev_dorules contrib/udev/*.rules
258 dodoc AUTHORS CONTRIBUTING.md CHANGELOG.md NOTICE README.md
261 insinto /usr/share/vim/vimfiles
262 doins -r contrib/syntax/vim/ftdetect
263 doins -r contrib/syntax/vim/syntax
265 # note: intentionally not using "doins" so that we preserve +x bits
266 dodir /usr/share/${PN}/contrib
267 cp -R contrib/* "${ED}/usr/share/${PN}/contrib"
268 popd || die # components/engine
270 pushd components/cli || die
272 newbin build/docker-* docker
276 dobashcomp contrib/completion/bash/*
277 insinto /usr/share/fish/vendor_completions.d/
278 doins contrib/completion/fish/docker.fish
279 insinto /usr/share/zsh/site-functions
280 doins contrib/completion/zsh/_*
281 popd || die # components/cli
288 elog "To use Docker, the Docker daemon must be running as root. To automatically"
289 elog "start the Docker daemon at boot, add Docker to the default runlevel:"
290 elog " rc-update add docker default"
291 elog "Similarly for systemd:"
292 elog " systemctl enable docker.service"
294 elog "To use Docker as a non-root user, add yourself to the 'docker' group:"
295 elog " usermod -aG docker youruser"
298 elog " Devicemapper storage driver has been deprecated"
299 elog " It will be removed in a future release"