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="9013bf5"
16 SRC_URI="https://${EGO_PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
17 KEYWORDS="~amd64 ~arm ~arm64"
18 [ "$DOCKER_GITCOMMIT" ] || die "DOCKER_GITCOMMIT must be added manually for each bump!"
19 inherit golang-vcs-snapshot
21 inherit bash-completion-r1 golang-base linux-info systemd udev user
23 DESCRIPTION="The core functions you need to create Docker images and run Docker containers"
24 HOMEPAGE="https://dockerproject.org"
27 IUSE="apparmor aufs btrfs +container-init device-mapper hardened +overlay seccomp"
29 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#build-dependencies
31 >=dev-db/sqlite-3.7.9:3
33 >=sys-fs/lvm2-2.02.89[thin]
35 seccomp? ( >=sys-libs/libseccomp-2.2.1 )
36 apparmor? ( sys-libs/libapparmor )
46 >=sys-fs/btrfs-progs-3.16.1
50 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#runtime-dependencies
51 # https://github.com/docker/docker/blob/master/project/PACKAGERS.md#optional-dependencies
54 >=net-firewall/iptables-1.4
57 >=app-arch/xz-utils-4.9
59 ~app-emulation/containerd-1.2.10
60 ~app-emulation/runc-1.0.0_rc9[apparmor?,seccomp?]
61 ~app-emulation/docker-proxy-0.8.0_p20191011
62 container-init? ( >=sys-process/tini-0.18.0[static] )
65 RESTRICT="installsources strip"
67 S="${WORKDIR}/${P}/src/${EGO_PN}"
69 # see "contrib/check-config.sh" from upstream's sources
71 ~NAMESPACES ~NET_NS ~PID_NS ~IPC_NS ~UTS_NS
72 ~CGROUPS ~CGROUP_CPUACCT ~CGROUP_DEVICE ~CGROUP_FREEZER ~CGROUP_SCHED ~CPUSETS ~MEMCG
74 ~VETH ~BRIDGE ~BRIDGE_NETFILTER
75 ~IP_NF_FILTER ~IP_NF_TARGET_MASQUERADE
76 ~NETFILTER_XT_MATCH_ADDRTYPE ~NETFILTER_XT_MATCH_CONNTRACK ~NETFILTER_XT_MATCH_IPVS
77 ~IP_NF_NAT ~NF_NAT ~NF_NAT_NEEDED
83 ~MEMCG_SWAP ~MEMCG_SWAP_ENABLED
85 ~BLK_CGROUP ~BLK_DEV_THROTTLING
89 ~CFS_BANDWIDTH ~FAIR_GROUP_SCHED ~RT_GROUP_SCHED
90 ~IP_VS ~IP_VS_PROTO_TCP ~IP_VS_PROTO_UDP ~IP_VS_NFCT ~IP_VS_RR
93 ~CRYPTO ~CRYPTO_AEAD ~CRYPTO_GCM ~CRYPTO_SEQIV ~CRYPTO_GHASH ~XFRM_ALGO ~XFRM_USER
98 ERROR_KEYS="CONFIG_KEYS: is mandatory"
99 ERROR_MEMCG_SWAP="CONFIG_MEMCG_SWAP: is required if you wish to limit swap usage of containers"
100 ERROR_RESOURCE_COUNTERS="CONFIG_RESOURCE_COUNTERS: is optional for container statistics gathering"
102 ERROR_BLK_CGROUP="CONFIG_BLK_CGROUP: is optional for container statistics gathering"
103 ERROR_IOSCHED_CFQ="CONFIG_IOSCHED_CFQ: is optional for container statistics gathering"
104 ERROR_CGROUP_PERF="CONFIG_CGROUP_PERF: is optional for container statistics gathering"
105 ERROR_CFS_BANDWIDTH="CONFIG_CFS_BANDWIDTH: is optional for container statistics gathering"
106 ERROR_XFRM_ALGO="CONFIG_XFRM_ALGO: is optional for secure networks"
107 ERROR_XFRM_USER="CONFIG_XFRM_USER: is optional for secure networks"
110 if kernel_is lt 3 10; then
112 ewarn "Using Docker with kernels older than 3.10 is unstable and unsupported."
113 ewarn " - http://docs.docker.com/engine/installation/binaries/#check-kernel-dependencies"
116 if kernel_is le 3 18; then
122 if kernel_is le 3 13; then
132 if kernel_is lt 4 5; then
136 ERROR_MEMCG_KMEM="CONFIG_MEMCG_KMEM: is optional"
139 if kernel_is lt 4 7; then
141 ~DEVPTS_MULTIPLE_INSTANCES
145 if kernel_is lt 5 1; then
156 ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
158 ERROR_AUFS_FS="CONFIG_AUFS_FS: is required to be set if and only if aufs-sources are used instead of aufs4/aufs3"
168 if use device-mapper; then
170 ~BLK_DEV_DM ~DM_THIN_PROVISIONING ~EXT4_FS ~EXT4_FS_POSIX_ACL ~EXT4_FS_SECURITY
176 ~OVERLAY_FS ~EXT4_FS_SECURITY ~EXT4_FS_POSIX_ACL
182 # create docker group for the code checking for it in /etc/group
187 export GOPATH="${WORKDIR}/${P}"
189 # setup CFLAGS and LDFLAGS for separate build target
190 # see https://github.com/tianon/docker-overlay/pull/10
191 export CGO_CFLAGS="-I${ROOT}/usr/include"
192 export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
194 # if we're building from a tarball, we need the GITCOMMIT value
195 [ "$DOCKER_GITCOMMIT" ] && export DOCKER_GITCOMMIT
198 ln -s docker-ce/components/engine ../docker || die
199 ln -s docker-ce/components/cli ../cli || die
201 # let's set up some optional features :)
202 export DOCKER_BUILDTAGS=''
203 for gd in aufs btrfs device-mapper overlay; do
205 DOCKER_BUILDTAGS+=" exclude_graphdriver_${gd//-/}"
209 for tag in apparmor seccomp; do
211 DOCKER_BUILDTAGS+=" $tag"
215 pushd components/engine || die
217 if use hardened; then
218 sed -i "s/EXTLDFLAGS_STATIC='/&-fno-PIC /" hack/make.sh || die
219 grep -q -- '-fno-PIC' hack/make.sh || die 'hardened sed failed'
220 sed "s/LDFLAGS_STATIC_DOCKER='/&-extldflags -fno-PIC /" \
221 -i hack/make/dynbinary-daemon || die
222 grep -q -- '-fno-PIC' hack/make/dynbinary-daemon || die 'hardened sed failed'
226 VERSION="$(cat ../../VERSION)" \
227 ./hack/make.sh dynbinary || die 'dynbinary failed'
229 popd || die # components/engine
231 pushd components/cli || die
235 LDFLAGS="$(usex hardened '-extldflags -fno-PIC' '')" \
236 VERSION="$(cat ../../VERSION)" \
237 GITCOMMIT="${DOCKER_GITCOMMIT}" \
238 DISABLE_WARN_OUTSIDE_CONTAINER=1 \
242 go build -o gen-manpages github.com/docker/cli/man || die
243 ./gen-manpages --root . --target ./man/man1 || die
244 ./man/md2man-all.sh -q || die
245 rm gen-manpages || die
246 # see "components/cli/scripts/docs/generate-man.sh" (which also does "go get" for go-md2man)
248 popd || die # components/cli
252 dosym containerd /usr/bin/docker-containerd
253 dosym containerd-shim /usr/bin/docker-containerd-shim
254 dosym runc /usr/bin/docker-runc
255 use container-init && dosym tini /usr/bin/docker-init
257 pushd components/engine || die
258 newbin bundles/dynbinary-daemon/dockerd-${PV} dockerd
260 newinitd contrib/init/openrc/docker.initd docker
261 newconfd contrib/init/openrc/docker.confd docker
263 systemd_dounit contrib/init/systemd/docker.{service,socket}
265 udev_dorules contrib/udev/*.rules
267 dodoc AUTHORS CONTRIBUTING.md CHANGELOG.md NOTICE README.md
270 insinto /usr/share/vim/vimfiles
271 doins -r contrib/syntax/vim/ftdetect
272 doins -r contrib/syntax/vim/syntax
274 # note: intentionally not using "doins" so that we preserve +x bits
275 dodir /usr/share/${PN}/contrib
276 cp -R contrib/* "${ED}/usr/share/${PN}/contrib"
277 popd || die # components/engine
279 pushd components/cli || die
281 newbin build/docker-* docker
285 dobashcomp contrib/completion/bash/*
286 insinto /usr/share/fish/vendor_completions.d/
287 doins contrib/completion/fish/docker.fish
288 insinto /usr/share/zsh/site-functions
289 doins contrib/completion/zsh/_*
290 popd || die # components/cli
297 elog "To use Docker, the Docker daemon must be running as root. To automatically"
298 elog "start the Docker daemon at boot, add Docker to the default runlevel:"
299 elog " rc-update add docker default"
300 elog "Similarly for systemd:"
301 elog " systemctl enable docker.service"
303 elog "To use Docker as a non-root user, add yourself to the 'docker' group:"
304 elog " usermod -aG docker youruser"
307 elog " Devicemapper storage driver has been deprecated"
308 elog " It will be removed in a future release"