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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/architecture.mk

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DWITH_GUI_TESTS=ON

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	dh_auto_test -- ARGS+="-E testgui"
	xvfb-run -a --server-args="-screen 0 800x600x24" dh_auto_test -- ARGS+="-R testgui"
endif

override_dh_makeshlibs:
	# keepassx only ships plugins
	dh_makeshlibs -X/usr/lib/$(DEB_HOST_MULTIARCH)/keepassx

override_dh_auto_install:
	dh_auto_install
	# remove empty folders
	find debian/keepassx/usr/share/icons/hicolor/16x16/actions -type d -empty -delete
	find debian/keepassx/usr/share/icons/hicolor/22x22/actions -type d -empty -delete
	find debian/keepassx/usr/share/icons/hicolor/22x22/status -type d -empty -delete
