# Maintainer: Thomas Liske <thomas@fiasko-nw.net>
pkgname=barkery
pkgver=0.6.1
pkgrel=0
pkgdesc="WebKit2-based kiosk browser for digital signage"
url="https://github.com/liske/barkery"
arch="noarch"
license="GPL-3.0-or-later"
depends="barkery-browser barkery-weston"
makedepends="py3-setuptools"
subpackages="$pkgname-browser $pkgname-weston $pkgname-weston-openrc"
pkgusers="barkery"
pkggroups="barkery"
options="!check" # no tests available
source="$pkgname-$pkgver.tar.gz::https://github.com/liske/barkery/archive/refs/tags/$pkgver.tar.gz
	barkery-browser.pre-install
	barkery-weston.initd
	barkery-weston.pre-install
	"

package() {
	install -Dm640 -oroot -gbarkery "$srcdir"/$pkgname-$pkgver/ex/barkery.conf "$pkgdir"/etc/barkery/barkery.conf
	install -Dm640 -oroot -gbarkery "$srcdir"/$pkgname-$pkgver/ex/weston.ini "$pkgdir"/etc/barkery/weston.ini
	install -Dm755 "$srcdir"/barkery-weston.initd "$pkgdir"/etc/init.d/barkery

	install -Dm755 "$srcdir"/$pkgname-$pkgver/src/barkery "$pkgdir"/usr/bin/barkery
}

browser() {
	pkgdesc="$pkgdesc (browser)"
	depends="python3
		py3-gobject3
		py3-paho-mqtt
		py3-setproctitle
		webkit2gtk"
	install="$subpkgname.pre-install"

	amove etc/barkery/barkery.conf
	amove usr/bin/barkery
}

weston() {
	pkgdesc="$pkgdesc (Weston DRM session)"
	depends="barkery-browser=$pkgver-r$pkgrel
		eudev
		font-noto
		mesa-dri-gallium
		seatd
		weston-backend-drm
		weston-shell-desktop"
	install="$subpkgname.pre-install"

	amove etc/barkery/weston.ini
}

sha512sums="
a1eb6827aa52311bdb76a11feff5ce88437bb50e2d4bd54721a30101851d89d13498aab95e847a82cdee54e714b19bb2910c56b6fb4b826005963f80ea0e69d0  barkery-0.6.1.tar.gz
065dd4d563b86aa52c3c26b33d67169db264a8d16563985f5b190599626964a68ec913ef323d483e608c09d6ffa650690439d3d06527e3049a5b58f16660a6dc  barkery-browser.pre-install
f7b7e71115e61c0250ff435424385219af798b5f917525da686bba782fa077833d04eb36128113de102525061715c60db77aa50818d377af97d25e1d46941281  barkery-weston.initd
c023f0d4e7ec373700afd2ae80ebb3e51428f88bfcad6c8dde4145edeecf1a0f7bc795ebf3736ec2b3f14b46b02bd1024af6bce4010ebd47543f8844d6ffd4c9  barkery-weston.pre-install
"
