#!/usr/bin/make -f

export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- \
		--with-apacheconfigdir=/etc/apache2/sites-available/ \
		--with-smartydir=/usr/share/php/smarty3/ \
		--with-initdir=/lib/systemd/system/ \
		--with-webuser=www-data \
		--with-apachesymlinkdir=/etc/apache2/sites-enabled/

MAINTAINER_SCRIPTS=packaging/debian/prerm packaging/debian/postrm \
		packaging/debian/preinst packaging/debian/postinst packaging/debian/chiton.config

# We extract updated maintainer scripts from the package using our own build options
override_dh_auto_build:
	-rm -f $(MAINTAINER_SCRIPTS)
	dh_auto_build -- \
		$(MAINTAINER_SCRIPTS)
	cp $(MAINTAINER_SCRIPTS) debian/
