#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

TESTS_HOME=$(CURDIR)/debian/tests.home

override_dh_auto_configure:
	dh_auto_configure -Skf5 -- -DBUILD_TESTING=OFF

override_dh_auto_install:
	dh_auto_install
	# TODO: talk to usptream about getting these not installed. they are not used.
	rm -rf debian/kdepim-runtime/usr/share/dbus-1/interfaces/
	# TODO: upstream SKIP_NAMELINK so we get no symlinks for private libs
	# make sure to skip the symlinks for sasl2 plugins
	find debian/kdepim-runtime \( -name '*.so' -type l \! -path '*/usr/lib/*/sasl2/*' \) -delete
	# At the end, remove empty directories
	find debian/kdepim-runtime -type d -empty -delete
override_dh_auto_test:
	# Disable dh_auto_test at build time (they are utterly broken)
	:
#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
#	mkdir -p "$(TESTS_HOME)"
#	HOME=$(TESTS_HOME) xvfb-run -a --server-args="-screen 0 1024x768x24" dbus-run-session debian/testsuite.xsession
#	rm -rf "$(TESTS_HOME)"
#endif
