#!/usr/bin/make -f

export QT_SELECT := qt5

export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS := hardening=+all

# FIXME: This should be reported and fixed upstream at some time.
export DEB_CXXFLAGS_MAINT_APPEND := -Wno-error=deprecated-copy

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

TESTS_HOME = $(CURDIR)/debian/tests.home

%:
	dh $@

override_dh_clean:
	dh_clean
	rm -rf "$(TESTS_HOME)"

override_dh_auto_configure:
	./translate.sh
	dh_auto_configure -- FORCECONFIG=release

override_dh_auto_install:
	dh_auto_install
	# remove symlinks of private libraries
	find debian/tmp -name '*.so' -type l -print -delete

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	mkdir -p "$(TESTS_HOME)"
	HOME="$(TESTS_HOME)" xvfb-run -a dh_auto_test --no-parallel
endif
