# Forked from Alpine to add systemd!
# Co-Maintainer: Pablo Correa Gomez <pabloyoyoista@postmarketos.org>
# Co-Maintainer: Achill Gilgenast <achill@achill.org>
maintainer="Stefan Hansson <newbyte@postmarketos.org>"
pkgname=mutter
_pkgver=50.2
pkgver=9999$_pkgver
pkgrel=1
pkgdesc="clutter-based window manager and compositor"
url="https://gitlab.gnome.org/GNOME/mutter"
# armhf: pmb#2618
arch="all !armhf"
license="GPL-2.0-or-later"
depends="
	gnome-settings-daemon
	gsettings-desktop-schemas
	mutter-schemas
	xkeyboard-config
	"
makedepends="
	at-spi2-core-dev
	cairo-dev
	dbus-dev
	fribidi-dev
	gdk-pixbuf-dev
	glib-dev
	gnome-desktop-dev
	gnome-settings-daemon-dev
	gobject-introspection-dev
	graphene-dev
	gtk4.0-dev
	json-glib-dev
	lcms2-dev
	libadwaita-dev
	libcanberra-dev
	libdisplay-info-dev
	libdrm-dev
	libei-dev
	libglycin-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
	mesa-dev
	meson
	pango-dev
	pipewire-dev
	py3-argcomplete
	py3-docutils
	startup-notification-dev
	wayland-dev
	wayland-protocols
	xkeyboard-config-dev
	xwayland-dev

	systemd-dev
	"
# TODO: crossdirect disabled due to armv7 crosscompile failure on x86_64, see
# https://gitlab.com/postmarketOS/pmaports/-/merge_requests/5115#note_1899890119
options="!check !pmb:crossdirect" # Can't be run with release builds
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-lang $pkgname-schemas::noarch $pkgname-udev"
source="https://download.gnome.org/sources/mutter/${_pkgver%%.*}/mutter-$_pkgver.tar.xz
	fixudev-req.patch
	pcversion.patch
	"
builddir="$srcdir/$pkgname-$_pkgver"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dudev=true \
		-Dnative_backend=true \
		-Dintrospection=true \
		-Dremote_desktop=true \
		-Dprofiler=false \
		-Ddevkit=enabled \
		-Dtests="$(want_check && echo enabled || echo disabled)" \
		. output
	meson compile -C output
}

schemas() {
	pkgdesc="Mutter schemas related files"
	depends=""

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

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

sha512sums="
813dff95e762cce19ad8e3ad9d564b4373a89e8a10bf37566b0aefa40a61caf1dda169ba8604e56b037d4daf3a8ca961fd7559348d8b85add1f98c62aee47ea2  mutter-50.2.tar.xz
60eb075a88ca301470130d17371c1410220be0c7d5a929f6b528ec838a1133ebccf46d29f448060043e94c2edf4615ae431927911bede1972ac37f04ff9f29b4  fixudev-req.patch
52ae70a818ab1bbeeeb1259405c964baf48cd793385fae9200b57b7160cb8094041b2c2336fc57349e562aa142d631c5668a2d0a4dc32f6a6854c0ea2bb0d2c0  pcversion.patch
"
