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

NULL =

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	# disable plugins because the only plugin defaultinvitationplugin has
	# a non-free license
	dh_auto_configure --builddirectory=build-qt6 -- \
		-DENABLE_QT6=ON \
		-DBUILD_PLUGINS=OFF \
		-DBUILD_DOCUMENTATION=$(if $(filter %-doc,$(shell dh_listpackages)),ON,OFF) \
	$(NULL)
	dh_auto_configure --builddirectory=build-qt5 -- \
		-DENABLE_QT6=OFF \
		-DBUILD_PLUGINS=OFF \
		-DBUILD_DOCUMENTATION=$(if $(filter %-doc,$(shell dh_listpackages)),ON,OFF) \
	$(NULL)

override_dh_auto_build:
	dh_auto_build --builddirectory=build-qt6
	dh_auto_build --builddirectory=build-qt5

override_dh_auto_test:
	mkdir $(CURDIR)/debian/test
	MKCAL_STORAGEDB=$(CURDIR)/debian/test/testdb-qt6 xvfb-run -a dh_auto_test --builddirectory=build-qt6 --no-parallel
	MKCAL_STORAGEDB=$(CURDIR)/debian/test/testdb-qt5 xvfb-run -a dh_auto_test --builddirectory=build-qt5 --no-parallel

override_dh_auto_install:
	dh_auto_install --builddirectory=build-qt6
	dh_auto_install --builddirectory=build-qt5

execute_before_dh_clean:
	-rm -rf $(CURDIR)/debian/test

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