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

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

export DPKG_GENSYMBOLS_CHECK_LEVEL=4

ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	CONFIGURE_OPTS += -DENABLE_TESTS=OFF
endif

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

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure --builddirectory=build-qt6 --buildsystem=cmake .. -- \
	                  -DENABLE_QT6=ON                                      \
	                  $(CONFIGURE_OPTS)
	dh_auto_configure --builddirectory=build-qt5 --buildsystem=cmake .. -- \
	                  -DENABLE_QT6=OFF                                     \
	                  $(CONFIGURE_OPTS)

override_dh_auto_build:
	cp po/lomiri-ui-extras.pot po/lomiri-ui-extras.pot.bak
	dh_auto_build --builddirectory=build-qt6 --buildsystem=cmake ..
	dh_auto_build --builddirectory=build-qt5 --buildsystem=cmake ..

override_dh_auto_test:
	dh_auto_test --builddirectory=build-qt6 --buildsystem=cmake ..
	dh_auto_test --builddirectory=build-qt5 --buildsystem=cmake ..

override_dh_auto_install:
	dh_auto_install --builddirectory=build-qt6 --buildsystem=cmake ..
	dh_auto_install --builddirectory=build-qt5 --buildsystem=cmake ..

override_dh_auto_clean:
	dh_auto_clean --builddirectory=build-qt6 --buildsystem=cmake ..
	dh_auto_clean --builddirectory=build-qt5 --buildsystem=cmake ..

override_dh_clean:
	-mv po/lomiri-ui-extras.pot.bak po/lomiri-ui-extras.pot
	dh_clean

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