# Contributor: Carlo Landmeter # Maintainer: Francesco Colista pkgname=lxd pkgver=3.8 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 tcl-dev libtool autoconf automake sqlite-dev libuv-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 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" make deps #https://github.com/lxc/lxd/issues/496 export CGO_CFLAGS="-I${GOPATH}/deps/sqlite/ -I${GOPATH}/deps/dqlite/include/" export CGO_LDFLAGS="-lintl -L${GOPATH}/deps/sqlite/.libs/ -L${GOPATH}/deps/dqlite/.libs/" export LD_LIBRARY_PATH="${GOPATH}/deps/sqlite/.libs/:${GOPATH}/deps/dqlite/.libs/" 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 dist/bin/lxc-to-lxd \ "$subpkgdir/usr/sbin/lxc-to-lxd" } sha512sums="20085f05c59287fc8f350d8ef314c19fd7361f8394812e4a0466f76d9df6957348fc954d952f70e50e7227d593a9db9af994e15f69fd76e6ca4812174bfa907c lxd-3.8.tar.gz bc32c71f2ce10f508433e1e4651c08c18e8a17e9419a7ce391c0f127fc7cf378c665178926b35eae8813e290d9c5eab3ceb605679fd32efdf2cf98a57cee4127 lxd.confd 94de0c0d5ab63463a929a4151359950b1117d0ada5ccf0944311cc70c6b6d4c437ccb4158734ab35db67bfb4abc437074c3f3515be4531f63adc74da21fefb5b lxd.initd a77a74950110c94727956457843cd3f64c0db901fb05b95ab0edaa966f7fe76a993d86c8a51d14724a11846a69261199594f683dfefa1db633f4ca35c7f23607 lxd-dont-go-get.patch"