# Template file for 'openntpd'
pkgname=openntpd
version=6.8p1
revision=8
build_style=gnu-configure
configure_args="--with-privsep-user=openntpd --with-cacert=/etc/ssl/certs.pem"
hostmakedepends="automake libtool"
makedepends="libtls-devel"
depends="ca-certificates"
short_desc="FREE, easy to use implementation of the Network Time Protocol"
maintainer="Orphaned <orphan@voidlinux.org>"
license="ISC"
homepage="http://openntpd.org/"
distfiles="https://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/${pkgname}-${version}.tar.gz"
checksum=8582db838a399153d4a17f2a76518b638cc3020f58028575bf54127518f55a46

conf_files="/etc/ntpd.conf"
provides="ntp-daemon-0_1"
system_accounts="openntpd"
alternatives="
 ntpd:ntpd:/usr/bin/openntpd
 ntpd:ntpd.8:/usr/share/man/man8/openntpd.8
 ntpd:ntpd:/etc/sv/openntpd"

pre_configure() {
	autoreconf -fi
}

post_install() {
	# Rename files for alternatives.
	mv ${DESTDIR}/usr/bin/{ntpd,$pkgname}
	mv ${DESTDIR}/usr/share/man/man8/{ntpd,openntpd}.8
	# Use a symlink instead.
	rm ${DESTDIR}/usr/bin/ntpctl
	ln -s openntpd ${DESTDIR}/usr/bin/ntpctl
	vsv $pkgname
	vlicense COPYING
}
