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

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/buildflags.mk

export BUILDHOME=$(CURDIR)/debian/build

override_dh_auto_configure:
	dh_auto_configure -- \
		-DENABLE_LIBDEVICEINFO=ON \
		-DENABLE_TESTS=$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),OFF,ON) \
		-DENABLE_UBUNTU_ACCOUNTSSERIVCE=$(if $(shell dpkg-vendor --derives-from Ubuntu),OFF,ON) \
		-DLOMIRI_KEYBOARD_PLUGIN_PATH="/usr/lib/lomiri-keyboard/plugins" \
		-DMODERN_PYTHON_DBUSMOCK=ON \
		$(CONFIGURE_FLAGS)

execute_after_dh_auto_clean:
	rm -rf $(BUILDHOME)

override_dh_auto_test:
	mkdir -p $(BUILDHOME)
	export HOME=$(BUILDHOME) && dh_auto_test

override_dh_install:
#	cd tests/autopilot; \
#	set -ex; for python in $(shell py3versions -r); do \
#		$$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
#	done; \
#	cd $(CURDIR)
	dh_install -X'*.pyc'

override_dh_makeshlibs:
	dh_makeshlibs -Xusr/lib/$(DEB_HOST_MULTIARCH)/lomiri-system-settings

%:
	dh $@

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