#!/usr/bin/make -f
# -*- makefile -*-
export DPKG_GENSYMBOLS_CHECK_LEVEL=1

export QT_SELECT := qt5

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

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

%:
	dh $@ --buildsystem=qmake

override_dh_auto_configure:
	./configure -tests -icu -prefix /usr -libdir /usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_auto_test:
	mkdir -p debian/test-home/.local/share
	# Nasty hack: the 'check' target expects libsrc.so.0.1.1 instead of libmlocale5.so.0.1.1.
	# Tststs... let's fulfill that expectation...
	ln -s libmlocale5.so.0.1.1 lib/libsrc.so.0.1.1
	HOME=$(shell pwd)/debian/test-home xvfb-run -a dh_auto_test --no-parallel

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_clean:
	-dh_auto_clean
	rm -f .qmake.cache
	rm -f benchmarks/tests.xml
	rm -f mkspecs/features/mlocale_defines.prf
	rm -f mkspecs/mlocaleconfig.pri
	rm -f src/data/mlocale5.pc
	rm -f tests/tests.xml
	rm -f lib/libsrc.so.0.1.1

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