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

# Auto-Generated by cargo-ebuild 0.5.4

# (and then fixed by hand again and again and again)

EAPI=8

MY_PV="${PV/_beta/-beta.}"

DESCRIPTION="A self-hosted ACME dns-01 challenge responder"
HOMEPAGE="https://github.com/krtab/agnos"

# AFTER SEVERAL MONTHS it hasn't been uploaded to crates.io
#CRATES="
#	${PN}-${MY_PV}
CRATES="
	acme2@0.5.1
	anyhow@1.0.69
	async-trait@0.1.64
	autocfg@1.1.0
	base64@0.13.1
	base64@0.21.0
	bitflags@1.3.2
	block-buffer@0.10.3
	bumpalo@3.12.0
	bytes@1.4.0
	cc@1.0.79
	cfg-if@1.0.0
	clap@4.1.8
	clap_lex@0.3.2
	core-foundation@0.9.3
	core-foundation-sys@0.8.3
	cpufeatures@0.2.5
	crypto-common@0.1.6
	data-encoding@2.3.3
	digest@0.10.6
	encoding_rs@0.8.32
	endian-type@0.1.2
	enum-as-inner@0.5.1
	errno@0.2.8
	errno-dragonfly@0.1.2
	fastrand@1.9.0
	fnv@1.0.7
	foreign-types@0.3.2
	foreign-types-shared@0.1.1
	form_urlencoded@1.1.0
	futures-channel@0.3.26
	futures-core@0.3.26
	futures-executor@0.3.26
	futures-io@0.3.26
	futures-macro@0.3.26
	futures-sink@0.3.26
	futures-task@0.3.26
	futures-util@0.3.26
	generic-array@0.14.6
	getrandom@0.2.8
	h2@0.3.16
	hashbrown@0.12.3
	heck@0.4.1
	hermit-abi@0.2.6
	hermit-abi@0.3.1
	http@0.2.9
	http-body@0.4.5
	httparse@1.8.0
	httpdate@1.0.2
	hyper@0.14.24
	hyper-rustls@0.23.2
	hyper-tls@0.5.0
	idna@0.2.3
	idna@0.3.0
	indexmap@1.9.2
	instant@0.1.12
	io-lifetimes@1.0.5
	ipnet@2.7.1
	is-terminal@0.4.4
	itoa@1.0.5
	js-sys@0.3.61
	lazy_static@1.4.0
	libc@0.2.139
	linux-raw-sys@0.1.4
	log@0.4.17
	matchers@0.1.0
	matches@0.1.10
	memchr@2.5.0
	mime@0.3.16
	mio@0.8.6
	native-tls@0.2.11
	nibble_vec@0.1.0
	nu-ansi-term@0.46.0
	num_cpus@1.15.0
	once_cell@1.17.1
	openssl@0.10.45
	openssl-macros@0.1.0
	openssl-probe@0.1.5
	openssl-sys@0.9.80
	os_str_bytes@6.4.1
	overload@0.1.1
	percent-encoding@2.2.0
	pin-project@1.0.12
	pin-project-internal@1.0.12
	pin-project-lite@0.2.9
	pin-utils@0.1.0
	pkg-config@0.3.26
	ppv-lite86@0.2.17
	proc-macro2@1.0.51
	quote@1.0.23
	radix_trie@0.2.1
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	redox_syscall@0.2.16
	regex@1.7.1
	regex-automata@0.1.10
	regex-syntax@0.6.28
	reqwest@0.11.14
	ring@0.16.20
	rustix@0.36.8
	rustls@0.20.8
	rustls-pemfile@1.0.2
	ryu@1.0.12
	schannel@0.1.21
	sct@0.7.0
	security-framework@2.8.2
	security-framework-sys@2.8.0
	serde@1.0.152
	serde_derive@1.0.152
	serde_json@1.0.93
	serde_spanned@0.6.1
	serde_urlencoded@0.7.1
	sha2@0.10.6
	sharded-slab@0.1.4
	slab@0.4.8
	smallvec@1.10.0
	socket2@0.4.7
	spin@0.5.2
	strsim@0.10.0
	syn@1.0.109
	tempfile@3.4.0
	termcolor@1.2.0
	thiserror@1.0.38
	thiserror-impl@1.0.38
	thread_local@1.1.7
	time@0.3.20
	time-core@0.1.0
	tinyvec@1.6.0
	tinyvec_macros@0.1.1
	tokio@1.25.0
	tokio-macros@1.8.2
	tokio-native-tls@0.3.1
	tokio-rustls@0.23.4
	tokio-util@0.7.7
	toml@0.5.11
	toml@0.7.2
	toml_datetime@0.6.1
	toml_edit@0.19.4
	tower-service@0.3.2
	tracing@0.1.37
	tracing-attributes@0.1.23
	tracing-core@0.1.30
	tracing-error@0.2.0
	tracing-futures@0.2.5
	tracing-log@0.1.3
	tracing-subscriber@0.3.16
	trust-dns-client@0.22.0
	trust-dns-proto@0.22.0
	trust-dns-server@0.22.0
	try-lock@0.2.4
	typenum@1.16.0
	unicode-bidi@0.3.10
	unicode-ident@1.0.6
	unicode-normalization@0.1.22
	untrusted@0.7.1
	url@2.3.1
	valuable@0.1.0
	vcpkg@0.2.15
	version_check@0.9.4
	want@0.3.0
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen@0.2.84
	wasm-bindgen-backend@0.2.84
	wasm-bindgen-futures@0.4.34
	wasm-bindgen-macro@0.2.84
	wasm-bindgen-macro-support@0.2.84
	wasm-bindgen-shared@0.2.84
	web-sys@0.3.61
	webpki@0.22.0
	webpki-roots@0.22.6
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.5
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows-sys@0.42.0
	windows-sys@0.45.0
	windows-targets@0.42.1
	windows_aarch64_gnullvm@0.42.1
	windows_aarch64_msvc@0.42.1
	windows_i686_gnu@0.42.1
	windows_i686_msvc@0.42.1
	windows_x86_64_gnu@0.42.1
	windows_x86_64_gnullvm@0.42.1
	windows_x86_64_msvc@0.42.1
	winnow@0.3.3
	winreg@0.10.1
"

inherit cargo fcaps

SRC_URI="
	${CARGO_CRATE_URIS}
	https://github.com/krtab/${PN}/archive/refs/tags/v${MY_PV}.tar.gz -> ${PN}-${MY_PV}.tar.gz
	https://raw.githubusercontent.com/krtab/${PN}/v${MY_PV}/config_example.toml -> ${P}_example.toml
"
S="${WORKDIR}/${PN}-${MY_PV}"
# cargo-license output (abridged)
#   (Apache-2.0 OR MIT) AND BSD-3-Clause (1)
#   (MIT OR Apache-2.0) AND Unicode-DFS-2016 (1)
#   0BSD OR Apache-2.0 OR MIT (1)
#   Apache-2.0 (1)
#   Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT (1)
#   Apache-2.0 OR BSL-1.0 (1)
#   Apache-2.0 OR ISC OR MIT (4)
#   Apache-2.0 OR MIT (121)
#   Apache-2.0 OR MIT OR Zlib (3)
#   BSD-3-Clause (1)
#   Custom License File (2)
#   ISC (1)
#   MIT (40)
#   MIT OR Unlicense (4)
#   MPL-2.0 (1)
# non-standard license texts caught by cargo-license:
# - ring is BoringSSL-derived with additions (so, openssl ISC MIT)
# - webpki is "ISC-style"
# - ryu is dual Apache-2.0 or BSL-1.0 (a.k.a. $PORTDIR/licenses/Boost-1.0)
LICENSE="0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD Boost-1.0 ISC MIT MPL-2.0 openssl Unicode-DFS-2016 Unlicense ZLIB"
SLOT="0"
KEYWORDS="~amd64"

DEPEND="dev-libs/openssl:="

#QA_FLAGS_IGNORED="usr/bin/agnos"

FILECAPS=( -m 755 'cap_net_bind_service=+ep' "usr/bin/${PN}" )

src_unpack() {
	cargo_src_unpack
}

src_install() {
	cargo_src_install

	# The readme is literally "you can find the example file on github" and there's zero
	# documentation besides that, so for the sake of users' sanity, bundle them both here.
	dodoc "${S}/README.md"
	newdoc "${DISTDIR}/${P}_example.toml" config_example.toml
}