#!/usr/bin/make -f 

LDFLAGS+=-Wl,--as-needed

%:
	dh $@ --with quilt,autoreconf,translations

override_dh_autoreconf:
	NOCONFIGURE=1 dh_autoreconf ./autogen.sh

# NOTE: Using GNOME for now, but we still need a proper configuration system
# See https://launchpad.net/bugs/799754
override_dh_auto_configure:
	dh_auto_configure -- --with-greeter-user=lightdm --with-user-session=ubuntu

override_dh_auto_test:
	# lightdm must be installed in prefix before tests will succeed, so we run
	# them as a dep8 test instead of during build

override_dh_install:
	#Remove .la and .a files.
	find debian/tmp/usr/lib/ -name *.a |xargs rm
	find debian/tmp/usr/lib -name *.la |xargs rm
	#Remove conf files from upstream
	#find debian/tmp/etc/ -name *.conf |xargs rm
	#find debian/tmp/etc/init -name *.conf |xargs rm
	dh_install --list-missing
	mv debian/lightdm/usr/lib/lightdm/lightdm/lightdm-set-defaults debian/lightdm/usr/lib/lightdm
	chmod +x debian/lightdm/usr/lib/lightdm/lightdm-greeter-session

override_dh_installinit:
	dh_installinit --no-start

override_dh_installpam:
	dh_installpam
	dh_installpam --name=lightdm-autologin
	dh_installpam --name=lightdm-greeter
	
override_dh_makeshlibs:
	dh_makeshlibs -pliblightdm-gobject-1-0 -V'liblightdm-gobject-1-0 (>= 0.9.2)' -- -c4
	dh_makeshlibs -Nliblightdm-gobject-1-0
