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

NULL =

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

export DPKG_GENSYMBOLS_CHECK_LEVEL=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# http://ccache.samba.org/manual.html#_precompiled_headers
export CCACHE_SLOPPINESS=time_macros

%:
	dh $@

override_dh_auto_configure:
#	dh_auto_configure --builddirectory=build-qt6 -- \
#	                     -DCMAKE_INSTALL_SYSCONFDIR=/etc \
#	                     -DCMAKE_INSTALL_DOCDIR=share/doc/liblomiri-thumbnailer-qt-dev \
#	                     -DENABLE_QT6=ON \
#	                     -DENABLE_UBUNTU_COMPAT=OFF \
#	                     -DENABLE_DOC=OFF \
#	                     -DCHECK_WHITESPACE_IGNORE=$(CURDIR)/build-qt6\;$(CURDIR)/build-qt5 \
#	                     -DCHECK_COPYRIGHT_IGNORE=$(CURDIR)/build \
#	                     $(NULL)
	dh_auto_configure --builddirectory=build-qt5 -- \
	                     -DCMAKE_INSTALL_SYSCONFDIR=/etc \
	                     -DCMAKE_INSTALL_DOCDIR=share/doc/liblomiri-thumbnailer-qt-dev \
	                     -DENABLE_QT6=OFF \
	                     -DENABLE_UBUNTU_COMPAT=OFF \
	                     -DCHECK_WHITESPACE_IGNORE=$(CURDIR)/build-qt6\;$(CURDIR)/build-qt5 \
	                     -DCHECK_COPYRIGHT_IGNORE=$(CURDIR)/build \
	                     $(NULL)

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

# Tests are not written to be run in parallel.
# We ignore failing tests on PPC because the thumbnailer is irrelevant there,
# and gstreamer has bugs in the plugins for PPC.
override_dh_auto_test:
ifeq (,$(filter amd64 arm64 armhf i386 loong64 ppc64el riscv64 s390x powerpc sh4,$(DEB_HOST_ARCH)))
#	dh_auto_test $(test_args) || :
#else
#	dh_auto_test --builddirectory=build-qt6 --no-parallel -- ARGS=\"--verbose\"
	dh_auto_test --builddirectory=build-qt5 --no-parallel -- ARGS=\"--verbose\"
endif

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

override_dh_auto_clean:
#	dh_auto_clean --builddirectory=build-qt6
	dh_auto_clean --builddirectory=build-qt5

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