# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.13.3

EAPI=8

CRATES="
	addr2line@0.22.0
	adler@1.0.2
	aead@0.5.2
	aes-siv@0.7.0
	aes@0.8.4
	arbitrary@1.3.2
	async-trait@0.1.81
	backtrace@0.3.73
	base64@0.22.1
	bitflags@2.6.0
	block-buffer@0.10.4
	bytes@1.6.0
	cc@1.1.0
	cfg-if@1.0.0
	cipher@0.4.4
	clock-steering@0.2.1
	cmac@0.7.2
	core-foundation-sys@0.8.6
	core-foundation@0.9.4
	cpufeatures@0.2.12
	crypto-common@0.1.6
	ctr@0.9.2
	dbl@0.3.2
	digest@0.10.7
	equivalent@1.0.1
	generic-array@0.14.7
	getrandom@0.2.15
	gimli@0.29.0
	hashbrown@0.14.5
	hermit-abi@0.3.9
	indexmap@2.2.6
	inout@0.1.3
	itoa@1.0.11
	lazy_static@1.5.0
	libc@0.2.155
	log@0.4.22
	md-5@0.10.6
	memchr@2.7.4
	miniz_oxide@0.7.4
	mio@0.8.11
	nu-ansi-term@0.46.0
	num_cpus@1.16.0
	object@0.36.1
	once_cell@1.19.0
	openssl-probe@0.1.5
	overload@0.1.1
	pin-project-lite@0.2.14
	ppv-lite86@0.2.17
	proc-macro2@1.0.86
	quote@1.0.36
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	ring@0.17.8
	rustc-demangle@0.1.24
	rustls-native-certs@0.7.1
	rustls-pemfile@2.1.2
	rustls-pki-types@1.7.0
	rustls-webpki@0.102.5
	rustls@0.23.11
	ryu@1.0.18
	schannel@0.1.23
	security-framework-sys@2.11.0
	security-framework@2.11.0
	serde@1.0.204
	serde_derive@1.0.204
	serde_json@1.0.120
	serde_spanned@0.6.6
	serde_test@1.0.176
	sharded-slab@0.1.7
	socket2@0.5.7
	spin@0.9.8
	subtle@2.6.1
	syn@2.0.70
	thread_local@1.1.8
	timestamped-socket@0.2.2
	tokio-macros@2.3.0
	tokio-rustls@0.26.0
	tokio@1.38.1
	toml@0.8.15
	toml_datetime@0.6.6
	toml_edit@0.22.16
	tracing-attributes@0.1.27
	tracing-core@0.1.32
	tracing-subscriber@0.3.18
	tracing@0.1.40
	typenum@1.17.0
	unicode-ident@1.0.12
	untrusted@0.9.0
	version_check@0.9.4
	wasi@0.11.0+wasi-snapshot-preview1
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	winnow@0.6.13
	zeroize@1.8.1
"

inherit cargo systemd

DESCRIPTION="Full-featured implementation of NTP with NTS support"
HOMEPAGE="https://github.com/pendulum-project/ntpd-rs"
SRC_URI="
	${CARGO_CRATE_URIS}
	https://github.com/pendulum-project/ntpd-rs/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
"

S="${WORKDIR}/${P}/ntpd"
LICENSE="Apache-2.0 MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="metrics"

RDEPEND="
	acct-group/ntpd-rs
	acct-user/ntpd-rs
	metrics? (
		acct-group/ntpd-rs-observe
		acct-user/ntpd-rs-observe
	)
"

src_install(){
	for bin in ntp-ctl ntp-daemon ntp-metrics-exporter; do
		dobin ../$(cargo_target_dir)/${bin}
	done

	for man in ntp-ctl.8  ntp-daemon.8  ntp-metrics-exporter.8  ntp.toml.5; do
		doman ../docs/precompiled/man/${man}
	done

	insinto $(systemd_get_systempresetdir)
	doins ../docs/examples/conf/ntpd-rs.preset

	insinto /etc/ntpd-rs
	doins ../ntp.toml

	systemd_dounit ../docs/examples/conf/ntpd-rs-metrics.service
	systemd_dounit ../docs/examples/conf/ntpd-rs.service
}