# Forked from Alpine to apply mobile adaptivity patches

pkgname=mutter-mobile
pkgver=45_git20230908
pkgrel=1
pkgdesc="clutter-based window manager and compositor"
url="https://wiki.gnome.org/Projects/Mutter/"
# ricsv64: doesn't build currently:
# https://builds.sr.ht/~postmarketos/job/869829#task-pmbootstrap_build-1224
arch="all !riscv64"
license="GPL-2.0-or-later"
depends="
	gnome-settings-daemon
	gsettings-desktop-schemas
	mutter-mobile-schemas
	xkeyboard-config
	xwayland
	"
makedepends="
	at-spi2-core-dev
	cairo-dev
	dbus-dev
	elogind-dev
	eudev-dev
	fribidi-dev
	gdk-pixbuf-dev
	glib-dev
	gnome-desktop-dev
	gnome-settings-daemon-dev
	gobject-introspection-dev
	graphene-dev
	gtk+3.0-dev
	json-glib-dev
	lcms2-dev
	libcanberra-dev
	libdrm-dev
	libgudev-dev
	libice-dev
	libinput-dev
	libsm-dev
	libwacom-dev
	libx11-dev
	libxau-dev
	libxcb-dev
	libxcomposite-dev
	libxcursor-dev
	libxdamage-dev
	libxext-dev
	libxfixes-dev
	libxi-dev
	libxinerama-dev
	libxkbcommon-dev
	libxkbfile-dev
	libxrandr-dev
	libxrender-dev
	libxtst-dev
	libei-dev
	mesa-dev
	meson
	pango-dev
	pipewire-dev
	startup-notification-dev
	wayland-dev
	wayland-protocols
	xorg-server
	"
options="!check" # Can't be run with release builds
provides="mutter=$pkgver-r$pkgrel"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-lang $pkgname-schemas::noarch"
_commit="0f08f5aba4c9b5ac34b2d5711182d50b719d838e"
source="mobile-mutter-$_commit.tar.gz::https://gitlab.gnome.org/verdre/mobile-mutter/-/archive/$_commit/mobile-mutter-$_commit.tar.gz
	fixudev-req.patch
	pcversion.patch
	version.patch
	"
builddir="$srcdir/mobile-mutter-$_commit"

prepare() {
	default_prepare

	sed -i "s/libmutter_api_version = '.*'/libmutter_api_version = '99'/g" meson.build
}

build() {
	abuild-meson \
		-Degl_device=true \
		-Dudev=true \
		-Dnative_backend=true \
		-Dintrospection=true \
		-Dxwayland_path=/usr/bin/Xwayland \
		-Dremote_desktop=true \
		-Dprofiler=false \
		-Dtests=false \
		-Dinstalled_tests=false \
		. output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

schemas() {
	pkgdesc="Mutter schemas related files"
	provides="mutter-schemas=$pkgver-r$pkgrel"
	depends=""

	amove usr/share/glib-2.0/schemas
	amove usr/share/GConf/gsettings
	amove usr/share/gnome-control-center/keybindings
}

lang() {
	default_lang
	provides="mutter-lang=$pkgver-r$pkgrel"
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
715c3efbbf416a11ae0a723184d1e018d3679c876bc419f110da1200f9dad3b7719255ac81cca301cff55e16ba36578bc9906805599ff009faeebf9455f5bcb1  mobile-mutter-0f08f5aba4c9b5ac34b2d5711182d50b719d838e.tar.gz
6f21171bbd0ad0fc67cbaf5fb1478b22b482a9ae33b9328cc51a5dd31bcf7d95cd41e6cbbac21d3d8801cc064a62a64ae38ed7d0501ab605b861058c32f3bc30  fixudev-req.patch
b0f2fc36b6eeb7b49aed4a689c1a8d982d22f0b9d246c4c47ae950d5b06c5fe900ac5b0640a2d25ec97042a83138c51e87d878f74dc016774205cfc8bbf06f00  pcversion.patch
a9a82e945081480ae7ce59098aa3e46c87f5ea97481bd4c4933b3ef0a1757492ecb6e8453e8a2f74fb42edd51d39f76aaf9ef45ad8c52008acd6bbcbec219f83  version.patch
"
