# Template file for 'lxd-lts'
pkgname=lxd-lts
version=4.0.4
revision=1
wrksrc="lxd-$version"
build_style=go
go_import_path="github.com/lxc/lxd"
go_build_tags="libsqlite3"
go_package="${go_import_path}/lxd ${go_import_path}/lxc
 ${go_import_path}/lxd-p2c ${go_import_path}/fuidshift"
hostmakedepends="pkg-config"
makedepends="lxc-devel acl-devel dqlite-devel eudev-libudev-devel"
depends="lxc acl acl-progs rsync squashfs-tools xz dnsmasq iptables"
short_desc="Next generation system container manager (long term support channel)"
maintainer="Cameron Nemo <cnemo@tutanota.com>"
license="Apache-2.0"
homepage="https://linuxcontainers.org/lxd"
distfiles="https://linuxcontainers.org/downloads/lxd/${wrksrc}.tar.gz"
checksum=372a666b84c7cbcb7ccbffbf4aa04a05b2fe22e5e0aafa022b700bbf211557f6
conflicts="lxd"
provides="lxd-${version}_${revision}"
system_groups="lxd"

do_configure() {
	# the LXD tarball packages up the required dependencies
	ln -s "$wrksrc/_dist" "$GOPATH"
}

do_build() {
	# don't go-get the dependencies, just install with what's there
	cd "$GOSRCPATH"
	go_package=${go_package:-$go_import_path}
	go install -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
}

post_install() {
	vinstall scripts/bash/lxd-client 644 /usr/share/bash-completion/completions lxd
	vsv lxd
}
