aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lxd/APKBUILD
blob: be18ba976fc6f138c2db974364151daf48ae006a (plain)
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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=lxd
pkgver=3.1
pkgrel=0
pkgdesc="a container hypervisor and a new user experience for LXC"
url="https://linuxcontainers.org/lxd/"
arch="all"
license="Apache-2.0"
depends="acl xz netcat-openbsd cgmanager squashfs-tools rsync shadow-uidmap lxc ip6tables dnsmasq ca-certificates"
makedepends="lxc-dev protobuf-dev rsync go gettext-dev linux-headers acl-dev"
subpackages="$pkgname-scripts:scripts:noarch $pkgname-bash-completion:bashcomp:noarch $pkgname-openrc"
install="$pkgname.pre-install"
options="!check"
source="https://linuxcontainers.org/downloads/$pkgname/$pkgname-$pkgver.tar.gz
	lxd-dont-go-get.patch
	$pkgname.confd
	$pkgname.initd"
_project="github.com/lxc/lxd"

builddir="$srcdir"/lxd-$pkgver

prepare() {
	default_prepare
	cd "$builddir"
	# symlink links to a path outside of $GOPATH
	# copy src to project directory to replace the symlink
	rm -f dist/src/"$_project"
	rsync -a . --exclude="dist" dist/src/"$_project"
}

build() {
	cd "$builddir"
	export GOPATH="$builddir/dist"
	#https://github.com/lxc/lxd/issues/496
	export CGO_LDFLAGS=-lintl
	make -C dist/src/"$_project"
}

package() {
	cd "$builddir"
	for i in fuidshift lxc ; do
		install -Dm 755 "dist/bin/$i" \
			"$pkgdir/usr/bin/$i"
	done
	install -Dm755 "dist/bin/lxd" "$pkgdir/usr/sbin/lxd"
	install -Dm755 "$srcdir"/lxd.initd \
		"$pkgdir"/etc/init.d/lxd
	install -Dm644 "$srcdir"/lxd.confd \
		"$pkgdir"/etc/conf.d/lxd
}

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

	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions
	cp scripts/bash/lxd-client "$subpkgdir"/usr/share/bash-completion/completions/lxd-client
}

scripts() {
	pkgdesc="LXD scripts"
	depends="$pkgname python3 py3-lxc"

	cd "$builddir"
	install -Dm755 scripts/lxc-to-lxd \
		"$subpkgdir/usr/sbin/lxc-to-lxd"
}

sha512sums="61f64d08dd80f7f676f386912f4dfc0d0af38cce0287de7865123b9da667b54ab91d22b76ffe03480e04ae0fbd8dc837d7d519d0e34409377c3d7e6624bf636c  lxd-3.1.tar.gz
e2c0c96d0efc33e459cf14365f01d60b73ed03f028d36ca5ea27cd647f5d2a91ec61bcf2723437f7b930aec6ebabac3697e0e3adc6b2918817833c9f182aab49  lxd-dont-go-get.patch
bc32c71f2ce10f508433e1e4651c08c18e8a17e9419a7ce391c0f127fc7cf378c665178926b35eae8813e290d9c5eab3ceb605679fd32efdf2cf98a57cee4127  lxd.confd
94de0c0d5ab63463a929a4151359950b1117d0ada5ccf0944311cc70c6b6d4c437ccb4158734ab35db67bfb4abc437074c3f3515be4531f63adc74da21fefb5b  lxd.initd"