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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DPKG_GENSYMBOLS_CHECK_LEVEL=4

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Skip qml tests on the archs they are known to be flaky with current configuration
# Ref.: https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1585942
qmltestskip_architectures := arm64 powerpc s390x

%:
	dh $@

override_dh_auto_install:
	dh_auto_install
	rm debian/tmp/usr/bin/phone-gsettings-migration.py

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_configure:
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(qmltestskip_architectures)))
	dh_auto_configure -- -DCMAKE_BUILD_TYPE=Debug \
	                     -DSKIP_QML_TESTS="on"
else
	dh_auto_configure -- -DCMAKE_BUILD_TYPE=Debug
endif

#override_dh_auto_test:
#ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
#	QT_QPA_PLATFORM=minimal CTEST_OUTPUT_ON_FAILURE=1 dh_auto_test --no-parallel
#endif
#endif

# Disable unit tests for now, they hang for an indefinite amount of time at unit test 26
override_dh_auto_test:

override_dh_installsystemduser:
	dh_installsystemduser --package=lomiri-telephony-service --name=lomiri-telephony-service-indicator
	dh_installsystemduser --package=lomiri-telephony-service --name=lomiri-telephony-service-approver

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