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

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
unexport LANG
unexport LANGUAGE
export LC_ALL := C.UTF-8

%:
	dh $@

override_dh_auto_configure:
	#if [ -e src/zxcvbn/ ]; then rm -r src/zxcvbn/ ; fi
	dh_auto_configure --  -DWITH_TESTS=ON \
	                      -DWITH_GUI_TESTS=ON \
	                      -DWITH_XC_ALL=ON

override_dh_auto_test:
	# fake directory structure for src/core/FilePath.cpp at build-time
	ln -snf $(CURDIR)/share/icons/ obj-$(DEB_HOST_MULTIARCH)/share/
	ln -snf . obj-$(DEB_HOST_MULTIARCH)/share/keepassxc
	ln -snf ../share/ obj-$(DEB_HOST_MULTIARCH)/src/
	dh_auto_test -- ARGS+="-E 'test(cli|gui)'"
	xvfb-run -a --server-args="-screen 0 800x600x24" dh_auto_test -- ARGS+="-R 'test(cli|gui)'" || true

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