# 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.24.1
	adler2@2.0.0
	aead@0.5.2
	aes-siv@0.7.0
	aes@0.8.4
	arbitrary@1.3.2
	async-trait@0.1.82
	backtrace@0.3.74
	base64@0.22.1
	bitflags@2.6.0
	block-buffer@0.10.4
	byteorder@1.5.0
	bytes@1.7.2
	cc@1.1.21
	cfg-if@1.0.0
	cipher@0.4.4
	clock-steering@0.2.1
	cmac@0.7.2
	core-foundation-sys@0.8.7
	core-foundation@0.9.4
	cpufeatures@0.2.14
	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.31.0
	hashbrown@0.14.5
	hermit-abi@0.3.9
	indexmap@2.5.0
	inout@0.1.3
	itoa@1.0.11
	lazy_static@1.5.0
	libc@0.2.158
	log@0.4.22
	md-5@0.10.6
	memchr@2.7.4
	miniz_oxide@0.8.0
	mio@1.0.2
	nu-ansi-term@0.46.0
	object@0.36.4
	once_cell@1.19.0
	openssl-probe@0.1.5
	overload@0.1.1
	pin-project-lite@0.2.14
	ppv-lite86@0.2.20
	proc-macro2@1.0.86
	quote@1.0.37
	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.3
	rustls-pemfile@2.1.3
	rustls-pki-types@1.8.0
	rustls-webpki@0.102.8
	rustls@0.23.13
	ryu@1.0.18
	schannel@0.1.24
	security-framework-sys@2.11.1
	security-framework@2.11.1
	serde@1.0.210
	serde_derive@1.0.210
	serde_json@1.0.128
	serde_spanned@0.6.7
	serde_test@1.0.177
	sharded-slab@0.1.7
	shlex@1.3.0
	socket2@0.5.7
	spin@0.9.8
	subtle@2.6.1
	syn@2.0.77
	thread_local@1.1.8
	timestamped-socket@0.2.5
	tokio-macros@2.4.0
	tokio-rustls@0.26.0
	tokio@1.40.0
	toml@0.8.19
	toml_datetime@0.6.8
	toml_edit@0.22.21
	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.13
	untrusted@0.9.0
	version_check@0.9.5
	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.52.0
	windows-sys@0.59.0
	windows-targets@0.52.6
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.52.6
	winnow@0.6.18
	zerocopy-derive@0.7.35
	zerocopy@0.7.35
	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"
# Dependent crate licenses
LICENSE+="
	BSD ISC MIT Unicode-DFS-2016
	|| ( Apache-2.0 Boost-1.0 )
"
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
}