#! /usr/bin/make -f

#include /usr/share/cli-common/cli.make

VERSION = $(shell dpkg-parsechangelog | grep ^Vers | cut -d\  -f2)
UPVERSION = $(shell echo $(VERSION) | sed 's,-.*,,' | sed 's,+dfsg.*,,') 

override_dh_auto_configure:
	dh_auto_configure -- \
		--disable-scrollkeeper \
		--with-gnome-screensaver=/usr \
		--with-gnome-screensaver-privlibexecdir=/usr/lib/gnome-screensaver/gnome-screensaver \
		--with-gnome-screensaver-themesdir=/usr/share/applications/screensavers \
		--with-vendor-build-id=$(shell dpkg-vendor --query vendor)

override_dh_auto_install:
	GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 dh_auto_install
	sed -i "/dependency_libs/ s/'.*'/''/" `find . -name 'libfspot.la'`

#override_dh_install:
#	rm -f $(CURDIR)/debian/f-spot/usr/lib/f-spot/*.a \
#	   $(CURDIR)/debian/f-spot/usr/lib/f-spot/*.la \
#	   $(CURDIR)/debian/f-spot/usr/lib/f-spot/*.so
#	dh_install
#	# This is a hack to get around xamarin bug#4030
#	mkdir -p bin
#	cp -f `pkg-config --variable assemblies_dir gtk-sharp-beans-2.0`/* $(CURDIR)/debian/f-spot/usr/lib/f-spot/
#	cp -f `pkg-config --variable assemblies_dir gio-sharp-2.0`/* $(CURDIR)/debian/f-spot/usr/lib/f-spot/
#	rm -f bin/*.mdb
#
#ifeq ($(shell dpkg-vendor --query vendor), Ubuntu)
#	cd po; intltool-update --pot
#
#	for d in $$(find debian/f-spot -type f \( -name "*.desktop" -o -name "*.directory" \) ); do \
#	    sed -ri '/^(Name|GenericName|Comment|X-GNOME-FullName)\[/d' $$d; \
#	    echo "X-Ubuntu-Gettext-Domain=f-spot" >> $$d; \
#	done 
#endif

# disable tests
override_dh_auto_test:

# libs aren't ours to ship
override_dh_makeclilibs:

# likewise
override_dh_makeshlibs:

get-orig-source:
	uscan \
		--force-download \
		--download-version $(UPVERSION) \
		--rename \
		--destdir .

override_dh_autoreconf:
	dh_autoreconf ./autogen.sh


%:
	dh $@ --verbose --with quilt,cli,autoreconf

.PHONY: get-orig-source
