#!/usr/bin/make -f

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_BUILD_OPTIONS=nocheck

testsuite_failing_archs := ia64 sparc64
ifneq (,$(filter $(DEB_HOST_ARCH),$(testsuite_failing_archs)))
  fail_param := || true
endif

%:
	dh $@ --parallel --with pkgkde_symbolshelper

override_dh_auto_configure:
	dh_auto_configure -- -DBUILD_TESTS=ON -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)"

ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
override_dh_auto_test:
	xvfb-run dh_auto_test $(fail_param)
endif

override_dh_makeshlibs:
	dh_makeshlibs -V -X/usr/lib/$(DEB_HOST_MULTIARCH)/grantlee/

override_dh_install:
	dh_install --fail-missing

override_dh_strip:
	dh_strip --dbgsym-migration='grantlee5-dbg (<= 5.1.0-1~~)'
