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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

l10npkgs_firstversion_ok := 4:17.08.3-3~
include /usr/share/pkg-kde-tools/qt-kde-team/2/l10n-packages.mk

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf mips mipsel))
    export DEB_CFLAGS_MAINT_STRIP = -g
    export DEB_CXXFLAGS_MAINT_STRIP = -g
    export DEB_CFLAGS_MAINT_APPEND = -gstabs
    export DEB_CXXFLAGS_MAINT_APPEND = -gstabs
endif

# Local Lintian after dpkg-buildpackage (uses debian/lintianrc). For sbuild, see debian/README.sbuild
# and debian/sbuild.suryaos.conf (set SBUILD_CONFIG to that file).
.PHONY: run-lintian
run-lintian:
	@if ! ls ../*.changes >/dev/null 2>&1; then \
		echo "run-lintian: no ../*.changes — run dpkg-buildpackage from this directory first." >&2; \
		exit 1; \
	fi; \
	export LINTIAN_CFG="$(CURDIR)/debian/lintianrc"; \
	for c in ../*.changes; do lintian "$$c"; done; \
	if ls ../*.dsc >/dev/null 2>&1; then for d in ../*.dsc; do lintian "$$d"; done; fi

%:
	dh $@ --with kf5,pkgkde_symbolshelper,sodeps --buildsystem kf5 --without build_stamp

override_dh_auto_configure:
	dh_auto_configure -Skf5 -- -DBUILD_TESTING=OFF

override_dh_auto_test:
	# Disable dh_auto_test, fourth test never ends
	# xvfb-run -a dh_auto_test
	:

override_dh_gencontrol-indep: l10npkgs_firstversion_ok
	dh_gencontrol -i
