# Template file for 'PopCorn'
pkgname=PopCorn
version=0.4
revision=11
build_style=go
go_import_path=github.com/the-maldridge/popcorn
go_package="${go_import_path}/cmd/popcorn
 ${go_import_path}/cmd/popcornctl
 ${go_import_path}/cmd/statrepo
 ${go_import_path}/cmd/pqueryd"
hostmakedepends="git"
depends="snooze"
short_desc="Package statistics system"
maintainer="Michael Aldridge <maldridge@voidlinux.org>"
license="MIT"
homepage="https://github.com/the-maldridge/PopCorn"
distfiles="https://github.com/the-maldridge/PopCorn/archive/v${version}.tar.gz"
checksum=b25589802c5e1c277d2e9536add44704a012359b02d7fb4be1b4b0f11eb10d93

system_accounts="_popcorn"
_popcorn_homedir="/var/lib/popcorn"
make_dirs="
 /var/lib/popcorn 0755 _popcorn _popcorn
 /etc/popcorn 0755 _popcorn _popcorn"

post_install() {
	vlicense LICENSE
	vsv popcorn
	vsv statrepo
	vsv pqueryd
}

PopCorn-Server_package() {
	short_desc+=" - Server"
	depends="${sourcepkg}>=${version}_${revision}"
	make_dirs="/srv/www/popcorn 0755 _popcorn _popcorn"
	pkg_install() {
		vmove usr/bin/statrepo
		vmove usr/bin/popcornctl
		vmove usr/bin/pqueryd

		vmove etc/sv/statrepo
		vmove etc/sv/pqueryd
	}
}
