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

GITREV=$(shell dpkg-parsechangelog -S Version | sed -n 's/.*+git.*\.\(.*\)/\1/p')
include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
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 \
	                      -DGIT_HEAD_OVERRIDE=${GITREV} \
	                      -DKEEPASSXC_BUILD_TYPE="PreRelease" \
	                      -DWITH_GUI_TESTS=OFF \
	                      -DWITH_XC_KEESHARE_SECURE=ON \
	                      -DWITH_XC_UPDATECHECK=OFF \
	                      -DWITH_XC_ALL=ON

#override_dh_auto_test:
#	dh_auto_test -- ARGS+="-E 'test(cli|gui)'"
#	# testcli and testgui use X, and have horrible X clipboard tests that
#	# randomly fail, so ignore failures
#	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
