# Template file for 'gdm'
pkgname=gdm
version=3.12.2
revision=4
build_style=gnu-configure
configure_args="--disable-schemas-compile --disable-static
 --with-at-spi-registryd-directory=/usr/libexec --without-tcp-wrappers
 --with-screenshot-dir=/var/lib/gdm/greeter
 --with-xauth-dir=/run/gdm --with-pid-file=/run/gdm/gdm.pid
 --with-systemdsystemunitdir=/usr/lib/systemd/system"
hostmakedepends="pkg-config itstool intltool which gnome-doc-utils"
makedepends="
 pam-devel nss-devel accountsservice-devel gtk+3-devel>=3.10 upower-devel
 libSM-devel libcanberra-devel xrdb dconf>=0.20 hicolor-icon-theme
 xorg-server gnome-session>=3.12 gnome-settings-daemon>=3.12"
conf_files="
	/etc/gdm/custom.conf
	/etc/pam.d/gdm
	/etc/pam.d/gdm-autologin
	/etc/pam.d/gdm-fingerprint
	/etc/pam.d/gdm-password
	/etc/pam.d/gdm-smartcard
	/etc/pam.d/gdm-welcome"
# Create the 'gdm' system user/group.
system_accounts="gdm"
gdm_homedir="/var/lib/gdm"
systemd_services="gdm.service off"
depends="xrdb xorg-server hicolor-icon-theme
	dconf>=0.20 gnome-session>=3.12 gnome-settings-daemon>=3.12"
short_desc="GNOME Display Manager"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.gnome.org"
license="GPL-2"
distfiles="${GNOME_SITE}/$pkgname/${version%.*}/$pkgname-$version.tar.xz"
checksum=cc91fff5afd2a7c3e712c960a0b60744774167dcfc16f486372e1eb3c0aa1cc4

# Package build options
build_options="gir systemd"
# Disable gir for cross builds.
if [ -z "$CROSS_BUILD" ]; then
	build_options_default+=" gir"
fi

if [ "$build_option_gir" ]; then
	configure_args+=" --enable-introspection"
	makedepends+=" gobject-introspection"
else
	configure_args+=" --disable-introspection"
fi

if [ "$build_option_systemd" ]; then
	configure_args+=" --with-systemd --enable-systemd-journal --with-initial-vt=1"
	makedepends+=" systemd-devel"
else
	configure_args+=" --without-systemd --disable-systemd-journal --with-initial-vt=7"
fi

post_install() {
	# Use our own pam files.
	rm -f ${DESTDIR}/etc/pam.d/*
	for f in ${FILESDIR}/*.pam; do
		vinstall ${f} 644 etc/pam.d ${f%.pam}
	done
	vinstall ${FILESDIR}/gdm.tmpfiles.d 644 usr/lib/tmpfiles.d gdm.conf

	chmod 1770 ${DESTDIR}/var/log/gdm
}

libgdm_package() {
	short_desc+=" - runtime libraries"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

gdm-devel_package() {
	depends="libgdm>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		if [ "$build_option_gir" ]; then
			vmove usr/share/gir-1.0
		fi
		vmove "usr/lib/*.so"
	}
}
