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

# Auto-Generated by pycargoebuild 0.13.3

EAPI=8

CRATES="
	adler2@2.0.0
	aho-corasick@1.1.3
	anyhow@1.0.87
	ashpd@0.9.1
	async-broadcast@0.7.1
	async-channel@2.3.1
	async-executor@1.13.1
	async-fs@2.1.2
	async-io@2.3.4
	async-lock@3.4.0
	async-net@2.0.0
	async-process@2.2.4
	async-recursion@1.1.1
	async-signal@0.2.10
	async-task@4.7.1
	async-trait@0.1.82
	atomic-waker@1.1.2
	atomic_refcell@0.1.13
	autocfg@1.3.0
	bitflags@1.3.2
	bitflags@2.6.0
	block-buffer@0.10.4
	block@0.1.6
	blocking@1.6.1
	bytemuck@1.18.0
	byteorder@1.5.0
	cairo-rs@0.20.1
	cairo-sys-rs@0.20.0
	cc@1.1.18
	cfg-expr@0.15.8
	cfg-expr@0.16.0
	cfg-if@1.0.0
	cfg_aliases@0.2.1
	color-thief@0.2.2
	concurrent-queue@2.5.0
	cpufeatures@0.2.14
	crc32fast@1.4.2
	crossbeam-utils@0.8.20
	crypto-common@0.1.6
	data-encoding@2.6.0
	dbus@0.6.5
	digest@0.10.7
	either@1.13.0
	endi@1.1.0
	enumflags2@0.7.10
	enumflags2_derive@0.7.10
	env_logger@0.10.2
	equivalent@1.0.1
	errno@0.3.9
	event-listener-strategy@0.5.2
	event-listener@5.3.1
	fastrand@2.1.1
	field-offset@0.3.6
	flate2@1.0.33
	form_urlencoded@1.2.1
	futures-channel@0.3.30
	futures-core@0.3.30
	futures-executor@0.3.30
	futures-io@0.3.30
	futures-lite@2.3.0
	futures-macro@0.3.30
	futures-sink@0.3.30
	futures-task@0.3.30
	futures-util@0.3.30
	futures@0.3.30
	fuzzy-matcher@0.3.7
	gdk-pixbuf-sys@0.20.1
	gdk-pixbuf@0.20.1
	gdk4-sys@0.9.0
	gdk4-wayland-sys@0.9.0
	gdk4-wayland@0.9.1
	gdk4-x11-sys@0.9.0
	gdk4-x11@0.9.0
	gdk4@0.9.0
	generic-array@0.14.7
	getrandom@0.2.15
	gettext-rs@0.7.1
	gettext-sys@0.21.4
	gio-sys@0.20.1
	gio@0.20.1
	glib-macros@0.15.13
	glib-macros@0.20.3
	glib-sys@0.15.10
	glib-sys@0.20.2
	glib@0.15.12
	glib@0.20.3
	gobject-sys@0.15.10
	gobject-sys@0.20.1
	graphene-rs@0.20.1
	graphene-sys@0.20.1
	gsk4-sys@0.9.0
	gsk4@0.9.0
	gstreamer-audio-sys@0.23.0
	gstreamer-audio@0.23.0
	gstreamer-base-sys@0.23.0
	gstreamer-base@0.23.1
	gstreamer-player-sys@0.23.0
	gstreamer-player@0.23.0
	gstreamer-sys@0.23.0
	gstreamer-video-sys@0.23.0
	gstreamer-video@0.23.0
	gstreamer@0.23.1
	gtk4-macros@0.9.1
	gtk4-sys@0.9.0
	gtk4@0.9.1
	hashbrown@0.14.5
	heck@0.4.1
	heck@0.5.0
	hermit-abi@0.4.0
	hex@0.4.3
	humantime@2.1.0
	idna@0.5.0
	indexmap@2.5.0
	is-terminal@0.4.13
	itertools@0.13.0
	itoa@1.0.11
	lazy_static@1.5.0
	libadwaita-sys@0.7.0
	libadwaita@0.7.0
	libc@0.2.158
	libdbus-sys@0.2.5
	linux-raw-sys@0.4.14
	locale_config@0.3.0
	lofty@0.21.1
	lofty_attr@0.11.0
	log@0.4.22
	malloc_buf@0.0.6
	memchr@2.7.4
	memoffset@0.9.1
	miniz_oxide@0.8.0
	mpris-player@0.6.3
	muldiv@1.0.1
	nix@0.29.0
	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
	ogg_pager@0.6.1
	once_cell@1.19.0
	option-operations@0.5.0
	ordered-stream@0.2.0
	pango-sys@0.20.1
	pango@0.20.1
	parking@2.2.1
	paste@1.0.15
	percent-encoding@2.3.1
	pin-project-lite@0.2.14
	pin-utils@0.1.0
	piper@0.2.4
	pkg-config@0.3.30
	polling@3.7.3
	ppv-lite86@0.2.20
	pretty_env_logger@0.5.0
	proc-macro-crate@1.3.1
	proc-macro-crate@3.2.0
	proc-macro-error-attr@1.0.4
	proc-macro-error@1.0.4
	proc-macro2@1.0.86
	quote@1.0.37
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	regex-automata@0.4.7
	regex-syntax@0.8.4
	regex@1.10.6
	rgb@0.8.50
	rustc_version@0.4.1
	rustix@0.38.36
	ryu@1.0.18
	semver@1.0.23
	serde@1.0.210
	serde_derive@1.0.210
	serde_json@1.0.128
	serde_repr@0.1.19
	serde_spanned@0.6.7
	sha1@0.10.6
	sha2@0.10.8
	shlex@1.3.0
	signal-hook-registry@1.4.2
	slab@0.4.9
	smallvec@1.13.2
	static_assertions@1.1.0
	syn@1.0.109
	syn@2.0.77
	system-deps@6.2.2
	system-deps@7.0.2
	target-lexicon@0.12.16
	temp-dir@0.1.13
	tempfile@3.12.0
	termcolor@1.4.1
	thiserror-impl@1.0.63
	thiserror@1.0.63
	thread_local@1.1.8
	tinyvec@1.8.0
	tinyvec_macros@0.1.1
	toml@0.8.19
	toml_datetime@0.6.8
	toml_edit@0.19.15
	toml_edit@0.22.20
	tracing-attributes@0.1.27
	tracing-core@0.1.32
	tracing@0.1.40
	typenum@1.17.0
	uds_windows@1.1.0
	unicode-bidi@0.3.15
	unicode-ident@1.0.12
	unicode-normalization@0.1.23
	url@2.5.2
	version-compare@0.2.0
	version_check@0.9.5
	wasi@0.11.0+wasi-snapshot-preview1
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.9
	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.5.40
	winnow@0.6.18
	xdg-home@1.3.0
	zbus@4.4.0
	zbus_macros@4.4.0
	zbus_names@3.0.0
	zerocopy-derive@0.7.35
	zerocopy@0.7.35
	zvariant@4.2.0
	zvariant_derive@4.2.0
	zvariant_utils@2.1.0
"

inherit cargo gnome2-utils meson xdg

DESCRIPTION="Simple GUI Music Player"
HOMEPAGE="https://gitlab.gnome.org/World/amberol"
SRC_URI="
	https://gitlab.gnome.org/World/amberol/-/archive/${PV}/${P}.tar.bz2
	${CARGO_CRATE_URIS}
"

#S="${WORKDIR}"/${PN}-main-${COMMIT}

LICENSE="GPL-3+ CC0-1.0 CC-BY-SA-3.0"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions GPL-3+ MIT
	Unicode-DFS-2016
"
SLOT="0"
KEYWORDS="~amd64"

COMMON_DEPEND="
	>=dev-libs/glib-2.66:2
	>=gui-libs/libadwaita-1.5:1
	>=gui-libs/gtk-4.13.4:4[wayland,X]
	>=media-libs/graphene-1.10[introspection]
	>=media-libs/gstreamer-1.20:1.0
	>=media-libs/gst-plugins-base-1.20:1.0
	>=media-libs/gst-plugins-bad-1.20:1.0
	>=sys-apps/dbus-1.6
	>=x11-libs/cairo-1.14[glib]
	>=x11-libs/gdk-pixbuf-2.42:2
	>=x11-libs/pango-1.50
"
RDEPEND="
	${COMMON_DEPEND}
	media-plugins/gst-plugins-meta:1.0
"
DEPEND="${COMMON_DEPEND}"
BDEPEND="virtual/pkgconfig"

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

src_prepare() {
	# upstream erroneously installs to /usr/share/appdata
	sed -i 's/appdata/metainfo/g' data/meson.build || die
	mv data/io.bassi.Amberol.{appdata,metainfo}.xml.in.in || die
	default
}

src_compile () {
	# upstream redefines CARGO_HOME, point to eclass defined
	ln -s "${WORKDIR}"/cargo_home "${BUILD_DIR}"/cargo-home || die
	meson_src_compile
}

src_test() {
	meson_src_test
	cargo_src_test
}

pkg_postinst() {
	xdg_pkg_postinst
	gnome2_schemas_update
	elog "Configure media-plugins/gst-plugins-meta to support your audio"
	elog "backend and codecs of choice"
}

pkg_postrm() {
	xdg_pkg_postrm
	gnome2_schemas_update
}