#!/usr/bin/make -f
# -*- makefile -*-

export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic

# ensure building with UTF-8 locale
export LC_ALL = C.UTF-8

%:
	dh $@

override_dh_auto_configure:
	dh_testdir
	dh_auto_configure -- --sysconfdir=/etc/burp --localstatedir=/var --sbindir=\$${prefix}/sbin

override_dh_auto_test:
	# disable unit test ('check' framework) to avoid FTBFS in the Debian Package Auto-Building.
	# These test are executed with the Debian continuous integration system (debci).

override_dh_auto_install:
	dh_auto_install -- install-configs
	# remove duplicate files and empty dir
	rm debian/burp/usr/share/doc/burp/LICENSE
	rm debian/burp/usr/share/doc/burp/CHANGELOG
	rmdir debian/burp/run

override_dh_fixperms:
	dh_fixperms
	chmod 0600 debian/burp/etc/burp/burp.conf
	chmod 0600 debian/burp/etc/burp/burp-server.conf
	chmod 0700 debian/burp/etc/burp/clientconfdir
	chmod 0700 debian/burp/var/spool/burp

override_dh_installinit:
	# use sysvinit as alternative init system
	dh_installinit --no-enable --no-start

override_dh_installsystemd:
	dh_installsystemd --no-enable

override_dh_clean:
	dh_clean
	rm -fv manpages/*.8
