#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

WEBENGINE_INSTALL_STATUS := $(shell dpkg-query -W --showformat='$${Status}\n' qtwebengine5-dev|grep "install ok installed")
ifeq (install ok installed,$(WEBENGINE_INSTALL_STATUS))
	WEB_BACKEND = -DWITH_WEBKIT=OFF -DWITH_WEBENGINE=ON
else
	WEB_BACKEND = -DWITH_WEBKIT=ON -DWITH_WEBENGINE=OFF
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DWITH_OXYGEN_ICONS=ON -DWITH_BUNDLED_ICONS=OFF -DUSE_QT5=ON -DWITH_KDE=ON -DENABLE_SHARED=OFF $(WEB_BACKEND)

execute_before_dh_auto_build:
	@echo "blhc: ignore-line-regexp: .*/CMakeCXXCompilerABI.cpp.*"

execute_after_dh_auto_install:
	chrpath -d $(CURDIR)/debian/tmp/usr/bin/*
	# replace inxi with a symlink
	rm $(CURDIR)/debian/tmp/usr/share/quassel/scripts/inxi

execute_after_dh_install:
	dh_apparmor -pquassel-core --profile-name=usr.bin.quasselcore

override_dh_installinit:
	dh_installinit --no-stop-on-upgrade --no-restart-after-upgrade --error-handler=exit --name=quasselcore

override_dh_installsystemd:
	dh_installsystemd --no-stop-on-upgrade --no-restart-after-upgrade --name=quasselcore
