# Template file for 'ntpd-rs'
pkgname=ntpd-rs
version=1.9.0
revision=2
build_style=cargo
make_check_args="--
 --skip daemon::keyexchange::tests::client_connection_refused
 --skip daemon::keyexchange::tests::key_exchange_connection_limiter
 --skip daemon::keyexchange::tests::key_exchange_weird_packet
 --skip nts::tests::test_key_exchange_roundtrip_no_cookies
 --skip nts::tests::test_keyexchange_fixed_key_no_permission
 --skip nts::tests::test_keyexchange_roundtrip_fixed_key
 --skip nts::tests::test_keyexchange_roundtrip_fixed_key_keep_alive
 --skip nts::tests::test_keyexchange_roundtrip_fixed_key_no_permit
 --skip nts::tests::test_keyexchange_roundtrip_no_proto_overlap
 --skip nts::tests::test_keyexchange_roundtrip_no_upgrade_possible
 --skip nts::tests::test_keyexchange_roundtrip_supports
 --skip nts::tests::test_keyexchange_roundtrip_upgrading
 --skip nts::tests::test_keyexchange_roundtrip_v4
 --skip nts::tests::test_keyexchange_roundtrip_v5
 --skip nts::tests::test_keyexchange_supports_no_permission
 --skip daemon::keyexchange::tests::key_exchange_roundtrip_with_port_server
 --skip daemon::spawn::nts::tests::allow_srv_direct_name_resolution
 --skip daemon::spawn::nts::tests::direct_name_resolution
"
make_install_args="--path ntpd"
short_desc="Full-featured implementation of the Network Time Protocol"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0 OR MIT"
homepage="https://github.com/pendulum-project/ntpd-rs"
changelog="https://raw.githubusercontent.com/pendulum-project/ntpd-rs/main/CHANGELOG.md"
distfiles="https://github.com/pendulum-project/ntpd-rs/archive/refs/tags/v${version}.tar.gz"
checksum=b25d560c4ae5a704d9509984b040123675052d27fe7a3e7cbc5bedc9e392c932

system_accounts="_ntpd_rs"
conf_files="/etc/ntpd-rs/ntp.toml"
provides="ntp-daemon-0_1"
alternatives="
 ntpd:ntpd:/usr/bin/ntp-daemon
 ntpd:ntpd:/etc/sv/ntpd-rs"

post_patch() {
	# apply patched Cargo.toml changes to lockfile
	cargo metadata > /dev/null
}

post_install() {
	vinstall ntp.toml 644 etc/ntpd-rs
	vlicense LICENSE-MIT
	vsv ntpd-rs
	vsv ntpd-rs-metrics

	for manpage in docs/precompiled/man/*; do
		vman ${manpage}
	done
}
