#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

BASE=debian/chrony

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure --  --mandir=/usr/share/man \
		--sysconfdir=/etc/chrony \
		--without-readline \
		--with-user=_chrony \
		--enable-scfilter \
		--chronyrundir=/run/chrony \
		--with-ntp-era=$(shell date -d '1970-01-01 00:00:00+00:00' +'%s') \
		--enable-ntp-signd \
		--with-hwclockfile=/etc/adjtime \
		--with-pidfile=/run/chronyd.pid

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_install:
	dh_install
	install -m 0640 -t $(BASE)/usr/share/chrony/ debian/chrony.keys
	install -m 0755 -T examples/chrony.nm-dispatcher $(BASE)/etc/NetworkManager/dispatcher.d/20-chrony
	install -m 0644 -T examples/chrony.logrotate $(BASE)/etc/logrotate.d/chrony

override_dh_fixperms:
	dh_fixperms -X usr/share/chrony/chrony.keys
