#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

override_dh_install:
	find debian/tmp -name *.la -delete
	find debian/tmp -name *.a -delete
	# this needs to be handled upstream, really...
	mkdir -p debian/tmp/usr/share/metainfo/
	mv debian/tmp/usr/share/appdata/* debian/tmp/usr/share/metainfo/
	rmdir debian/tmp/usr/share/appdata/
	mkdir -p debian/tmp/etc/xdg/autostart
	mkdir -p debian/tmp/etc/skel/.config/autostart
	echo "[Desktop Entry]\nEncoding=UTF-8\nType=Application\nName=plank\nName[zh_CN]=plank\nName[en_US]=plank\nComment=plank\nComment[zh_CN]=plank\nComment[en_US]=plank\nExec=/usr/bin/plank\nOnlyShowIn=MATE;\nStartupNotify=false\nTerminal=false\nHidden=false\nX-MATE-Autostart-enabled=true\n" >> debian/tmp/etc/xdg/autostart/plank.desktop
	cat debian/tmp/etc/xdg/autostart/plank.desktop > debian/tmp/etc/skel/.config/autostart/plank.desktop

	dh_install

override_dh_missing:
	dh_missing --fail-missing

override_dh_strip:
	dh_strip -p libplank1 --dbgsym-migration='libplank1-dbg (<< 0.11.2-2~)'
	dh_strip -p plank --dbgsym-migration='plank-dbg (<< 0.11.2-2~)'

override_dh_builddeb:
	dh_builddeb -- -Zxz

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-headless-tests

override_dh_auto_test:
	dh_auto_test || true

override_dh_makeshlibs:
	dh_makeshlibs -p libplank1 -V 'libplank1 (>= 0.11.2)'

%:
	dh $@

get-orig-source:
	uscan --noconf --force-download --rename --download-current-version --destdir=..
