aboutsummaryrefslogtreecommitdiffstats
path: root/community/docker/APKBUILD
blob: f39472b834dd0233a1201035ed6d899b5f63b7f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Maintainer: Eivind Uggedal <eivind@uggedal.com>
pkgname=docker
pkgver=1.11.1
_ver=${pkgver/_/-}
pkgrel=0
_gitcommit=v$_ver
pkgdesc="Pack, ship and run any application as a lightweight container"
url="http://www.docker.io/"
arch="all"
license="ASL 2.0"
depends="iptables git xz"
depends_dev=""
makedepends="go sqlite-dev btrfs-progs-dev bash linux-headers coreutils libseccomp-dev"
options="!strip"
install="$pkgname.pre-install"


_runc_ver=0.1.1
_containerd_ver=0.2.1

subpackages="
	$pkgname-bash-completion:bashcomp
	$pkgname-zsh-completion:zshcomp
	$pkgname-vim:vim
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/docker/docker/archive/v$_ver.tar.gz
	runc-$_runc_ver.tar.gz::https://github.com/opencontainers/runc/archive/v$_runc_ver.tar.gz
	containerd-$_containerd_ver.tar.gz::https://github.com/docker/containerd/archive/v$_containerd_ver.tar.gz

	docker-openrc-fixes.patch
	docker-gitcommit.patch

	runc-0001-nsexec-fix-build-against-musl-libc.patch
	"

builddir="$srcdir"/$pkgname-$_ver
_buildtags="exclude_graphdriver_aufs exclude_graphdriver_devicemapper"
_runc_buildtags="seccomp"
_runc_builddir="$srcdir"/runc-$_runc_ver

_containerd_builddir="$srcdir"/containerd-$_containerd_ver

_apply_patches() {
	local _dir="$1"
	local _prefix="$2"
	local i
	msg "applying patches for $_prefix"
	cd "$_dir"
	for i in $source; do
		case $i in
		${_prefix}-*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

prepare() {
	_apply_patches "$builddir" docker || return 1
	_apply_patches "$_runc_builddir" runc || return 1
}

build() {
	cd "$_runc_builddir"


	cd "$builddir"

	export AUTO_GOPATH=1
	export DOCKER_GITCOMMIT=$_gitcommit
	export DOCKER_BUILDTAGS=$_buildtags
	unset CC # prevent possible ccache issues

	# containerd
	cd "$_containerd_builddir" || return 1
	mkdir -p src/github.com/docker/
	ln -s "$_containerd_builddir" src/github.com/docker/containerd
	GOPATH="$PWD" LDFLAGS="" make GIT_COMMIT="v$_containerd_ver" || return 1

	# runc
	cd "$_runc_builddir" || return 1
	GOPATH="$PWD" make COMMIT="v$_runc_ver" || return 1

	# docker
	cd "$builddir"
	./hack/make.sh dynbinary
}

package() {
	cd "$builddir"
	local ver=$(cat VERSION)

	install -Dm755 bundles/$ver/dynbinary/docker-$ver \
		"$pkgdir"/usr/bin/docker || return 1

	install -Dm755 "$_runc_builddir"/runc \
		"$pkgdir"/usr/bin/docker-runc || return 1

	install -Dm755 "$_containerd_builddir"/bin/containerd \
		"$pkgdir"/usr/bin/docker-containerd || return 1

	install -Dm755 "$_containerd_builddir"/bin/containerd-shim \
		"$pkgdir"/usr/bin/docker-containerd-shim || return 1

	install -Dm755 "$_containerd_builddir"/bin/ctr \
		"$pkgdir"/usr/bin/docker-containerd-ctr || return 1

	install -Dm755 bundles/$ver/dynbinary/dockerinit-$ver \
		"$pkgdir"/usr/lib/docker/dockerinit
	install -Dm755 contrib/init/openrc/docker.initd \
		"$pkgdir"/etc/init.d/docker
	install -Dm644 contrib/init/openrc/docker.confd \
		"$pkgdir"/etc/conf.d/docker
}

bashcomp() {
	pkgdesc="Bash completion for Docker"
	arch="noarch"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	install -Dm644 "$builddir"/contrib/completion/bash/$pkgname \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

zshcomp() {
	pkgdesc="Zsh completion for $pkgname"
	arch="noarch"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	install -Dm644 "$builddir"/contrib/completion/zsh/_$pkgname \
		"$subpkgdir"/usr/share/zsh/site-functions/_$pkgname || return 1
}

vim() {
	depends=""
	pkgdesc="Vim syntax for Docker"
	arch="noarch"

	local f=
	for f in ftdetect/dockerfile.vim syntax/dockerfile.vim; do
		install -Dm644 "$builddir"/contrib/syntax/vim/$f \
			"$subpkgdir"/usr/share/vim/vimfiles/$f
	done
}

md5sums="ec0e32e8ce9e05cc0f2de7a439c1b3ca  docker-1.11.1.tar.gz
d9aaf37331c36e89365b72aac4101fb0  runc-0.1.1.tar.gz
dfd6e08dd02d52826878fca67bc000e4  containerd-0.2.1.tar.gz
506e32a6157a7f92e67511111fba6fe8  docker-openrc-fixes.patch
48b59f53f4a288611775df3c21bd7ba6  docker-gitcommit.patch
0c30db28eaccc5489a11b530ec0a4f7b  runc-0001-nsexec-fix-build-against-musl-libc.patch"
sha256sums="04de3750738b6f888f03520fb67db22e95e8a8e016ae901428e6c5791c9841cc  docker-1.11.1.tar.gz
f9955daed1e73e842b2f28a258fba51f4e72a6b4b64cc3fc06415481d55ce000  runc-0.1.1.tar.gz
f9dfeaba17064f279a7dfe89f0ef6763ee45b0a57c03aa423da2af340fba198d  containerd-0.2.1.tar.gz
864d229e21dfa6c931b29b908093302a48837ddb1aa4205088f6f7fd4d7da4e3  docker-openrc-fixes.patch
a81bd65cdc9eab276de78d639a907ca5de3e96c5697d18bb37367fd525500684  docker-gitcommit.patch
a0ed2085c759a51acb1be56880655423156130fad3064f6f800b6a9c56144b78  runc-0001-nsexec-fix-build-against-musl-libc.patch"
sha512sums="7230fa81aee6a35c59c76f9838b59dbe766938660052a4317a23503bf800dd55a408600003ba457b8817a51e9c6c98d8cb40770e06b1244c888eeccac3292576  docker-1.11.1.tar.gz
074482636fd2342c490c450d7a379cd14cd6c7b1ec6109cf729c4b451cc8cfb0e6b286d0df8e0cc0dba7b24d63d12bd5978013e08301a785db5e4280c595fdaa  runc-0.1.1.tar.gz
18f9c824c099220f36b114ac4644f3390791381642bf4cebe47c4c6d4a4299a5b89a7cbd4e01bb5e56c49d42c89b1621d3ba5c1a42bbed7dd2007689fa356457  containerd-0.2.1.tar.gz
1162f62e8a7a5ded0c54cfe46014449efd67491bdb678fa22862117adb08206c909a3f98b0062125d25256dc1f48596b696bd4b19a8804d2862e758678a8bb62  docker-openrc-fixes.patch
deaa18afae793167cfbc7f0b4c7f94db237a9bbabb217201e84dc19849ffbc3473f13d4d28a3692325b5a08758db6563ff310cb6b8dc862fc9f41c84f79e6dad  docker-gitcommit.patch
baedd5b3b45465d70b18c78688db48a35015ad2db5a1ad20c06c21a3b0146f634a0910c215ade7035e4c61f9f140410be7ff9d1cb142af067e09f3844796049f  runc-0001-nsexec-fix-build-against-musl-libc.patch"