APKBUILD 3.38 KB
Newer Older
1
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
2
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
Carlo Landmeter's avatar
Carlo Landmeter committed
3
pkgname=lxd
Sean's avatar
Sean committed
4
pkgver=4.18
5
pkgrel=2
Carlo Landmeter's avatar
Carlo Landmeter committed
6 7
pkgdesc="a container hypervisor and a new user experience for LXC"
url="https://linuxcontainers.org/lxd/"
8
arch="all !mips !mips64"
Carlo Landmeter's avatar
Carlo Landmeter committed
9
license="Apache-2.0"
10
pkggroups="$pkgname"
11 12
depends="
	acl
Sean's avatar
Sean committed
13
	attr
14 15 16 17
	netcat-openbsd
	cgmanager
	squashfs-tools
	rsync
18
	dqlite
19
	shadow-uidmap
20
	lxc
21 22 23
	ip6tables
	dnsmasq
	ca-certificates
24
	tar
25
	iproute2
Leonardo Arena's avatar
Leonardo Arena committed
26
	xz
27 28 29 30 31
	"
makedepends="
	lxc-dev
	gettext-dev
	acl-dev
32
	acl-static
33 34
	tcl-dev
	libuv-dev
35
	eudev-dev
36 37 38 39 40 41 42 43 44 45
	libcap-dev
	linux-headers

	rsync
	go
	intltool

	libtool
	autoconf
	automake
46
	patchelf
47
	dqlite-dev
48
	dqlite-static
49
	lz4-dev
50
	sqlite-dev
51
	sqlite-static
52
	raft-dev
53 54 55 56 57 58
	raft-static
	gettext-static
	zlib-static
	libuv-static
	libseccomp-static
	libcap-static
59 60
	"
subpackages="
61
	$pkgname-scripts:scripts:noarch
62
	$pkgname-bash-completion
63 64
	$pkgname-openrc
	"
65
install="$pkgname.pre-install"
66
options="!check"
Sean's avatar
Sean committed
67
source="https://linuxcontainers.org/downloads/lxd/lxd-$pkgver.tar.gz
68
	$pkgname.confd
69
	$pkgname.initd
70
	"
71 72 73
ldpath="/usr/lib/lxd"
sonameprefix="$pkgname:"

Carlo Landmeter's avatar
Carlo Landmeter committed
74
build() {
75
	export GOPATH="$builddir/_dist"
Sean's avatar
Sean committed
76 77
	export GOFLAGS="$GOFLAGS -buildmode=pie -trimpath"
	export CGO_LDFLAGS="-lintl $LDFLAGS"
78
	export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
Sean's avatar
Sean committed
79
	export GO111MODULE=on
80 81

	mkdir -p bin
82 83 84
	go build -v -tags "netgo" -ldflags '-extldflags "-static -lm -ldl -lz -lpthread -lz -lintl -lraft -ldqlite -luv -lseccomp -lcap"' -o bin/ ./lxd-p2c/...
	go build -v -tags "agent" -ldflags '-extldflags "-static -lm -ldl -lz -lpthread -lz -lintl -lraft -ldqlite -luv -lseccomp -lcap"' -o bin/ ./lxd-agent/...

85 86
	for tool in fuidshift lxc lxc-to-lxd lxd lxd-benchmark; do
		go build -v -tags "libsqlite3" -o bin/ ./$tool/...
Carlo Landmeter's avatar
Carlo Landmeter committed
87
	done
88 89 90
}

package() {
91
	for tool in lxc fuidshift lxc-to-lxd lxd lxd-benchmark lxd-p2c lxd-agent; do
92
		install -p -Dm755 "bin/$tool" "$pkgdir/usr/bin/$tool"
93
	done
94 95
	install -Dm755 bin/$pkgname "$pkgdir"/usr/sbin/$pkgname
	install -Dm755 bin/lxc "$pkgdir"/usr/bin/lxc
96

97
	patchelf --set-rpath "/usr/lib/lxd" "$pkgdir/usr/sbin/lxd"
98

Carlo Landmeter's avatar
Carlo Landmeter committed
99
	install -Dm755 "$srcdir"/lxd.initd \
100
		"$pkgdir"/etc/init.d/lxd
Carlo Landmeter's avatar
Carlo Landmeter committed
101
	install -Dm644 "$srcdir"/lxd.confd \
102
		"$pkgdir"/etc/conf.d/lxd
103

104
	mkdir -p "$pkgdir"/var/lib/lxd
Sean's avatar
Sean committed
105
	chmod 755 "$pkgdir"/var/lib/lxd
106 107 108 109 110 111 112
	chgrp $pkggroups "$pkgdir"/var/lib/lxd

	mkdir -p "$pkgdir/usr/share/doc/$pkgname"
		cat > "$pkgdir"/usr/share/doc/$pkgname/README.alpine <<EOF
-----------------------------------
Be sure to add your local user to the lxd group.
EOF
Carlo Landmeter's avatar
Carlo Landmeter committed
113 114
}

115 116 117
bashcomp() {
	depends="bash"
	pkgdesc="Bash completions for $pkgname"
118 119
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

120
	cd $builddir
121
	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions
122
	cp scripts/bash/lxd-client "$subpkgdir"/usr/share/bash-completion/completions/lxd-client
123 124 125 126
}

scripts() {
	pkgdesc="LXD scripts"
127
	depends="$pkgname py3-lxc jq"
128

129
	cd $builddir
130
	export GOPATH="$builddir/_dist"
131
	install -Dm755 scripts/empty-lxd.sh "$subpkgdir"/usr/bin/empty-lxd.sh
132 133
}

134
sha512sums="
Sean's avatar
Sean committed
135
b3bb2987e3351d55fba4c09d3c462e45025dee3482f51035889cf4d9354184646742e7afe3cd00ba34f2518e23f817b520040f4c94abeaf844753fac58a4f0ca  lxd-4.18.tar.gz
136 137
1bbb26a61b3812e6eb4c3cb7db6c2d9adb43195f96f317d6bba1ace6a97f1faed0677a12c3827002bc147edba9b355f0e7ead3960d254a131b25fb8c060ea8d0  lxd.confd
eb16aaa1121dda7687dd40d017e127478a72ddbc16658c31631265f0e4f05b2256e858dde40f4af08f8889651fa1898c8a65aa6826a9a9542cb4ae1f4bbf76ca  lxd.initd
138
"