# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: team/gnome <pabloyoyoista@postmarketos.org>
pkgname=gdm
pkgver=48.0
pkgrel=0
pkgdesc="GNOME display manager"
url="https://wiki.gnome.org/Projects/GDM"
# blocked by gnome-shell
arch="all !armhf"
license="GPL-2.0-or-later"
depends="
	dbus
	dconf
	gnome-session
	gnome-settings-daemon
	gnome-shell
	gsettings-desktop-schemas
	linux-pam>=1.4
	xrdb
	xwayland
	"
makedepends="
	accountsservice-dev
	elogind-dev
	eudev-dev
	gettext
	glib-dev
	gtk+3.0-dev
	itstool
	json-glib-dev
	libcanberra-dev
	libgudev-dev
	libsm-dev
	libx11-dev
	libxau-dev
	libxcb-dev
	libxdmcp-dev
	linux-pam-dev
	meson
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-openrc"
options="!check" # Causes circular dep with gnome-shell
source="
	https://download.gnome.org/sources/gdm/${pkgver%%.*}/gdm-$pkgver.tar.xz
	0001-DOWNSTREAM-use-bin-touch-instead-of-usr-bin-touch.patch
	0003-DOWNSTREAM-pam-rename-common-to-base.patch
	gdm.initd
	Xsession
	"
install="gdm.pre-install gdm.post-deinstall"

build() {
	abuild-meson \
		-Db_lto=true \
		-Ddbus-sys=/usr/share/dbus-1/system.d \
		-Dpam-prefix=/usr/lib \
		-Ddefault-pam-config=openembedded \
		-Dlibaudit=disabled \
		-Dlogind-provider=elogind \
		-Dselinux=disabled \
		-Dsystemd-journal=false \
		-Dsystemdsystemunitdir=no \
		-Dsystemduserunitdir=no \
		-Dxdmcp=disabled \
		. output
	meson compile -C output
}

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

	install -m755 -D "$srcdir/Xsession" "$pkgdir"/etc/gdm
	install -m755 -D "$srcdir/$pkgname.initd" "$pkgdir"/etc/init.d/gdm
}

sha512sums="
3e4a320cc6a0b43d65122bacd2b99531695f20ec809a767b957d63a511e00da017a9a4abe815596c6ad1398c5d427418d5c51bf6162216f60fdae5e8095bd305  gdm-48.0.tar.xz
aa302c33c9b31e823ab98ca80c330c3f7eaa10d05c402cf111d78a35fbec82ce90bff34c19b713b6e352428c31df91f04bd01b58cae8968e130a991c73382020  0001-DOWNSTREAM-use-bin-touch-instead-of-usr-bin-touch.patch
66611d49fc4c9578415a7e554834edcb9de99396bd0ca511dcfd4fb256e8a1cd1fd5f10464f4668ffe04799d919bc22ddb58e8bf272017edba69a7951522e63d  0003-DOWNSTREAM-pam-rename-common-to-base.patch
61d97e450ad0fb23fe6c5e9e1e816d0918a9bd34dbc1068ca9da1b1b5909c5de9e9c1d2fce920008fd82d567e6cb08641efc9671d128b7a7cbf8bfc5a15ee133  gdm.initd
f836cf0acdf148f2ae09ac28251b5126ce597f08254c43b1ec77596f75e1a3229926116c13f98554625be763e8d28415b27bd679b0a5de9f86bdca7857054c82  Xsession
"
