#!/usr/bin/make -f

SHELL := sh -e

include /usr/share/dpkg/architecture.mk

%:
	dh ${@} --buildsystem=meson

override_dh_builddeb:
	dh_builddeb -- -Zgzip

override_dh_auto_configure-indep:

override_dh_auto_build-indep:

override_dh_auto_test:
	# Disabling test suite, incomplete

override_dh_auto_clean:
	dh_auto_clean

override_dh_installsystemd:
	# Need to specify units manually, since we have multiple
	# and dh_installsystemd by default only looks for "<package>.service".
	dh_installsystemd -pdonau --name=donau --no-start --no-enable --no-stop-on-upgrade
	dh_installsystemd -pdonau --name=donau-httpd --no-start --no-enable --no-stop-on-upgrade
	dh_installsystemd -pdonau --name=donau-secmod-cs --no-start --no-enable --no-stop-on-upgrade
	dh_installsystemd -pdonau --name=donau-secmod-eddsa --no-start --no-enable --no-stop-on-upgrade
	dh_installsystemd -pdonau --name=donau-secmod-rsa --no-start --no-enable --no-stop-on-upgrade
	# final invocation to generate daemon reload
	dh_installsystemd

override_dh_install:
	dh_install
# With debhelper-compat=12, we still need to call this manually
	dh_installtmpfiles
# Remove files already present in libdonau from main donau package
	cd debian/libdonau-dev; find . -type f,l -exec rm -f ../donau/{} \;
	cd debian/libdonau-dev; find . -type f,l -exec rm -f ../libdonau/{} \;
	cd debian/libdonau; find . -type f,l -exec rm -f ../donau/{} \;
