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

# Autogenerated by pycargoebuild 0.13.5

EAPI=8

CRATES="
	addr2line@0.24.2
	adler2@2.0.0
	aho-corasick@1.1.3
	aligned-vec@0.5.0
	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
	arg_enum_proc_macro@0.3.4
	arrayvec@0.7.6
	async-compression@0.4.18
	atomic-wait@1.1.0
	atomic-waker@1.1.2
	autocfg@1.4.0
	av1-grain@0.2.3
	avif-serialize@0.8.2
	backtrace@0.3.74
	base64@0.22.1
	bit_field@0.10.2
	bitflags@1.3.2
	bitflags@2.8.0
	bitstream-io@2.6.0
	block@0.1.6
	built@0.7.7
	bumpalo@3.17.0
	bytefmt@0.1.7
	bytemuck@1.21.0
	byteorder-lite@0.1.0
	byteorder@1.5.0
	bytes@1.10.0
	cairo-rs@0.20.7
	cairo-sys-rs@0.20.7
	cc@1.2.14
	cfg-expr@0.15.8
	cfg-expr@0.17.2
	cfg-if@1.0.0
	cfg_aliases@0.2.1
	chrono@0.4.40
	clap@4.5.32
	clap_builder@4.5.32
	clap_derive@4.5.32
	clap_lex@0.7.4
	color_quant@1.1.0
	colorchoice@1.0.3
	core-foundation-sys@0.8.7
	core-foundation@0.10.0
	crc32fast@1.4.2
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.21
	crunchy@0.2.3
	darling@0.20.10
	darling_core@0.20.10
	darling_macro@0.20.10
	derive_builder@0.20.2
	derive_builder_core@0.20.2
	derive_builder_macro@0.20.2
	dirs-sys@0.5.0
	dirs@6.0.0
	displaydoc@0.2.5
	either@1.13.0
	embed-resource@3.0.2
	epoxy@0.1.0
	equivalent@1.0.2
	errno@0.3.10
	exr@1.73.0
	fdeflate@0.3.7
	field-offset@0.3.6
	flate2@1.0.35
	flume@0.11.1
	fnv@1.0.7
	form_urlencoded@1.2.1
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-util@0.3.31
	gdk-pixbuf-sys@0.20.7
	gdk-pixbuf@0.20.9
	gdk4-sys@0.9.6
	gdk4-win32-sys@0.9.5
	gdk4-win32@0.9.5
	gdk4-x11-sys@0.9.6
	gdk4-x11@0.9.6
	gdk4@0.9.6
	getrandom@0.2.15
	getrandom@0.3.1
	gettext-rs@0.7.2
	gettext-sys@0.22.5
	gif@0.13.1
	gimli@0.31.1
	gio-sys@0.20.9
	gio@0.20.9
	gl@0.14.0
	gl_generator@0.14.0
	gl_generator@0.9.0
	glib-build-tools@0.20.0
	glib-macros@0.20.7
	glib-sys@0.20.9
	glib@0.20.9
	gobject-sys@0.20.9
	graphene-rs@0.20.9
	graphene-sys@0.20.7
	gsk4-sys@0.9.6
	gsk4@0.9.6
	gstreamer-sys@0.23.4
	gstreamer@0.23.4
	gtk4-macros@0.9.5
	gtk4-sys@0.9.6
	gtk4@0.9.6
	h2@0.4.7
	half@2.4.1
	hashbrown@0.15.2
	heck@0.5.0
	hostname@0.4.0
	http-body-util@0.1.2
	http-body@1.0.1
	http@1.2.0
	httparse@1.10.0
	hyper-rustls@0.27.5
	hyper-util@0.1.10
	hyper@1.6.0
	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
	image-webp@0.2.1
	image@0.25.5
	imgref@1.11.0
	indexmap@2.7.1
	interpolate_name@0.2.4
	ipnet@2.11.0
	is_terminal_polyfill@1.70.1
	itertools@0.12.1
	itertools@0.13.0
	itoa@1.0.14
	jobserver@0.1.32
	jpeg-decoder@0.3.1
	js-sys@0.3.77
	khronos_api@2.2.0
	khronos_api@3.1.0
	lazy_static@1.5.0
	lebe@0.5.2
	libadwaita-sys@0.7.1
	libadwaita@0.7.1
	libc@0.2.171
	libfuzzer-sys@0.4.9
	libloading@0.8.6
	libmpv2-sys@4.0.0
	libmpv2@4.1.0
	libproxy@0.1.1
	libredox@0.1.3
	linux-raw-sys@0.9.3
	litemap@0.7.4
	locale_config@0.3.0
	lock_api@0.4.12
	log@0.4.25
	loop9@0.1.5
	malloc_buf@0.0.6
	maybe-rayon@0.1.1
	memchr@2.7.4
	memoffset@0.9.1
	mime@0.3.17
	minimal-lexical@0.2.1
	miniz_oxide@0.8.4
	mio@1.0.3
	muldiv@1.0.1
	nanorand@0.7.0
	new_debug_unreachable@1.0.6
	nom@7.1.3
	noop_proc_macro@0.3.0
	nu-ansi-term@0.46.0
	num-bigint@0.4.6
	num-derive@0.4.2
	num-integer@0.1.46
	num-rational@0.4.2
	num-traits@0.2.19
	objc-foundation@0.1.1
	objc@0.2.7
	objc_id@0.1.1
	object@0.36.7
	once_cell@1.21.0
	openssl-probe@0.1.6
	option-ext@0.2.0
	option-operations@0.5.0
	overload@0.1.1
	pango-sys@0.20.9
	pango@0.20.9
	parking_lot@0.12.3
	parking_lot_core@0.9.10
	paste@1.0.15
	percent-encoding@2.3.1
	pin-project-lite@0.2.16
	pin-utils@0.1.0
	pkg-config@0.3.31
	png@0.17.16
	ppv-lite86@0.2.20
	proc-macro-crate@3.2.0
	proc-macro2@1.0.93
	profiling-procmacros@1.0.16
	profiling@1.0.16
	qoi@0.4.1
	quick-error@2.0.1
	quinn-proto@0.11.9
	quinn-udp@0.5.10
	quinn@0.11.6
	quote@1.0.38
	rand@0.8.5
	rand@0.9.0
	rand_chacha@0.3.1
	rand_chacha@0.9.0
	rand_core@0.6.4
	rand_core@0.9.1
	rav1e@0.7.1
	ravif@0.11.11
	rayon-core@1.12.1
	rayon@1.10.0
	redox_syscall@0.5.8
	redox_users@0.5.0
	regex-automata@0.4.9
	regex-syntax@0.8.5
	regex@1.11.1
	reqwest@0.12.12
	rgb@0.8.50
	ring@0.17.9
	rustc-demangle@0.1.24
	rustc-hash@2.1.1
	rustc_version@0.4.1
	rustix@1.0.2
	rustls-native-certs@0.8.1
	rustls-pemfile@2.2.0
	rustls-pki-types@1.11.0
	rustls-webpki@0.102.8
	rustls@0.23.23
	rustversion@1.0.19
	ryu@1.0.19
	schannel@0.1.27
	scopeguard@1.2.0
	security-framework-sys@2.14.0
	security-framework@3.2.0
	semver@1.0.25
	serde@1.0.219
	serde_derive@1.0.219
	serde_json@1.0.138
	serde_spanned@0.6.8
	serde_urlencoded@0.7.1
	sharded-slab@0.1.7
	shared_library@0.1.9
	shlex@1.3.0
	signal-hook-registry@1.4.2
	simd-adler32@0.3.7
	simd_helpers@0.1.0
	slab@0.4.9
	smallvec@1.14.0
	socket2@0.5.8
	spin@0.9.8
	stable_deref_trait@1.2.0
	strsim@0.11.1
	subtle@2.6.1
	syn@2.0.98
	sync_wrapper@1.0.2
	synstructure@0.13.1
	system-deps@6.2.2
	system-deps@7.0.3
	target-lexicon@0.12.16
	temp-dir@0.1.14
	thiserror-impl@1.0.69
	thiserror-impl@2.0.11
	thiserror@1.0.69
	thiserror@2.0.11
	thread_local@1.1.8
	tiff@0.9.1
	tinystr@0.7.6
	tinyvec@1.8.1
	tinyvec_macros@0.1.1
	tokio-macros@2.5.0
	tokio-rustls@0.26.1
	tokio-util@0.7.13
	tokio@1.44.1
	toml@0.8.20
	toml_datetime@0.6.8
	toml_edit@0.22.24
	tower-layer@0.3.3
	tower-service@0.3.3
	tower@0.5.2
	tracing-attributes@0.1.28
	tracing-core@0.1.33
	tracing-log@0.2.0
	tracing-subscriber@0.3.19
	tracing@0.1.41
	try-lock@0.2.5
	unicode-ident@1.0.16
	untrusted@0.9.0
	url@2.5.4
	utf16_iter@1.0.5
	utf8_iter@1.0.4
	utf8parse@0.2.2
	uuid@1.15.1
	v_frame@0.3.8
	valuable@0.1.1
	version-compare@0.2.0
	vswhom-sys@0.1.2
	vswhom@0.1.0
	want@0.3.1
	wasi@0.11.0+wasi-snapshot-preview1
	wasi@0.13.3+wasi-0.2.2
	wasm-bindgen-backend@0.2.100
	wasm-bindgen-futures@0.4.50
	wasm-bindgen-macro-support@0.2.100
	wasm-bindgen-macro@0.2.100
	wasm-bindgen-shared@0.2.100
	wasm-bindgen@0.2.100
	web-sys@0.3.77
	web-time@1.1.0
	webpki-roots@0.26.8
	weezl@0.1.8
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-collections@0.1.1
	windows-core@0.52.0
	windows-core@0.60.1
	windows-future@0.1.1
	windows-implement@0.59.0
	windows-interface@0.59.0
	windows-link@0.1.0
	windows-numerics@0.1.1
	windows-registry@0.2.0
	windows-result@0.2.0
	windows-result@0.3.1
	windows-strings@0.1.0
	windows-strings@0.3.1
	windows-sys@0.42.0
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows@0.52.0
	windows@0.60.0
	windows_aarch64_gnullvm@0.42.2
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.42.2
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.42.2
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.42.2
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.42.2
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	winnow@0.7.2
	winreg@0.52.0
	wit-bindgen-rt@0.33.0
	write16@1.0.0
	writeable@0.5.5
	xattr@1.5.0
	xml-rs@0.7.0
	xml-rs@0.8.25
	yoke-derive@0.7.5
	yoke@0.7.5
	zerocopy-derive@0.7.35
	zerocopy-derive@0.8.18
	zerocopy@0.7.35
	zerocopy@0.8.18
	zerofrom-derive@0.1.5
	zerofrom@0.1.5
	zeroize@1.8.1
	zerovec-derive@0.10.3
	zerovec@0.10.4
	zune-core@0.4.12
	zune-inflate@0.2.54
	zune-jpeg@0.4.14
"

LLVM_COMPAT=( 19 )
RUST_MIN_VER="1.85.0"
RUST_NEEDS_LLVM=1
inherit cargo desktop gnome2-utils llvm-r1 toolchain-funcs xdg

DESCRIPTION="A simple Emby Client written by GTK4-RS"
HOMEPAGE="https://github.com/tsukinaha/tsukimi"
SRC_URI="
	https://github.com/tsukinaha/tsukimi/archive/refs/tags/v${PV}.tar.gz
		-> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="GPL-3"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD ISC LGPL-2.1
	MIT MPL-2.0 UoI-NCSA Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

IUSE="clang"

RDEPEND="
	>=gui-libs/gtk-4.14
	>=gui-libs/libadwaita-1.6
	media-libs/gstreamer
	media-video/mpv
"

DEPEND="${RDEPEND}"
BDEPEND="
	clang? (
		$(llvm_gen_dep '
			llvm-core/clang:${LLVM_SLOT}
			llvm-core/llvm:${LLVM_SLOT}
			llvm-core/lld:${LLVM_SLOT}
		')
	)
"

pkg_setup() {
	if use clang && ! tc-is-clang; then
		llvm-r1_pkg_setup
		export CC=clang
		export CXX=clang++
		export AR=llvm-ar
		export NM=llvm-nm
		export STRIP=llvm-strip
		export RANLIB=llvm-ranlib
	fi
	rust_pkg_setup
}

src_prepare() {
	default

	sed -i -e \
		's/^Icon=moe.tsuna.tsukimi/Icon=tsukimi/' \
		"${S}/resources/moe.tsuna.tsukimi.desktop.in" || die
}

src_install() {
	dobin $(cargo_target_dir)/tsukimi
	newicon -s 256 "resources/icons/moe.tsuna.tsukimi.png" "${PN}.png"
	newmenu "resources/moe.tsuna.tsukimi.desktop.in" "${PN}.desktop"
	insinto /usr/share/glib-2.0/schemas
	doins resources/moe.tsuna.tsukimi.gschema.xml
	insinto /usr/share
	doins -r i18n/locale
}

pkg_postinst() {
	xdg_pkg_postinst
	gnome2_schemas_update
}

pkg_postrm() {
	xdg_pkg_postrm
	gnome2_schemas_update
}