#! /usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

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

# We don't install all files upstream wants to. Those files get added to
# the following variable which gives us a cleaner buildd output (idea taken
# from the mesa package).
NOT_INSTALLED := \
				usr/lib/$(DEB_HOST_MULTIARCH)/libkvilib.so \
				usr/bin/kvirc-config \
				usr/share/kvirc/5.0/license/LICENSE-OPENSSL \
				usr/share/kvirc/5.0/license/COPYING \
				usr/share/kvirc/5.0/license/ABOUT-LICENSE \
				usr/share/pixmaps/kvirc.png

override_dh_auto_configure:
	dh_auto_configure -- \
			-DCMAKE_BUILD_TYPE=RelWithDebInfo \
			-DWANT_COEXISTENCE=OFF \
			-DWANT_ESD=OFF -DWANT_OSS=OFF \
			-DWANT_STRIP=OFF \
			-DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \
			-DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)"

override_dh_install:
	set -e; for file in $(NOT_INSTALLED); do rm debian/tmp/$$file; done
	dh_install

override_dh_missing:
	dh_missing --fail-missing

%:
	dh $@ --with kf5

.PHONY: override_dh_auto_configure override_dh_install override_dh_missing
