# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
setvar pkgname = 'lightdm'
setvar pkgver = '1.10.1'
setvar pkgrel = '7'
setvar pkgdesc = ""A cross-desktop display manager""
setvar url = ""http://www.freedesktop.org/wiki/Software/LightDM""
setvar arch = ""all""
setvar license = ""GPL3""
setvar depends = ""dbus xinit accountsservice""
setvar depends_dev = ""glib-dev libxklavier-dev libx11-dev""
setvar makedepends = ""$depends_dev linux-pam-dev gtk+3.0-dev libxext-dev
	autoconf automake libtool gobject-introspection-dev itstool
	libgcrypt-dev libxml2-utils""
setvar install = ""$pkgname.pre-install""
setvar pkgusers = ""lightdm""
setvar pkggroups = ""lightdm""
setvar subpackages = ""$pkgname-dev $pkgname-doc $pkgname-lang""
setvar source = ""https://launchpad.net/lightdm/${pkgver%.*}/$pkgver/+download/lightdm-$pkgver.tar.xz
	musl-language.patch
	musl-is-linux.patch
	musl-updwtmpx.patch
	disallow-guest.patch
	lightdm.initd""

setvar _builddir = ""$srcdir"/lightdm-$pkgver"
proc prepare {
	local i
	cd $_builddir
	for i in $source {
		case (i) {
		*.patch { msg $i; patch -p1 -i "$srcdir"/$i || return 1}
		}
	}
}

proc build {
	cd $_builddir"
	CFLAGS="$CFLAGS -D_GNU_SOURCE"" ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--enable-liblightdm-gobject \
		--with-greeter-session=lightdm-gtk-greeter \
		|| return 1

	# workaround build bug
	touch tests/src/lightdm-session

	make || return 1
}

proc package {
	cd $_builddir
	make DESTDIR="$pkgdir" install || return 1
	mv "$pkgdir"/usr/lib/locale "$pkgdir"/usr/share/
	ln -s /etc/X11/xinit/Xsession "$pkgdir"/usr/bin/lightdm-session

	install -Dm755 "$srcdir"/lightdm.initd "$pkgdir"/etc/init.d/lightdm \
		|| return 1
	install -o lightdm -g lightdm -d "$pkgdir"/var/lib/lightdm-data \
		|| return 1
}

setvar md5sums = ""b237530f833bd3aafe613a85b76a5826  lightdm-1.10.1.tar.xz
9ec182924cb4c113c6ca70eb34e9192d  musl-language.patch
83463e0720df1c4462fd988d48ae4edc  musl-is-linux.patch
518dbd5723f352c19d59f3d645ee1636  musl-updwtmpx.patch
19a8a105b6d60c4c5c4e8138f57cb105  disallow-guest.patch
ad8dcfcc2473c7846e7590715e3947d7  lightdm.initd""
setvar sha256sums = ""737123001a7ae2ab126c75f61dcebb767d082ec043c012285eab6fa6b0d6a58f  lightdm-1.10.1.tar.xz
869834983f3dfd4818aac7b18b78e4c78a4e3bdf3740c7a21be2fa9b56e7664e  musl-language.patch
65e8d3ae8f40c5803b89e66b2cbeb9b0dbc7303c398770a9e28680312b1864f5  musl-is-linux.patch
38bfafdf569407f98261f998936ce23152fa9e4c53b797f6f775c697c7c25ebe  musl-updwtmpx.patch
97f658c6382133ce3456de59c70ebe1a850a1035cb871ff1e0885027559e56dd  disallow-guest.patch
b6494fa4393688119940aea71cb9b46ae84072e4f44dae5cdccdbd5c888ac418  lightdm.initd""
setvar sha512sums = ""e235eeb03999d31d693c89a0e06fc33371d40f7c3c216942440a8498990b1efa0b5f19c72bc0ed18611a3b401b8ee521e2c2caa5e441247bad625466a8346278  lightdm-1.10.1.tar.xz
04df1146c8e33410c0fbbd016a3197e7e11b8ac5792f4578cb1a3fccba432294e1f4597b3fcab85f5167cac3dea8ead416872cf8c97cf381db5d0d7e9772d1a7  musl-language.patch
480b2757321212aa04c265ee052f2226059dc45c99a2e19c9dd06198bf03237a34ccdd87d997eb0e1addcf8e1d429a43e0d61e9e0b871f7dc28d203ee7fc2006  musl-is-linux.patch
46ab123c1b0e9d89020dbb50f73418e41aa9fb5c7614eaf1add0aca3496f2f178e7f0e485abbd0de2ed15297ff00099e37ef7f7d245d280ec356d5d7b09af77d  musl-updwtmpx.patch
404a4cb4f58921e750aa29b3757c684ecb9d2b9146fd31b7359e49bf3a63400f757bb85d9f3ceabf0cbabc88bbbd18f11369713ccd7bae18574821c75af7143f  disallow-guest.patch
758c63b7b1382cb0adabd1a6af6af49333ce2950c95ae1199040647b7d49faf27e0e4572264b5533c7db8a4220e9ccc9aeb0d7e8221ef202184745694d9b7371  lightdm.initd""