blob: b0fda3502ab41df219963acf5106df38ca39029b [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -05001HOMEPAGE = "http://www.docker.com"
2SUMMARY = "Linux container runtime"
3DESCRIPTION = "Linux container runtime \
4 Docker complements kernel namespacing with a high-level API which \
5 operates at the process level. It runs unix processes with strong \
6 guarantees of isolation and repeatability across servers. \
7 . \
8 Docker is a great building block for automating distributed systems: \
9 large-scale web deployments, database clusters, continuous deployment \
10 systems, private PaaS, service-oriented architectures, etc. \
11 . \
Patrick Williamse69d2352017-02-23 20:56:04 -060012 This package contains the daemon and client. Using docker.io is \
13 officially supported on x86_64 and arm (32-bit) hosts. \
14 Other architectures are considered experimental. \
Patrick Williamsd849ec72016-08-17 14:59:38 -050015 . \
Patrick Williamse69d2352017-02-23 20:56:04 -060016 Also, note that kernel version 3.10 or above is required for proper \
Patrick Williamsd849ec72016-08-17 14:59:38 -050017 operation of the daemon process, and that any lower versions may have \
18 subtle and/or glaring issues. \
19 "
20
Patrick Williamse69d2352017-02-23 20:56:04 -060021SRCREV = "7392c3b0ce0f9d3e918a321c66668c5d1ef4f689"
Patrick Williamsd849ec72016-08-17 14:59:38 -050022SRC_URI = "\
23 git://github.com/docker/docker.git;nobranch=1 \
24 file://docker.service \
25 file://docker.init \
26 file://hi.Dockerfile \
Patrick Williamsd849ec72016-08-17 14:59:38 -050027 "
28
29# Apache-2.0 for docker
30LICENSE = "Apache-2.0"
Patrick Williamse69d2352017-02-23 20:56:04 -060031LIC_FILES_CHKSUM = "file://LICENSE;md5=aadc30f9c14d876ded7bedc0afd2d3d7"
Patrick Williamsd849ec72016-08-17 14:59:38 -050032
33S = "${WORKDIR}/git"
34
Patrick Williamse69d2352017-02-23 20:56:04 -060035DOCKER_VERSION = "1.12.5"
Patrick Williamsd849ec72016-08-17 14:59:38 -050036PV = "${DOCKER_VERSION}+git${SRCREV}"
37
Patrick Williamse69d2352017-02-23 20:56:04 -060038DEPENDS = " \
39 go-cross \
Patrick Williamsd849ec72016-08-17 14:59:38 -050040 go-cli \
41 go-pty \
42 go-context \
43 go-mux \
44 go-patricia \
45 go-libtrust \
46 go-logrus \
47 go-fsnotify \
48 go-dbus \
49 go-capability \
50 go-systemd \
51 btrfs-tools \
52 sqlite3 \
53 go-distribution-digest \
54 "
55
56DEPENDS_append_class-target = "lvm2"
Patrick Williamse69d2352017-02-23 20:56:04 -060057RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \
58 ${@bb.utils.contains('DISTRO_FEATURES','systemd','','cgroup-lite',d)} \
59 "
60RDEPENDS_${PN} += "containerd runc"
Patrick Williamsd849ec72016-08-17 14:59:38 -050061RRECOMMENDS_${PN} = "lxc docker-registry rt-tests"
62RRECOMMENDS_${PN} += " kernel-module-dm-thin-pool kernel-module-nf-nat"
63DOCKER_PKG="github.com/docker/docker"
64
65do_configure[noexec] = "1"
66
67do_compile() {
Patrick Williamse69d2352017-02-23 20:56:04 -060068 case "${TARGET_ARCH}" in
69 arm)
70 GOARCH=arm
71 case "${TUNE_PKGARCH}" in
72 cortexa*)
73 export GOARM=7
74 ;;
75 esac
76 ;;
77 aarch64)
78 GOARCH=arm64
79 ;;
80 i586|i686)
81 GOARCH=386
82 ;;
83 x86_64)
84 GOARCH=amd64
85 ;;
86 *)
87 GOARCH="${TARGET_ARCH}"
88 ;;
89 esac
90 export GOARCH
Patrick Williamsd849ec72016-08-17 14:59:38 -050091
92 # Set GOPATH. See 'PACKAGERS.md'. Don't rely on
93 # docker to download its dependencies but rather
94 # use dependencies packaged independently.
95 cd ${S}
96 rm -rf .gopath
97 mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
98 ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
99 export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
Patrick Williamse69d2352017-02-23 20:56:04 -0600100 export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500101 cd -
102
103 # Pass the needed cflags/ldflags so that cgo
104 # can find the needed headers files and libraries
105 export CGO_ENABLED="1"
Patrick Williamse69d2352017-02-23 20:56:04 -0600106 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
107 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500108 # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056
109 export DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdriver_devicemapper'
110
111 # this is the unsupported built structure
112 # that doesn't rely on an existing docker
113 # to build this:
114 DOCKER_GITCOMMIT="${SRCREV}" \
115 ./hack/make.sh dynbinary
116}
117
118inherit systemd update-rc.d
119
Patrick Williamse69d2352017-02-23 20:56:04 -0600120SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
121SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500122
Patrick Williamse69d2352017-02-23 20:56:04 -0600123INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}"
124INITSCRIPT_NAME_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500125INITSCRIPT_PARAMS_${PN} = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
126
127do_install() {
128 mkdir -p ${D}/${bindir}
Patrick Williamse69d2352017-02-23 20:56:04 -0600129 cp ${S}/bundles/latest/dynbinary-client/docker ${D}/${bindir}/docker
130 cp ${S}/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
131 cp ${S}/bundles/latest/dynbinary-daemon/docker-proxy ${D}/${bindir}/docker-proxy
Patrick Williamsd849ec72016-08-17 14:59:38 -0500132
Patrick Williamse69d2352017-02-23 20:56:04 -0600133 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
Patrick Williamsd849ec72016-08-17 14:59:38 -0500134 install -d ${D}${systemd_unitdir}/system
135 install -m 644 ${S}/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system
136 # replaces one copied from above with one that uses the local registry for a mirror
137 install -m 644 ${WORKDIR}/docker.service ${D}/${systemd_unitdir}/system
Patrick Williamse69d2352017-02-23 20:56:04 -0600138 else
139 install -d ${D}${sysconfdir}/init.d
140 install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init
Patrick Williamsd849ec72016-08-17 14:59:38 -0500141 fi
142
143 mkdir -p ${D}/usr/share/docker/
144 cp ${WORKDIR}/hi.Dockerfile ${D}/usr/share/docker/
145}
146
147inherit useradd
148USERADD_PACKAGES = "${PN}"
149GROUPADD_PARAM_${PN} = "-r docker"
150
151FILES_${PN} += "/lib/systemd/system/*"
152
Patrick Williamse69d2352017-02-23 20:56:04 -0600153# DO NOT STRIP docker
Patrick Williamsd849ec72016-08-17 14:59:38 -0500154INHIBIT_PACKAGE_STRIP = "1"