#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

APPER_CONFIG_FLAGS = -DDEBCONF_SUPPORT=true \
		-DLISTALLER=ON \
		-DEDIT_ORIGNS_DESKTOP_NAME=software-properties-kde

INSTALLDIR = $(CURDIR)/debian/tmp

export KUBUNTU_DESKTOP_POT=playground-sysadmin

%:
	dh $@ --parallel --with kde --dbg-package=apper-dbg

override_dh_auto_configure:
	dh_auto_configure -Skde -- $(APPER_CONFIG_FLAGS)

override_dh_auto_install:
	dh_auto_install --destdir=$(INSTALLDIR)

	# Fix file conflict between GPK and Apper
	mv $(INSTALLDIR)/usr/share/dbus-1/services/org.freedesktop.PackageKit.service $(INSTALLDIR)/usr/share/dbus-1/services/kde-org.freedesktop.PackageKit.service
	# Stupid hack to work around cmake rpath bug
	chrpath --list $(INSTALLDIR)/usr/bin/apper
	chrpath --replace /usr/lib/apper $(INSTALLDIR)/usr/bin/apper

override_dh_install:
	dh_install --list-missing

fetch_translations:
	mkdir -p po
	cd po; svn export svn://anonsvn.kde.org/home/kde/trunk/l10n-kde4/subdirs
	cd po; for asdf in `cat subdirs`; do mkdir -p $${asdf}; done
	cd po; for asdf in `cat subdirs`; do echo $${asdf}; cd $${asdf}; svn export svn://anonsvn.kde.org/home/kde/trunk/l10n-kde4/$${asdf}/messages/playground-sysadmin/apper.po; cd ..; done
	cd po; rm subdirs; rmdir --ignore-fail-on-non-empty *
