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

NULL =

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

export DPKG_GENSYMBOLS_CHECK_LEVEL=1

export QT_SELECT := qt5

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

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		CONFIG+=load_icu \
		PKGCONFIG_LIB=lib/$(DEB_HOST_MULTIARCH) \
		SQLITE_EXTENSIONS=lib/$(DEB_HOST_MULTIARCH)/sqlite \
		SQLITE_ICU_EXT=icu.so \
		$(NULL)

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	mkdir -p test-home/.local/share # Workaround for jenkins
	glib-compile-schemas schemas/
	HOME=$(shell pwd)/test-home GSETTINGS_SCHEMA_DIR=$(shell pwd)/schemas dh_auto_test --no-parallel
endif

override_dh_missing:
	dh_missing --fail-missing

override_dh_install:
	# remove the tests
	rm -rf debian/tmp/opt
	rm -rf debian/tmp/usr/lib/*/qtcontacts-sqlite-qt5/libtestdlgg.so
	rm -rf debian/tmp/usr/bin/eds_importer
	dh_install

override_dh_clean:
	-dh_clean
	rm -f schemas/gschemas.compiled

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