#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/buildtools.mk

%:
	dh $@ --with openrc,runit

override_dh_auto_configure:
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	autoreconf -f -i
	dh_auto_configure -- \
		--sysconfdir=/etc/openntpd \
		--with-privsep-user=ntpd \
		--with-privsep-path=/var/lib/openntpd \
		--localstatedir=/var/lib/openntpd

override_dh_auto_install:
	dh_auto_install

override_dh_install:
	dh_install
	dh_apparmor --profile-name=usr.sbin.ntpd -popenntpd

override_dh_installinit:
	dh_installinit --no-scripts

override_dh_installsystemd:
	:

override_dh_installdocs:
	dh_installdocs AUTHORS

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog
