# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=phosh
pkgver=0.1.3
pkgrel=0
_gvc_commit="ae1a34aafce7026b8c0f65a43c9192d756fe1057"
pkgdesc="A shell PoC for the Librem5"
arch="all !armhf"
url="https://source.puri.sm/Librem5/phosh"
license="GPL-3.0-only"
depends="gtk+3.0 wayland-protocols phoc gnome-session bash dbus-x11 gnome-settings-daemon squeekboard libpulse"
makedepends="gtk+3.0-dev meson ninja gnome-desktop-dev libhandy-dev gcr-dev upower-dev linux-pam-dev git cmake pulseaudio-dev networkmanager-dev polkit-elogind-dev libsecret-dev"
subpackages="$pkgname-lang"
source="
	$pkgname-$pkgver.tar.gz::https://source.puri.sm/Librem5/phosh/-/archive/v$pkgver/phosh-v$pkgver.tar.gz
	libgvc-$_gvc_commit.tar.gz::https://gitlab.gnome.org/GNOME/libgnome-volume-control/-/archive/$_gvc_commit/libgnome-volume-control-$_gvc_commit.tar.gz
	stop-hardcoding-resolution.patch
	phosh.desktop
	sm.puri.OSK0.desktop"
options="!check" # Needs a running Wayland compositor
builddir="$srcdir/$pkgname-v$pkgver"

prepare() {
	default_prepare

	cd "$srcdir"
	mv libgnome-volume-control*/* "$builddir"/subprojects/gvc/
}

build() {
	meson . _build --prefix=/usr
	ninja -C _build
}

check() {
	ninja -C _build test
}

package() {
	DESTDIR="$pkgdir/" ninja -C _build install

	install -D -m644 "$srcdir"/phosh.desktop \
		"$pkgdir"/usr/share/wayland-sessions/phosh.desktop

	install -D -m644 "$srcdir"/sm.puri.OSK0.desktop \
		"$pkgdir"/usr/share/applications/sm.puri.OSK0.desktop

}
sha512sums="df0f73f5287dba4f65678e48226c112f3fc076bb50b912e1f7add8dc05cc7cd2c0b1ec591ceeb8f1c5452dbedce574d3cbc3a029966b592c1aa2ffcfc74579cf  phosh-0.1.3.tar.gz
723334bff55927363dab47ef22c71dcaf94263fe76e49c40f1cbfbd5f86383e68fd4bf2182eb5777dda8e2ede4ee4710e1a7ab1379d3ca40d68f68ff30c62e21  libgvc-ae1a34aafce7026b8c0f65a43c9192d756fe1057.tar.gz
93c05f86a314bbd466b083cd9dfe0ba40803020d4865d666f2f67356be41f1769116f34eaade66d19a0f0cec2d79941986fef24a9a2fa19481c769019aef9ba3  stop-hardcoding-resolution.patch
6644870edbbbc6b88d6e19f7771d81dba1a11066c2b34e4c22736db73a2dfd0d4909b4967503059c35385c5139a834a5c06a3c56b148ba1275d7f089c0c5f33c  phosh.desktop
f97019598323276cf97ae62f04b6245983198e04b228ddc605835ee46845d9b88c6890fb86e97e4bb6f1ad73361437d9ed18c91e81fe1284a88cdcb92d3fdc69  sm.puri.OSK0.desktop"
