#!/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_test:
	# Disabling test suite, incomplete

override_dh_auto_install-arch:
	dh_auto_install

	# Removing useless files
	rm -f debian/tmp/usr/share/doc/anastasis/COPYING

override_dh_auto_install-indep:

override_dh_auto_clean:
	dh_auto_clean

override_dh_installsystemd:
	dh_installsystemd -panastasis-httpd --name=anastasis-httpd --no-start --no-enable
	# final invocation to generate daemon reload
	dh_installsystemd

override_dh_install:
	dh_install
# Done manually for debhelper-compat<13
	dh_installtmpfiles
# Remove files already present in libanastasis-dev/cli from anastasis-httpd/libanastasis packages
	cd debian/libanastasis; find . -type f,l -exec rm -f ../anastasis-httpd/{} \;
	cd debian/libanastasis; find . -type f,l -exec rm -f ../libanastasis-dev/{} \;
	cd debian/anastasis-httpd; find . -type f,l -exec rm -f ../libanastasis-dev/{} \;
	cd debian/anastasis-cli; find . -type f -exec rm -f ../anastasis-httpd/{} \;
	cd debian/libanastasis-dev; find . -type f,l -exec rm -f ../libanastasis/{} \;
