| 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 | . \ | 
|  | 12 | This package contains the daemon and client. Using docker.io on non-amd64 \ | 
|  | 13 | hosts is not supported at this time. Please be careful when using it \ | 
|  | 14 | on anything besides amd64. \ | 
|  | 15 | . \ | 
|  | 16 | Also, note that kernel version 3.8 or above is required for proper \ | 
|  | 17 | operation of the daemon process, and that any lower versions may have \ | 
|  | 18 | subtle and/or glaring issues. \ | 
|  | 19 | " | 
|  | 20 |  | 
|  | 21 | SRCREV = "76d6bc9a9f1690e16f3721ba165364688b626de2" | 
|  | 22 | SRC_URI = "\ | 
|  | 23 | git://github.com/docker/docker.git;nobranch=1 \ | 
|  | 24 | file://docker.service \ | 
|  | 25 | file://docker.init \ | 
|  | 26 | file://hi.Dockerfile \ | 
|  | 27 | file://disable_sha1sum_startup.patch \ | 
|  | 28 | file://Bump-bolt-to-v1.1.0.patch \ | 
|  | 29 | " | 
|  | 30 |  | 
|  | 31 | # Apache-2.0 for docker | 
|  | 32 | LICENSE = "Apache-2.0" | 
|  | 33 | LIC_FILES_CHKSUM = "file://LICENSE;md5=cc2221abf0b96ea39dd68141b70f7937" | 
|  | 34 |  | 
|  | 35 | S = "${WORKDIR}/git" | 
|  | 36 |  | 
|  | 37 | DOCKER_VERSION = "1.9.0" | 
|  | 38 | PV = "${DOCKER_VERSION}+git${SRCREV}" | 
|  | 39 |  | 
|  | 40 | DEPENDS = "go-cross \ | 
|  | 41 | go-cli \ | 
|  | 42 | go-pty \ | 
|  | 43 | go-context \ | 
|  | 44 | go-mux \ | 
|  | 45 | go-patricia \ | 
|  | 46 | go-libtrust \ | 
|  | 47 | go-logrus \ | 
|  | 48 | go-fsnotify \ | 
|  | 49 | go-dbus \ | 
|  | 50 | go-capability \ | 
|  | 51 | go-systemd \ | 
|  | 52 | btrfs-tools \ | 
|  | 53 | sqlite3 \ | 
|  | 54 | go-distribution-digest \ | 
|  | 55 | " | 
|  | 56 |  | 
|  | 57 | DEPENDS_append_class-target = "lvm2" | 
|  | 58 | RDEPENDS_${PN} = "curl aufs-util git cgroup-lite util-linux iptables" | 
|  | 59 | RRECOMMENDS_${PN} = "lxc docker-registry rt-tests" | 
|  | 60 | RRECOMMENDS_${PN} += " kernel-module-dm-thin-pool kernel-module-nf-nat" | 
|  | 61 | DOCKER_PKG="github.com/docker/docker" | 
|  | 62 |  | 
|  | 63 | do_configure[noexec] = "1" | 
|  | 64 |  | 
|  | 65 | do_compile() { | 
|  | 66 | export GOARCH="${TARGET_ARCH}" | 
|  | 67 | # supported amd64, 386, arm arm64 | 
|  | 68 | if [ "${TARGET_ARCH}" = "x86_64" ]; then | 
|  | 69 | export GOARCH="amd64" | 
|  | 70 | fi | 
|  | 71 | if [ "${TARGET_ARCH}" = "aarch64" ]; then | 
|  | 72 | export GOARCH="arm64" | 
|  | 73 | fi | 
|  | 74 |  | 
|  | 75 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | 
|  | 76 | # docker to download its dependencies but rather | 
|  | 77 | # use dependencies packaged independently. | 
|  | 78 | cd ${S} | 
|  | 79 | rm -rf .gopath | 
|  | 80 | mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" | 
|  | 81 | ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}" | 
|  | 82 | export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | 
|  | 83 | cd - | 
|  | 84 |  | 
|  | 85 | # Pass the needed cflags/ldflags so that cgo | 
|  | 86 | # can find the needed headers files and libraries | 
|  | 87 | export CGO_ENABLED="1" | 
|  | 88 | export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | 
|  | 89 | export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | 
|  | 90 | # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056 | 
|  | 91 | export DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdriver_devicemapper' | 
|  | 92 |  | 
|  | 93 | # this is the unsupported built structure | 
|  | 94 | # that doesn't rely on an existing docker | 
|  | 95 | # to build this: | 
|  | 96 | DOCKER_GITCOMMIT="${SRCREV}" \ | 
|  | 97 | ./hack/make.sh dynbinary | 
|  | 98 | } | 
|  | 99 |  | 
|  | 100 | inherit systemd update-rc.d | 
|  | 101 |  | 
|  | 102 | SYSTEMD_PACKAGES = "${@base_contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | 
|  | 103 | SYSTEMD_SERVICE_${PN} = "${@base_contains('DISTRO_FEATURES','systemd','docker.service','',d)}" | 
|  | 104 |  | 
|  | 105 | INITSCRIPT_PACKAGES += "${@base_contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}" | 
|  | 106 | INITSCRIPT_NAME_${PN} = "${@base_contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}" | 
|  | 107 | INITSCRIPT_PARAMS_${PN} = "${OS_DEFAULT_INITSCRIPT_PARAMS}" | 
|  | 108 |  | 
|  | 109 | do_install() { | 
|  | 110 | mkdir -p ${D}/${bindir} | 
|  | 111 | cp ${S}/bundles/${DOCKER_VERSION}/dynbinary/docker-${DOCKER_VERSION} \ | 
|  | 112 | ${D}/${bindir}/docker | 
|  | 113 | cp ${S}/bundles/${DOCKER_VERSION}/dynbinary/dockerinit-${DOCKER_VERSION} \ | 
|  | 114 | ${D}/${bindir}/dockerinit | 
|  | 115 |  | 
|  | 116 | if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then | 
|  | 117 | install -d ${D}${systemd_unitdir}/system | 
|  | 118 | install -m 644 ${S}/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system | 
|  | 119 | # replaces one copied from above with one that uses the local registry for a mirror | 
|  | 120 | install -m 644 ${WORKDIR}/docker.service ${D}/${systemd_unitdir}/system | 
|  | 121 | else | 
|  | 122 | install -d ${D}${sysconfdir}/init.d | 
|  | 123 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init | 
|  | 124 | fi | 
|  | 125 |  | 
|  | 126 | mkdir -p ${D}/usr/share/docker/ | 
|  | 127 | cp ${WORKDIR}/hi.Dockerfile ${D}/usr/share/docker/ | 
|  | 128 | } | 
|  | 129 |  | 
|  | 130 | inherit useradd | 
|  | 131 | USERADD_PACKAGES = "${PN}" | 
|  | 132 | GROUPADD_PARAM_${PN} = "-r docker" | 
|  | 133 |  | 
|  | 134 | FILES_${PN} += "/lib/systemd/system/*" | 
|  | 135 |  | 
|  | 136 | # DO NOT STRIP docker and dockerinit!!! | 
|  | 137 | # | 
|  | 138 | # Reason: | 
|  | 139 | # The "docker" package contains two binaries: "docker" and "dockerinit", | 
|  | 140 | # which are both written in Go. The "dockerinit" package is built first, | 
|  | 141 | # then its checksum is given to the build process compiling the "docker" | 
|  | 142 | # binary. Hence the checksum of the unstripped "dockerinit" binary is hard | 
|  | 143 | # coded into the "docker" binary. At runtime the "docker" binary invokes | 
|  | 144 | # the "dockerinit" binary, but before doing that it ensures the checksum | 
|  | 145 | # of "dockerinit" matches with the hard coded value. | 
|  | 146 | # | 
|  | 147 | INHIBIT_PACKAGE_STRIP = "1" |