# Contributor: Carlo Landmeter # Maintainer: Francesco Colista pkgname=lxd pkgver=3.8 pkgrel=3 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 tcl-dev libtool autoconf automake libuv-dev intltool libcap-dev" subpackages="$pkgname-scripts:scripts $pkgname-bash-completion:bashcomp:noarch $pkgname-openrc" 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" _project="github.com/lxc/lxd" builddir="$srcdir"/lxd-$pkgver 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 } sha512sums="20085f05c59287fc8f350d8ef314c19fd7361f8394812e4a0466f76d9df6957348fc954d952f70e50e7227d593a9db9af994e15f69fd76e6ca4812174bfa907c lxd-3.8.tar.gz bc32c71f2ce10f508433e1e4651c08c18e8a17e9419a7ce391c0f127fc7cf378c665178926b35eae8813e290d9c5eab3ceb605679fd32efdf2cf98a57cee4127 lxd.confd 94de0c0d5ab63463a929a4151359950b1117d0ada5ccf0944311cc70c6b6d4c437ccb4158734ab35db67bfb4abc437074c3f3515be4531f63adc74da21fefb5b lxd.initd a77a74950110c94727956457843cd3f64c0db901fb05b95ab0edaa966f7fe76a993d86c8a51d14724a11846a69261199594f683dfefa1db633f4ca35c7f23607 lxd-dont-go-get.patch"