# Copyright 2021-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

RUST_MIN_VER="1.85.0"

CRATES="
	adler2@2.0.0
	aho-corasick@1.1.3
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anstream@0.6.18
	anstyle-parse@0.2.6
	anstyle-query@1.1.2
	anstyle-wincon@3.0.7
	anstyle@1.0.10
	anyhow@1.0.97
	arbitrary@1.4.1
	autocfg@1.4.0
	base64@0.22.1
	bitflags@2.9.0
	block-buffer@0.10.4
	bstr@1.11.3
	bumpalo@3.17.0
	byteorder@1.5.0
	bytes@1.10.1
	cc@1.2.16
	cfb@0.7.3
	cfg-if@1.0.0
	chrono@0.4.40
	clap@4.5.32
	clap_builder@4.5.32
	clap_complete@4.5.46
	clap_derive@4.5.32
	clap_lex@0.7.4
	colorchoice@1.0.3
	const_format@0.2.34
	const_format_proc_macros@0.2.34
	core-foundation-sys@0.8.7
	cpufeatures@0.2.17
	crc32fast@1.4.2
	crossbeam-utils@0.8.21
	crypto-common@0.1.6
	darling@0.20.10
	darling_core@0.20.10
	darling_macro@0.20.10
	dbus@0.9.7
	deranged@0.3.11
	derive_arbitrary@1.4.1
	derive_builder@0.20.2
	derive_builder_core@0.20.2
	derive_builder_macro@0.20.2
	digest@0.10.7
	displaydoc@0.2.5
	doc-comment@0.3.3
	downcast@0.11.0
	env_filter@0.1.3
	env_logger@0.11.7
	epub-builder@0.8.0
	epub@2.1.2
	equivalent@1.0.2
	errno@0.3.10
	fastrand@2.3.0
	flate2@1.1.0
	fnv@1.0.7
	form_urlencoded@1.2.1
	fragile@2.0.0
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-util@0.3.31
	futures@0.3.31
	generic-array@0.14.7
	getopts@0.2.21
	getrandom@0.2.15
	getrandom@0.3.1
	handlebars@6.3.1
	hashbrown@0.15.2
	heck@0.5.0
	hex@0.4.3
	html-escape@0.2.13
	html_parser@0.7.0
	http@1.3.1
	httparse@1.10.1
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.61
	icu_collections@1.5.0
	icu_locid@1.5.0
	icu_locid_transform@1.5.0
	icu_locid_transform_data@1.5.0
	icu_normalizer@1.5.0
	icu_normalizer_data@1.5.0
	icu_properties@1.5.1
	icu_properties_data@1.5.0
	icu_provider@1.5.0
	icu_provider_macros@1.5.0
	ident_case@1.0.1
	idna@1.0.3
	idna_adapter@1.2.0
	indexmap@2.8.0
	infer@0.19.0
	is_terminal_polyfill@1.70.1
	itoa@1.0.15
	jiff-static@0.2.4
	jiff@0.2.4
	js-sys@0.3.77
	libc@0.2.171
	libdbus-sys@0.2.5
	linux-raw-sys@0.9.3
	litemap@0.7.5
	lock_api@0.4.12
	lockfree-object-pool@0.1.6
	log@0.4.26
	mdbook@0.4.47
	memchr@2.7.4
	mime@0.3.17
	mime_guess@2.0.5
	miniz_oxide@0.8.5
	mockall@0.13.1
	mockall_derive@0.13.1
	normpath@1.3.0
	num-conv@0.1.0
	num-modular@0.6.1
	num-order@1.2.0
	num-traits@0.2.19
	num_enum@0.7.3
	num_enum_derive@0.7.3
	once_cell@1.21.1
	opener@0.7.2
	parking_lot@0.12.3
	parking_lot_core@0.9.10
	percent-encoding@2.3.1
	pest@2.7.15
	pest_derive@2.7.15
	pest_generator@2.7.15
	pest_meta@2.7.15
	pin-project-lite@0.2.16
	pin-utils@0.1.0
	pkg-config@0.3.32
	portable-atomic-util@0.2.4
	portable-atomic@1.11.0
	powerfmt@0.2.0
	predicates-core@1.0.9
	predicates-tree@1.0.12
	predicates@3.1.3
	proc-macro-crate@3.3.0
	proc-macro2@1.0.94
	pulldown-cmark-escape@0.10.1
	pulldown-cmark@0.10.3
	quote@1.0.40
	redox_syscall@0.5.10
	regex-automata@0.4.9
	regex-syntax@0.8.5
	regex@1.11.1
	ring@0.17.14
	rustix@1.0.2
	rustls-pemfile@2.2.0
	rustls-pki-types@1.11.0
	rustls-webpki@0.102.8
	rustls@0.23.23
	rustversion@1.0.20
	ryu@1.0.20
	scc@2.3.3
	scopeguard@1.2.0
	sdd@3.0.8
	semver@1.0.26
	serde@1.0.219
	serde_derive@1.0.219
	serde_json@1.0.140
	serial_test@3.2.0
	serial_test_derive@3.2.0
	sha2@0.10.8
	shlex@1.3.0
	simd-adler32@0.3.7
	slab@0.4.9
	smallvec@1.14.0
	stable_deref_trait@1.2.0
	strsim@0.11.1
	subtle@2.6.1
	syn@2.0.100
	synstructure@0.13.1
	tempfile@3.19.0
	terminal_size@0.4.2
	termtree@0.5.1
	thiserror-impl@1.0.69
	thiserror-impl@2.0.12
	thiserror@1.0.69
	thiserror@2.0.12
	time-core@0.1.3
	time@0.3.39
	tinystr@0.7.6
	toml@0.5.11
	toml_datetime@0.6.8
	toml_edit@0.22.24
	topological-sort@0.2.2
	typenum@1.18.0
	ucd-trie@0.1.7
	unicase@2.8.1
	unicode-ident@1.0.18
	unicode-width@0.1.14
	unicode-xid@0.2.6
	untrusted@0.9.0
	upon@0.8.1
	ureq-proto@0.3.5
	ureq@3.0.9
	url@2.5.4
	urlencoding@2.1.3
	utf-8@0.7.6
	utf16_iter@1.0.5
	utf8-width@0.1.7
	utf8_iter@1.0.4
	utf8parse@0.2.2
	uuid@1.16.0
	version_check@0.9.5
	wasi@0.11.0+wasi-snapshot-preview1
	wasi@0.13.3+wasi-0.2.2
	wasm-bindgen-backend@0.2.100
	wasm-bindgen-macro-support@0.2.100
	wasm-bindgen-macro@0.2.100
	wasm-bindgen-shared@0.2.100
	wasm-bindgen@0.2.100
	webpki-roots@0.26.8
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-core@0.52.0
	windows-link@0.1.0
	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.7.4
	wit-bindgen-rt@0.33.0
	write16@1.0.0
	writeable@0.5.5
	xml-rs@0.8.25
	yoke-derive@0.7.5
	yoke@0.7.5
	zerofrom-derive@0.1.6
	zerofrom@0.1.6
	zeroize@1.8.1
	zerovec-derive@0.10.3
	zerovec@0.10.4
	zip@1.1.4
	zip@2.2.3
	zopfli@0.8.1
"

inherit cargo toolchain-funcs

DESCRIPTION="An EPUB renderer for mdbook"
HOMEPAGE="https://github.com/Michael-F-Bryan/mdbook-epub"
SRC_URI="
	https://github.com/Michael-F-Bryan/mdbook-epub/archive/refs/tags/v${PV}.tar.gz
		-> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"
LICENSE="MPL-2.0"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 BSD Boost-1.0 GPL-3 ISC MIT MPL-2.0 Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"

QA_FLAGS_IGNORED="usr/bin/${PN}"

src_compile() {
	cargo_src_compile
}

src_test() {
	local skip=(
		# fails with usersandbox
		--skip test_ignore_canonical
	)

	cargo_src_test -- "${skip[@]}"
}

src_install() {
	cargo_src_install

	dodoc README.md
}
