aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lxd/APKBUILD
blob: 5da06ab610a7f7732deb1a19e1602ff173cbe021 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=lxd
pkgver=3.14
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
	tar
	"
makedepends="
	lxc-dev
	gettext-dev
	acl-dev
	tcl-dev
	libuv-dev
	libcap-dev
	linux-headers

	rsync
	go
	intltool

	libtool
	autoconf
	automake
	"
subpackages="
	$pkgname-scripts:scripts
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-openrc
	$pkgname-libs
	"
install="$pkgname.pre-install"
options="!check"
source="https://linuxcontainers.org/downloads/$pkgname/$pkgname-$pkgver.tar.gz
	$pkgname.confd
	$pkgname.initd
	lxd-dont-go-get.patch
	"

# avoid conflict with system libsqlite3.so.0 by adding a soname prefix.
# this makes lxd-libs provide so:lxd:libsqlite3.so.0 and lxd depend on
# so:lxd:libsqlite3.so.0.
ldpath="/usr/lib/lxd"
sonameprefix="$pkgname:"

_project="github.com/lxc/lxd"


prepare() {
	default_prepare
	update_config_guess
	cd "$builddir"/dist/dqlite
	autoreconf -i
}

build() {
	export GOPATH="$builddir/dist"
	export CGO_LDFLAGS="$CGO_LDFLAGS -lintl"
	cd "$GOPATH"/sqlite
	./configure \
		--prefix=/usr \
		--enable-replication \
		--disable-amalgamation \
		--disable-tcl \
		--libdir=/usr/lib/lxd

	cd "$GOPATH"/dqlite
	PKG_CONFIG_PATH="${GOPATH}/sqlite/" ./configure \
		--prefix=/usr \
		--libdir=/usr/lib/lxd

	cd "$GOPATH"/sqlite
	make

	cd "$GOPATH"/dqlite
	make CFLAGS="-I${GOPATH}/sqlite" LDFLAGS="-L${GOPATH}/sqlite"

	cd "$builddir"
	go install -v -x $_project/lxc
	export CGO_CFLAGS="-I${GOPATH}/sqlite/ -I${GOPATH}/dqlite/include/"
	export CGO_LDFLAGS="$CGO_LDFLAGS -L${GOPATH}/sqlite/.libs/ -L${GOPATH}/dqlite/.libs/ -Wl,-rpath,/usr/lib/lxd"
	export LD_LIBRARY_PATH="${GOPATH}/sqlite/.libs/:${GOPATH}/dqlite/.libs/"
	go install -v -x -tags libsqlite3 $_project/lxd
	for tool in fuidshift lxc-to-lxd lxd-benchmark lxd-p2c; do
		go install -v -x $_project/$tool
	done
}

package() {
	export GOPATH="$builddir/dist"
	export CGO_LDFLAGS="$CGO_LDFLAGS -lintl"
	cd "$GOPATH"/sqlite
	make DESTDIR="$pkgdir" install

	cd "$GOPATH"/dqlite
	make DESTDIR="$pkgdir" install

	rm $pkgdir/usr/bin/sqlite3
	rm -r $pkgdir/usr/include

	cd $GOPATH
	install -Dm755 bin/$pkgname "$pkgdir"/usr/sbin/$pkgname
	install -Dm755 bin/lxc "$pkgdir"/usr/bin/lxc

	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"

	export GOPATH="$builddir/dist"
	cd $GOPATH

	for tool in fuidshift lxc-to-lxd lxd-benchmark lxd-p2c; do
		install -Dm755 bin/$tool "$subpkgdir"/usr/bin/$tool
	done
}

libs() {
	pkgdesc="LXD bundled libraries"
	depends=
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
	rm -rf "$subpkgdir"/usr/lib/lxd/pkgconfig \
		"$subpkgdir"/usr/lib/lxd/*.a
}

sha512sums="3d2d4e61298fc9fde49defad776a398fcccf7639485e810173c9c7f7d939c354a9ad8112a4a631b0850f6eb54435012d289236ff61839416caf95434eb23c8ff  lxd-3.14.tar.gz
bc32c71f2ce10f508433e1e4651c08c18e8a17e9419a7ce391c0f127fc7cf378c665178926b35eae8813e290d9c5eab3ceb605679fd32efdf2cf98a57cee4127  lxd.confd
94de0c0d5ab63463a929a4151359950b1117d0ada5ccf0944311cc70c6b6d4c437ccb4158734ab35db67bfb4abc437074c3f3515be4531f63adc74da21fefb5b  lxd.initd
a77a74950110c94727956457843cd3f64c0db901fb05b95ab0edaa966f7fe76a993d86c8a51d14724a11846a69261199594f683dfefa1db633f4ca35c7f23607  lxd-dont-go-get.patch"