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

export DPKG_GENSYMBOLS_CHECK_LEVEL=4

# We cannot use lto due to biometryds plugin system will fail
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto
include /usr/share/dpkg/default.mk

# The home directory of user buildd does not exist on the builders
export XDG_DATA_HOME=/tmp

%:
	dh $@ --with pkgkde_symbolshelper

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_configure:
	# DEB_TARGET_ARCH is to avoid running qml tests on powerpc
	dh_auto_configure -- -DDEB_TARGET_ARCH=$(DEB_TARGET_ARCH)	\
	                     -DENABLE_WERROR=OFF			\
	                     -DWITH_HYBRIS=OFF				\
	                     $(NULL)

override_dh_install:
	# drop upstart configuration
	rm -Rv debian/tmp/etc/init/

	# Nasty CMakeLists.txt appearing in include directory
	# See: https://gitlab.com/ubports/development/core/biometryd/-/issues/2
	rm -v  debian/tmp/usr/include/biometry/CMakeLists.txt
	dh_install

override_dh_auto_test:
	# we have seen test failures when building with 8 cores instead of 4
	dh_auto_test --no-parallel

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