# Reference: https://postmarketos.org/uipkg
maintainer="Bart Ribbers <bribbers@disroot.org>"
pkgname=postmarketos-ui-plasma-mobile
pkgver=6
pkgrel=6
pkgdesc="(Wayland) Mobile variant of KDE Plasma"
url="https://wiki.postmarketos.org/wiki/Plasma_Mobile"
# armhf blocked by pmaports#75
# x86 blocked by aports#11807
# riscv64 blocked by qt6-qtwebengine -> angelfish,koko
arch="noarch !armhf !x86 !riscv64"
license="GPL-3.0-or-later"
depends="
	callaudiod
	feedbackd
	plasma-mobile
	postmarketos-base-ui-plasma
	postmarketos-usb-moded
	udisks2
	"
_pmb_recommends="
	angelfish
	dolphin
	kclock
	koko
	krecorder
	kweather
	plasma-dialer
	plasma-mobile-sounds
	plasma-phonebook
	qmlkonsole
	spacebar
	ttyescape
	"
source="
	kscreenlockerrc
	org.kde.plasma.mobile.homescreen.folio.js
	system-generators-plasma-mobile-user-override
	"
subpackages="$pkgname-extras $pkgname-openrc $pkgname-systemd"
install="
	$pkgname-openrc.post-install
	$pkgname-openrc.post-upgrade
	$pkgname-systemd.post-install
	$pkgname-systemd.post-upgrade
	"
replaces="plasma-mobile plasma-mobile-meta"
options="!check pmb:drm pmb:systemd"

package() {
	install -Dm644 \
		"$srcdir"/kscreenlockerrc \
		-t "$pkgdir"/etc/xdg

	install -Dm644 "$srcdir"/org.kde.plasma.mobile.homescreen.folio.js \
		"$pkgdir"/usr/share/plasma/look-and-feel/org.kde.breeze.mobile/contents/plasmoidsetupscripts/org.kde.plasma.mobile.homescreen.folio.js
}

extras() {
	pkgdesc="Meta package for additional Plasma mobile apps"
	_pmb_recommends="
		alligator
		arianna
		audiotube
		elisa
		itinerary
		kalgebra
		kalk
		kasts
		kdeconnect
		keysmith
		neochat
		okular-mobile
		tokodon
		"

	mkdir -p "$subpkgdir"
}

openrc() {
	install_if="$pkgname=$pkgver-r$pkgrel openrc"
	depends="
		modemmanager-openrc
		openrc
		tinydm
		tinydm-openrc
	"

	mkdir -p "$subpkgdir"
}

systemd() {
	default_systemd

	install -Dm755 "$srcdir"/system-generators-plasma-mobile-user-override \
		-t "$subpkgdir"/usr/lib/systemd/system-generators
}

sha512sums="
b3aa8ee26c01de103c0c0af23532bf232f7071fdd02c53bd787d78e5974faa5662fc5776ce9be417392214ae73334b0eb0d073fe24f616a0ce99081f30b9158c  kscreenlockerrc
9396bb437c8a6e4b13eff1d16d1dee5804beafd126f4be55ab6deec7bcc42e2473c824b9a37717e347f99c33037d4de7accfb67943cb282fde38eb89ed6f2b89  org.kde.plasma.mobile.homescreen.folio.js
e726c2850024cd9f8c009b8748b3b58a78cfc7eaa1633ab03e7ba3df1a65cfa99d3dd54dfc99b6df2be6821da80a719e827e965d85052be22e3c5b4620feb37d  system-generators-plasma-mobile-user-override
"
