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

# Autogenerated by pycargoebuild 0.13.4

EAPI=8

CRATES="
	ab_glyph@0.2.21
	ab_glyph_rasterizer@0.1.8
	addr2line@0.21.0
	adler@1.0.2
	ahash@0.7.6
	aho-corasick@1.0.4
	alsa-sys@0.3.1
	alsa@0.7.1
	android_system_properties@0.1.5
	anstream@0.5.0
	anstyle-parse@0.2.1
	anstyle-query@1.0.0
	anstyle-wincon@2.1.0
	anstyle@1.0.2
	anyhow@1.0.75
	anymap2@0.13.0
	approx@0.5.1
	arrayref@0.3.7
	arrayvec@0.5.2
	arrayvec@0.7.4
	ascii@1.1.0
	ash@0.37.3+1.3.251
	async-broadcast@0.5.1
	async-channel@1.9.0
	async-executor@1.5.1
	async-fs@1.6.0
	async-io@1.13.0
	async-lock@2.8.0
	async-process@1.7.0
	async-recursion@1.0.4
	async-task@4.4.0
	async-trait@0.1.73
	atomic-waker@1.1.1
	autocfg@1.1.0
	backtrace@0.3.69
	bindgen@0.64.0
	bit-set@0.5.3
	bit-vec@0.6.3
	bit_field@0.10.2
	bitflags@0.8.2
	bitflags@1.3.2
	bitflags@2.4.0
	block-buffer@0.10.4
	block@0.1.6
	blocking@1.3.1
	bumpalo@3.13.0
	bytemuck@1.13.1
	bytemuck_derive@1.4.1
	byteorder@1.4.3
	bytes@1.4.0
	calloop@0.10.6
	cc@1.0.83
	cesu8@1.1.0
	cexpr@0.6.0
	cfg-if@1.0.0
	clang-sys@1.6.1
	clap@4.4.0
	clap_builder@4.4.0
	clap_derive@4.4.0
	clap_lex@0.5.1
	claxon@0.4.3
	clipboard-win@4.5.0
	clipboard_macos@0.1.0
	clipboard_wayland@0.2.0
	clipboard_x11@0.4.0
	cmake@0.1.50
	cocoa-foundation@0.1.1
	cocoa@0.24.1
	codespan-reporting@0.11.1
	color_quant@1.1.0
	colorchoice@1.0.0
	com-rs@0.2.1
	combine@4.6.6
	concurrent-queue@2.2.0
	const-random-macro@0.1.15
	const-random@0.1.15
	const_panic@0.2.8
	core-foundation-sys@0.6.2
	core-foundation-sys@0.8.4
	core-foundation@0.9.3
	core-graphics-types@0.1.2
	core-graphics@0.22.3
	core-text@19.2.0
	coreaudio-rs@0.11.2
	coreaudio-sys@0.2.12
	cpal@0.15.2
	cpufeatures@0.2.9
	crc32fast@1.3.2
	crossbeam-channel@0.5.8
	crossbeam-deque@0.8.3
	crossbeam-epoch@0.9.15
	crossbeam-utils@0.8.16
	crossfont@0.5.1
	crunchy@0.2.2
	crypto-common@0.1.6
	ctrlc@3.4.0
	cty@0.2.2
	d3d12@0.6.0
	darling@0.13.4
	darling_core@0.13.4
	darling_macro@0.13.4
	dasp_sample@0.11.0
	deranged@0.3.11
	derivative@2.2.0
	derive-new@0.5.9
	digest@0.10.7
	dispatch@0.2.0
	dlib@0.5.2
	dlv-list@0.5.0
	doc-comment@0.3.3
	downcast-rs@1.2.0
	dwrote@0.11.0
	dyn-clone@1.0.13
	educe@0.4.22
	either@1.9.0
	encase@0.3.0
	encase_derive@0.3.0
	encase_derive_impl@0.3.0
	enum-ordinalize@3.1.13
	enumflags2@0.7.7
	enumflags2_derive@0.7.7
	env_logger@0.10.0
	equivalent@1.0.1
	errno-dragonfly@0.1.2
	errno@0.3.2
	error-code@2.3.1
	euclid@0.22.9
	event-listener@2.5.3
	expat-sys@2.1.6
	exr@1.7.0
	fastrand@1.9.0
	fastrand@2.0.0
	fdeflate@0.3.0
	filetime@0.2.22
	find-crate@0.6.3
	flate2@1.0.27
	flume@0.10.14
	fnv@1.0.7
	foreign-types-macros@0.2.3
	foreign-types-shared@0.1.1
	foreign-types-shared@0.3.1
	foreign-types@0.3.2
	foreign-types@0.5.0
	freetype-rs@0.26.0
	freetype-sys@0.13.1
	futures-channel@0.3.28
	futures-core@0.3.28
	futures-executor@0.3.28
	futures-io@0.3.28
	futures-lite@1.13.0
	futures-macro@0.3.28
	futures-sink@0.3.28
	futures-task@0.3.28
	futures-timer@3.0.2
	futures-util@0.3.28
	futures@0.3.28
	fxhash@0.2.1
	generic-array@0.14.7
	gethostname@0.2.3
	getrandom@0.2.10
	gif@0.12.0
	gimli@0.28.0
	glam@0.21.3
	glob@0.3.1
	glow@0.11.2
	glow@0.12.3
	glow_glyph@0.5.1
	glyph_brush@0.7.7
	glyph_brush_draw_cache@0.1.5
	glyph_brush_layout@0.2.3
	gpu-alloc-types@0.2.0
	gpu-alloc@0.5.4
	gpu-allocator@0.22.0
	gpu-descriptor-types@0.1.1
	gpu-descriptor@0.2.3
	guillotiere@0.6.2
	half@2.2.1
	hashbrown@0.11.2
	hashbrown@0.12.3
	hashbrown@0.13.2
	hashbrown@0.14.0
	hassle-rs@0.9.0
	heck@0.4.1
	hermit-abi@0.3.2
	hex@0.4.3
	hexf-parse@0.2.1
	hound@3.5.0
	humantime@2.1.0
	iced@0.9.0
	iced_core@0.9.0
	iced_futures@0.6.0
	iced_glow@0.8.0
	iced_graphics@0.8.0
	iced_native@0.10.3
	iced_style@0.8.0
	iced_wgpu@0.10.0
	iced_winit@0.9.1
	ident_case@1.0.1
	image@0.24.7
	indexmap@1.9.3
	indexmap@2.0.0
	indoc@1.0.9
	instant@0.1.12
	io-lifetimes@1.0.11
	is-terminal@0.4.9
	itertools@0.10.5
	itertools@0.11.0
	itoa@1.0.9
	jemalloc-sys@0.5.4+5.3.0-patched
	jemallocator@0.5.4
	jni-sys@0.3.0
	jni@0.19.0
	jni@0.20.0
	jobserver@0.1.26
	jpeg-decoder@0.3.0
	js-sys@0.3.64
	kamadak-exif@0.5.5
	khronos-egl@4.1.0
	kstring@2.0.0
	ladspa@0.3.4
	lazy_static@1.4.0
	lazycell@1.3.0
	lebe@0.5.2
	lewton@0.10.2
	libc@0.2.147
	libloading@0.7.4
	libloading@0.8.0
	libm@0.2.7
	linked-hash-map@0.5.6
	linux-raw-sys@0.3.8
	linux-raw-sys@0.4.5
	liquid-core@0.26.4
	liquid-derive@0.26.4
	liquid-lib@0.26.4
	liquid@0.26.4
	lock_api@0.4.10
	log@0.4.20
	mach2@0.4.1
	malloc_buf@0.0.6
	maplit@1.0.2
	matrixmultiply@0.3.7
	memchr@2.5.0
	memmap2@0.5.10
	memoffset@0.6.5
	memoffset@0.7.1
	memoffset@0.9.0
	metal@0.24.0
	minimal-lexical@0.2.1
	miniz_oxide@0.7.1
	mio@0.8.8
	mutate_once@0.1.1
	naga@0.11.1
	nanorand@0.7.0
	ndarray-rand@0.14.0
	ndarray@0.15.6
	ndk-context@0.1.1
	ndk-glue@0.7.0
	ndk-macro@0.3.0
	ndk-sys@0.4.1+23.1.7779620
	ndk@0.7.0
	nix@0.22.3
	nix@0.24.3
	nix@0.25.1
	nix@0.26.3
	nom@7.1.3
	num-bigint@0.4.4
	num-complex@0.4.4
	num-conv@0.1.0
	num-derive@0.3.3
	num-integer@0.1.45
	num-rational@0.4.1
	num-traits@0.2.16
	num_cpus@1.16.0
	num_enum@0.5.11
	num_enum_derive@0.5.11
	numpy@0.19.0
	objc-foundation@0.1.1
	objc@0.2.7
	objc_exception@0.1.2
	objc_id@0.1.1
	object@0.32.0
	oboe-sys@0.5.0
	oboe@0.5.0
	ogg@0.8.0
	once_cell@1.18.0
	ordered-float@3.9.1
	ordered-multimap@0.6.0
	ordered-stream@0.2.0
	owned_ttf_parser@0.19.0
	palette@0.6.1
	palette_derive@0.6.1
	parking@2.1.0
	parking_lot@0.11.2
	parking_lot@0.12.1
	parking_lot_core@0.8.6
	parking_lot_core@0.9.8
	paste@1.0.14
	peeking_take_while@0.1.2
	percent-encoding@2.3.0
	pest@2.7.2
	pest_derive@2.7.2
	pest_generator@2.7.2
	pest_meta@2.7.2
	phf@0.11.2
	phf_generator@0.11.2
	phf_macros@0.11.2
	phf_shared@0.11.2
	pin-project-internal@1.1.3
	pin-project-lite@0.2.13
	pin-project@1.1.3
	pin-utils@0.1.0
	pkg-config@0.3.27
	png@0.17.10
	polling@2.8.0
	powerfmt@0.2.0
	ppv-lite86@0.2.17
	primal-check@0.3.3
	proc-macro-crate@1.3.1
	proc-macro-error-attr@1.0.4
	proc-macro-error@1.0.4
	proc-macro-hack@0.5.20+deprecated
	proc-macro2@1.0.66
	profiling@1.0.9
	prost-derive@0.11.9
	prost@0.11.9
	pyo3-build-config@0.19.2
	pyo3-ffi@0.19.2
	pyo3-macros-backend@0.19.2
	pyo3-macros@0.19.2
	pyo3@0.19.2
	qoi@0.4.1
	quote@1.0.33
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	rand_distr@0.4.3
	rand_xoshiro@0.6.0
	range-alloc@0.1.3
	raw-window-handle@0.3.4
	raw-window-handle@0.4.3
	raw-window-handle@0.5.2
	rawpointer@0.2.1
	rayon-core@1.11.0
	rayon@1.7.0
	realfft@3.3.0
	redox_syscall@0.2.16
	redox_syscall@0.3.5
	regex-automata@0.3.7
	regex-syntax@0.7.5
	regex@1.9.4
	renderdoc-sys@0.7.1
	ringbuf@0.3.3
	roots@0.0.7
	rstest@0.17.0
	rstest_macros@0.17.0
	rubato@0.14.1
	rust-ini@0.19.0
	rustc-demangle@0.1.23
	rustc-hash@1.1.0
	rustc_version@0.4.0
	rustfft@6.1.0
	rustix@0.37.23
	rustix@0.38.9
	ryu@1.0.15
	safe_arch@0.5.2
	same-file@1.0.6
	scan_fmt@0.2.6
	scoped-tls@1.0.1
	scopeguard@1.2.0
	sctk-adwaita@0.4.3
	semver@1.0.18
	serde@1.0.188
	serde_derive@1.0.188
	serde_json@1.0.105
	serde_repr@0.1.16
	servo-fontconfig-sys@5.1.0
	servo-fontconfig@0.5.1
	sha1@0.10.5
	sha2@0.10.7
	shlex@1.1.0
	signal-hook-registry@1.4.1
	signal-hook@0.3.17
	simd-adler32@0.3.7
	siphasher@0.3.11
	slab@0.4.9
	slotmap@1.0.6
	smallvec@1.11.0
	smithay-client-toolkit@0.16.0
	smithay-clipboard@0.6.6
	socket2@0.4.9
	spin@0.9.8
	spirv@0.2.0+1.5.4
	static_assertions@1.1.0
	str-buf@1.0.6
	strength_reduce@0.2.4
	string-interner@0.14.0
	strsim@0.10.0
	svg_fmt@0.4.1
	syn@1.0.109
	syn@2.0.29
	tar@0.4.40
	target-lexicon@0.12.11
	tempfile@3.8.0
	termcolor@1.2.0
	thiserror-impl@1.0.47
	thiserror@1.0.47
	tiff@0.9.0
	time-core@0.1.2
	time-macros@0.2.19
	time@0.3.37
	tiny-keccak@2.0.2
	tiny-skia-path@0.7.0
	tiny-skia@0.7.0
	tinyvec@1.6.0
	tinyvec_macros@0.1.1
	tokio@1.32.0
	toml@0.5.11
	toml_datetime@0.6.3
	toml_edit@0.19.14
	tracing-attributes@0.1.26
	tracing-core@0.1.31
	tracing@0.1.37
	tract-core@0.19.16
	tract-data@0.19.16
	tract-hir@0.19.16
	tract-linalg@0.19.16
	tract-nnef@0.19.16
	tract-onnx-opl@0.19.16
	tract-onnx@0.19.16
	tract-pulse-opl@0.19.16
	tract-pulse@0.19.16
	transpose@0.2.2
	ttf-parser@0.19.1
	twox-hash@1.6.3
	typenum@1.16.0
	ucd-trie@0.1.6
	uds_windows@1.0.2
	unicode-ident@1.0.11
	unicode-normalization@0.1.22
	unicode-segmentation@1.10.1
	unicode-width@0.1.10
	unicode-xid@0.2.4
	unindent@0.1.11
	utf8parse@0.2.1
	uuid@1.4.1
	vec_map@0.7.0
	vec_map@0.8.2
	version_check@0.9.4
	waker-fn@1.1.0
	walkdir@2.3.3
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.87
	wasm-bindgen-futures@0.4.37
	wasm-bindgen-macro-support@0.2.87
	wasm-bindgen-macro@0.2.87
	wasm-bindgen-shared@0.2.87
	wasm-bindgen@0.2.87
	wasm-timer@0.2.5
	wayland-client@0.29.5
	wayland-commons@0.29.5
	wayland-cursor@0.29.5
	wayland-protocols@0.29.5
	wayland-scanner@0.29.5
	wayland-sys@0.29.5
	web-sys@0.3.64
	weezl@0.1.7
	wgpu-core@0.15.1
	wgpu-hal@0.15.4
	wgpu-types@0.15.2
	wgpu@0.15.1
	wgpu_glyph@0.19.0
	widestring@0.5.1
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.5
	winapi-wsapoll@0.1.1
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	window_clipboard@0.2.4
	windows-sys@0.36.1
	windows-sys@0.48.0
	windows-targets@0.42.2
	windows-targets@0.48.5
	windows@0.44.0
	windows@0.46.0
	windows_aarch64_gnullvm@0.42.2
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_msvc@0.36.1
	windows_aarch64_msvc@0.42.2
	windows_aarch64_msvc@0.48.5
	windows_i686_gnu@0.36.1
	windows_i686_gnu@0.42.2
	windows_i686_gnu@0.48.5
	windows_i686_msvc@0.36.1
	windows_i686_msvc@0.42.2
	windows_i686_msvc@0.48.5
	windows_x86_64_gnu@0.36.1
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_msvc@0.36.1
	windows_x86_64_msvc@0.42.2
	windows_x86_64_msvc@0.48.5
	winit@0.27.5
	winnow@0.5.15
	winreg@0.50.0
	wio@0.2.2
	x11-dl@2.21.0
	x11rb@0.9.0
	xattr@1.0.1
	xcursor@0.3.4
	xdg-home@1.0.0
	xi-unicode@0.3.0
	xml-rs@0.8.16
	zbus@3.14.1
	zbus_macros@3.14.1
	zbus_names@2.6.0
	zune-inflate@0.2.54
	zvariant@3.15.0
	zvariant_derive@3.15.0
	zvariant_utils@1.0.1
"

declare -A GIT_CRATES=(
	[hdf5-derive]='https://github.com/aldanor/hdf5-rust;26046fb4900ec38afd2a1c0494cff688b288662e;hdf5-rust-%commit%/hdf5-derive'
	[hdf5-src]='https://github.com/aldanor/hdf5-rust;26046fb4900ec38afd2a1c0494cff688b288662e;hdf5-rust-%commit%/hdf5-src'
	[hdf5-sys]='https://github.com/aldanor/hdf5-rust;26046fb4900ec38afd2a1c0494cff688b288662e;hdf5-rust-%commit%/hdf5-sys'
	[hdf5-types]='https://github.com/aldanor/hdf5-rust;26046fb4900ec38afd2a1c0494cff688b288662e;hdf5-rust-%commit%/hdf5-types'
	[hdf5]='https://github.com/aldanor/hdf5-rust;26046fb4900ec38afd2a1c0494cff688b288662e;hdf5-rust-%commit%/hdf5'
)

inherit cargo

DESCRIPTION="Noise supression using deep filtering"
HOMEPAGE="https://github.com/Rikorose/DeepFilterNet"
SRC_URI="https://github.com/Rikorose/DeepFilterNet/archive/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" ${CARGO_CRATE_URIS}"
S=${WORKDIR}/DeepFilterNet-${PV}

PATCHES=(
	"${FILESDIR}/${PN}-library-path.patch"
	"${FILESDIR}/${PN}-0.5.6-use-updated-time.patch"
)

LICENSE="|| ( Apache-2.0 MIT )"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD Boost-1.0
	CC0-1.0 ISC MIT MIT-0 MPL-2.0 OFL-1.1 Unicode-DFS-2016 Unlicense
	ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

IUSE="ladspa"
DEPEND="
	sci-libs/hdf5
"

BDEPEND="
	ladspa? ( dev-util/patchelf )
"

QA_FLAGS_IGNORED="usr/bin/deep-filter"

src_configure() {
	local myfeatures=(
		bin
		tract
		transforms
		wav-utils
	)
	local projects=(-p deep_filter)
	if use ladspa; then
		projects+=(-p deep-filter-ladspa)
	fi
	cargo_src_configure "${projects[@]}" --offline --no-default-features --bin deep-filter --lib
}

src_compile() {
	cargo_src_compile
	if use ladspa; then
		patchelf --set-soname libdeep_filter_ladspa.so "$(cargo_target_dir)"/libdeep_filter_ladspa.so
	fi
}

src_install() {
	dobin "$(cargo_target_dir)"/deep-filter
	if use ladspa; then
		dolib.so "$(cargo_target_dir)"/libdeep_filter_ladspa.so

		insinto "/usr/share/${PN}"
		doins -r ladspa/filter-chain-configs
	fi
}