# Reference: https://postmarketos.org/uipkg
maintainer="Bart Ribbers <bribbers@disroot.org>"
pkgname=postmarketos-ui-asteroid
pkgver=2
pkgrel=1
pkgdesc="(Wayland) Smartwatch UI from AsteroidOS"
url="https://wiki.postmarketos.org/wiki/AsteroidOS"
# armhf blocked by asteroid-launcher
arch="noarch !armhf"
license="GPL-3.0-or-later"
depends="
	asteroid-launcher
	dsme
	"
# Required to launch
depends="$depends
	postmarketos-base-ui
	postmarketos-base-ui-audio
	tinydm
	"
_pmb_recommends="
	asteroid-alarmclock
	asteroid-btsyncd
	asteroid-calculator
	asteroid-calendar
	asteroid-compass
	asteroid-flashlight
	asteroid-hrm
	asteroid-music
	asteroid-settings
	asteroid-stopwatch
	asteroid-timer
	asteroid-weather
	"
_pmb_groups="users"
subpackages="$pkgname-openrc"
install="$pkgname.post-install $pkgname.post-upgrade"
source="
	asteroid.desktop
	asteroid-launcher-wrapper.sh
	gtk-app-wayland.sh
	"
options="!check pmb:drm pmb:systemd"

package() {
	install -Dm755 "$srcdir"/asteroid-launcher-wrapper.sh "$pkgdir"/usr/bin/asteroid-launcher-wrapper
	install -Dm644 "$srcdir"/asteroid.desktop -t "$pkgdir"/usr/share/wayland-sessions/
	install -Dm755 "$srcdir"/gtk-app-wayland.sh -t "$pkgdir"/etc/profile.d/
}

openrc() {
	install_if="$pkgname=$pkgver-r$pkgrel openrc"
	install="$subpkgname.post-install $subpkgname.post-upgrade"
	depends="
		bluez-openrc
		connman-openrc
		dsme-openrc
		elogind
		elogind-openrc
		mce-openrc
		tinydm-openrc
		usb-moded-openrc
		"

	mkdir -p "$subpkgdir"
}

sha512sums="
6dab13e0fb128cce487554871ce4786334b46e0f8f0ffbef0a222607e04f5b49660872ea59b322790e4e35f9b7a53040233823308ba280a8b21c86a412405ec0  asteroid.desktop
d6895807af865d89982c65cfda6616a55dfdaca3979ef045188489359462a87c0ffc51afc6779ba2aede614c13787a7499d6e7543c8a27e3210758b87b08f876  asteroid-launcher-wrapper.sh
57793bb079c76ba3bdcfca7880aa887de11fe80e7a05557b78435e57feabab70fbaeedc42da3aec6f914c35bba8e8ee9918367516eb45ee247f63f694624f179  gtk-app-wayland.sh
"
