| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 1 | HOMEPAGE = "http://www.docker.com" | 
|  | 2 | SUMMARY = "Linux container runtime" | 
|  | 3 | DESCRIPTION = "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 Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 12 | 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 Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 15 | . \ | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 16 | Also, note that kernel version 3.10 or above is required for proper \ | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 17 | operation of the daemon process, and that any lower versions may have \ | 
|  | 18 | subtle and/or glaring issues. \ | 
|  | 19 | " | 
|  | 20 |  | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 21 | SRCREV = "7392c3b0ce0f9d3e918a321c66668c5d1ef4f689" | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 22 | SRC_URI = "\ | 
|  | 23 | git://github.com/docker/docker.git;nobranch=1 \ | 
|  | 24 | file://docker.service \ | 
|  | 25 | file://docker.init \ | 
|  | 26 | file://hi.Dockerfile \ | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 27 | " | 
|  | 28 |  | 
|  | 29 | # Apache-2.0 for docker | 
|  | 30 | LICENSE = "Apache-2.0" | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 31 | LIC_FILES_CHKSUM = "file://LICENSE;md5=aadc30f9c14d876ded7bedc0afd2d3d7" | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 32 |  | 
|  | 33 | S = "${WORKDIR}/git" | 
|  | 34 |  | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 35 | DOCKER_VERSION = "1.12.5" | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 36 | PV = "${DOCKER_VERSION}+git${SRCREV}" | 
|  | 37 |  | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 38 | DEPENDS = " \ | 
|  | 39 | go-cross \ | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 40 | 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 |  | 
|  | 56 | DEPENDS_append_class-target = "lvm2" | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 57 | RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \ | 
|  | 58 | ${@bb.utils.contains('DISTRO_FEATURES','systemd','','cgroup-lite',d)} \ | 
|  | 59 | " | 
|  | 60 | RDEPENDS_${PN} += "containerd runc" | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 61 | RRECOMMENDS_${PN} = "lxc docker-registry rt-tests" | 
|  | 62 | RRECOMMENDS_${PN} += " kernel-module-dm-thin-pool kernel-module-nf-nat" | 
|  | 63 | DOCKER_PKG="github.com/docker/docker" | 
|  | 64 |  | 
|  | 65 | do_configure[noexec] = "1" | 
|  | 66 |  | 
|  | 67 | do_compile() { | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 68 | 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 Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 91 |  | 
|  | 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 Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 100 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 101 | 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 Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 106 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | 
|  | 107 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 108 | # 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 |  | 
|  | 118 | inherit systemd update-rc.d | 
|  | 119 |  | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 120 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | 
|  | 121 | SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}" | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 122 |  | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 123 | INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}" | 
|  | 124 | INITSCRIPT_NAME_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}" | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 125 | INITSCRIPT_PARAMS_${PN} = "${OS_DEFAULT_INITSCRIPT_PARAMS}" | 
|  | 126 |  | 
|  | 127 | do_install() { | 
|  | 128 | mkdir -p ${D}/${bindir} | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 129 | 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 Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 132 |  | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 133 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 134 | 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 Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 138 | else | 
|  | 139 | install -d ${D}${sysconfdir}/init.d | 
|  | 140 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 141 | fi | 
|  | 142 |  | 
|  | 143 | mkdir -p ${D}/usr/share/docker/ | 
|  | 144 | cp ${WORKDIR}/hi.Dockerfile ${D}/usr/share/docker/ | 
|  | 145 | } | 
|  | 146 |  | 
|  | 147 | inherit useradd | 
|  | 148 | USERADD_PACKAGES = "${PN}" | 
|  | 149 | GROUPADD_PARAM_${PN} = "-r docker" | 
|  | 150 |  | 
|  | 151 | FILES_${PN} += "/lib/systemd/system/*" | 
|  | 152 |  | 
| Patrick Williams | e69d235 | 2017-02-23 20:56:04 -0600 | [diff] [blame] | 153 | # DO NOT STRIP docker | 
| Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 154 | INHIBIT_PACKAGE_STRIP = "1" |