#!/usr/bin/make -f

export DH_VERBOSE=1

export PVER=$(shell dpkg-parsechangelog --show-field version | cut -d"+" -f1 )

export DEB_BUILD_MAINT_OPTIONS := hardening=+all
export DEB_LDFLAGS_MAINT_APPEND := -fPIE -pie -Wl,--as-needed
export QT_SELECT=5

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

%:
	dh $@ --buildsystem=qmake

override_dh_auto_configure:
	dh_auto_configure -- \
		"LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)" \
		"LOCALEDIR=/usr/share/webcamoid/locale" \
		"INSTALLQMLDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/qml"

override_dh_makeshlibs:
	dh_makeshlibs -- -v$(PVER)

override_dh_clean:
	dh_clean
	find ./libAvKys/Tests/ -name "test_auto" | xargs -i rm {}
	find ./libAvKys/Tests/ -name "test.o" | xargs -i rm {}
	find ./libAvKys/Tests/ -name "Makefile" | xargs -i rm {}
	rm -f ./libAvKys/config.log
	rm -f ./libAvKys/.qmake.cache
	rm -f ./libAvKys/.qmake.stash
	rm -f StandAlone/share/man/webcamoid.1.gz

override_dh_strip:
	dh_strip --no-automatic-dbgsym
