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

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

export DPKG_GENSYMBOLS_CHECK_LEVEL=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

include /usr/share/dpkg/architecture.mk

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

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
export DEB_BUILD_PROFILES := nocheck
endif

include /usr/share/dpkg/architecture.mk

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_BUILD_TYPE=Debug

override_dh_auto_install:
	dh_auto_install

	# remove autopilot files
	rm -rf debian/lomiri-dialer-app/usr/lib/python3/
	rmdir debian/lomiri-dialer-app/usr/lib/

override_dh_auto_test:
ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(testskip_architectures)))
	dh_auto_test
else
	-dh_auto_test
endif

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