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

EAPI=8

CRATES="
	Inflector@0.11.4
	addr2line@0.24.2
	adler2@2.0.0
	aho-corasick@1.1.3
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anyhow@1.0.95
	ashpd@0.10.2
	async-broadcast@0.7.2
	async-channel@1.9.0
	async-channel@2.3.1
	async-compat@0.2.4
	async-executor@1.13.1
	async-fs@2.1.2
	async-global-executor@2.4.1
	async-io@1.13.0
	async-io@2.4.0
	async-lock@2.8.0
	async-lock@3.4.0
	async-native-tls@0.5.0
	async-net@2.0.0
	async-process@2.3.0
	async-recursion@1.1.1
	async-signal@0.2.10
	async-std-resolver@0.24.2
	async-std@1.13.0
	async-task@4.7.1
	async-trait@0.1.84
	atomic-waker@1.1.2
	atomic_refcell@0.1.13
	autocfg@1.4.0
	backtrace@0.3.74
	base64@0.21.7
	base64@0.22.1
	bitflags@1.3.2
	bitflags@2.6.0
	block-buffer@0.10.4
	block@0.1.6
	blocking@1.6.1
	bumpalo@3.16.0
	bytemuck@1.21.0
	byteorder@1.5.0
	bytes@1.9.0
	cacache@13.1.0
	cairo-rs@0.20.7
	cairo-sys-rs@0.20.7
	cast-sender@0.2.0
	cc@1.2.7
	cfg-expr@0.17.2
	cfg-if@1.0.0
	cfg_aliases@0.2.1
	chrono@0.4.39
	concurrent-queue@2.5.0
	core-foundation-sys@0.8.7
	core-foundation@0.9.4
	cpufeatures@0.2.16
	crossbeam-utils@0.8.21
	crypto-common@0.1.6
	darling@0.20.10
	darling_core@0.20.10
	darling_macro@0.20.10
	data-encoding@2.6.0
	deranged@0.3.11
	derive_builder@0.20.2
	derive_builder_core@0.20.2
	derive_builder_macro@0.20.2
	diesel@2.2.6
	diesel_derives@2.2.3
	diesel_migrations@2.2.0
	diesel_table_macro_syntax@0.2.0
	digest@0.10.7
	displaydoc@0.2.5
	dlib@0.5.2
	dsl_auto_type@0.1.2
	dunce@1.0.5
	either@1.13.0
	encoding_rs@0.8.35
	endi@1.1.0
	enum-as-inner@0.6.1
	enumflags2@0.7.10
	enumflags2_derive@0.7.10
	env_filter@0.1.3
	env_logger@0.10.2
	env_logger@0.11.6
	equivalent@1.0.1
	errno@0.3.10
	event-listener-strategy@0.5.3
	event-listener@2.5.3
	event-listener@5.3.1
	fastrand@1.9.0
	fastrand@2.3.0
	field-offset@0.3.6
	flume@0.11.1
	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
	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-lite@1.13.0
	futures-lite@2.5.0
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-timer@3.0.3
	futures-util@0.3.31
	futures@0.3.31
	gdk-pixbuf-sys@0.20.7
	gdk-pixbuf@0.20.7
	gdk4-sys@0.9.5
	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.5
	generic-array@0.14.7
	getrandom@0.2.15
	gettext-rs@0.7.2
	gettext-sys@0.22.5
	gimli@0.31.1
	gio-sys@0.20.8
	gio@0.20.7
	glib-macros@0.20.7
	glib-sys@0.20.7
	glib@0.20.7
	gloo-timers@0.3.0
	glycin-utils@2.0.2
	glycin@2.0.2
	gobject-sys@0.20.7
	graphene-rs@0.20.7
	graphene-sys@0.20.7
	gsk4-sys@0.9.5
	gsk4@0.9.5
	gstreamer-audio-sys@0.23.4
	gstreamer-audio@0.23.4
	gstreamer-base-sys@0.23.4
	gstreamer-base@0.23.4
	gstreamer-sys@0.23.4
	gstreamer@0.23.4
	gtk4-macros@0.9.5
	gtk4-sys@0.9.5
	gtk4@0.9.5
	gufo-common@0.1.3
	gufo-exif@0.1.3
	h2@0.4.7
	hashbrown@0.12.3
	hashbrown@0.15.2
	heck@0.5.0
	hermit-abi@0.3.9
	hermit-abi@0.4.0
	hex@0.4.3
	hickory-proto@0.24.2
	hickory-resolver@0.24.2
	hostname@0.3.1
	http-body-util@0.1.2
	http-body@1.0.1
	http@1.2.0
	httparse@1.10.0
	humantime@2.1.0
	hyper-rustls@0.27.5
	hyper-tls@0.6.0
	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
	if-addrs@0.13.3
	indexmap@1.9.3
	indexmap@2.7.0
	instant@0.1.13
	io-lifetimes@1.0.11
	ipconfig@0.3.2
	ipnet@2.10.1
	is-terminal@0.4.13
	itertools@0.13.0
	itoa@1.0.14
	jobserver@0.1.32
	js-sys@0.3.76
	kv-log-macro@1.0.7
	language-tags@0.3.2
	lazy_static@1.5.0
	lcms2-sys@4.0.5
	lcms2@6.1.0
	libadwaita-sys@0.7.1
	libadwaita@0.7.1
	libc@0.2.169
	libloading@0.8.6
	libseccomp-sys@0.2.1
	libseccomp@0.3.0
	libshumate-sys@0.6.0
	libshumate@0.6.0
	libsqlite3-sys@0.30.1
	linked-hash-map@0.5.6
	linux-raw-sys@0.3.8
	linux-raw-sys@0.4.14
	litemap@0.7.4
	locale_config@0.3.0
	lock_api@0.4.12
	log@0.4.22
	lru-cache@0.1.2
	malloc_buf@0.0.6
	match_cfg@0.1.0
	mdns-sd@0.13.1
	memchr@2.7.4
	memfd@0.6.4
	memmap2@0.5.10
	memmap2@0.9.5
	memoffset@0.9.1
	miette-derive@5.10.0
	miette@5.10.0
	migrations_internals@2.2.0
	migrations_macros@2.2.0
	mime@0.3.17
	miniz_oxide@0.8.3
	mio@1.0.3
	mpris-server@0.8.1
	muldiv@1.0.1
	native-tls@0.2.12
	nix@0.29.0
	num-conv@0.1.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
	object@0.36.7
	once_cell@1.20.2
	openssl-macros@0.1.1
	openssl-probe@0.1.5
	openssl-sys@0.9.104
	openssl@0.10.68
	option-operations@0.5.0
	ordered-stream@0.2.0
	pango-sys@0.20.7
	pango@0.20.7
	parking@2.2.1
	parking_lot@0.12.3
	parking_lot_core@0.9.10
	paste@1.0.15
	percent-encoding@2.3.1
	pin-project-lite@0.1.12
	pin-project-lite@0.2.15
	pin-utils@0.1.0
	piper@0.2.4
	pkg-config@0.3.31
	polling@2.8.0
	polling@3.7.4
	powerfmt@0.2.0
	ppv-lite86@0.2.20
	pretty_env_logger@0.5.0
	proc-macro-crate@3.2.0
	proc-macro2@1.0.92
	prost-derive@0.13.4
	prost@0.13.4
	quick-error@1.2.3
	quote@1.0.38
	r2d2@0.8.10
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	redox_syscall@0.5.8
	reflink-copy@0.1.20
	regex-automata@0.4.9
	regex-syntax@0.8.5
	regex@1.11.1
	reqwest@0.12.12
	resolv-conf@0.7.0
	ring@0.17.8
	rmp-serde@1.3.0
	rmp@0.8.14
	rustc-demangle@0.1.24
	rustc_version@0.4.1
	rustix@0.37.27
	rustix@0.38.42
	rustls-pemfile@2.2.0
	rustls-pki-types@1.11.0
	rustls-webpki@0.102.8
	rustls@0.23.22
	rustversion@1.0.19
	ryu@1.0.18
	same-file@1.0.6
	sanitize-filename@0.6.0
	schannel@0.1.27
	scheduled-thread-pool@0.2.7
	scopeguard@1.2.0
	security-framework-sys@2.13.0
	security-framework@2.11.1
	semver@1.0.24
	serde@1.0.217
	serde_derive@1.0.217
	serde_json@1.0.134
	serde_repr@0.1.19
	serde_spanned@0.6.8
	serde_urlencoded@0.7.1
	serde_with@3.12.0
	serde_with_macros@3.12.0
	sha-1@0.10.1
	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
	smol-timeout@0.6.0
	smol@2.0.2
	socket2@0.4.10
	socket2@0.5.8
	spin@0.9.8
	ssri@9.2.0
	stable_deref_trait@1.2.0
	static_assertions@1.1.0
	strsim@0.11.1
	strum@0.26.3
	strum_macros@0.26.4
	subtle@2.6.1
	syn@2.0.94
	sync_wrapper@1.0.2
	synstructure@0.13.1
	sys-locale@0.3.2
	system-configuration-sys@0.6.0
	system-configuration@0.6.1
	system-deps@7.0.3
	target-lexicon@0.12.16
	temp-dir@0.1.14
	tempfile@3.15.0
	termcolor@1.4.1
	thiserror-impl@1.0.69
	thiserror-impl@2.0.9
	thiserror@1.0.69
	thiserror@2.0.9
	time-core@0.1.2
	time-macros@0.2.19
	time@0.3.37
	tinystr@0.7.6
	tinyvec@1.8.1
	tinyvec_macros@0.1.1
	tokio-native-tls@0.3.1
	tokio-rustls@0.26.1
	tokio-util@0.7.13
	tokio@1.43.0
	toml@0.8.19
	toml_datetime@0.6.8
	toml_edit@0.22.22
	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@0.1.41
	trait-variant@0.1.2
	try-lock@0.2.5
	typenum@1.17.0
	uds_windows@1.1.0
	unicode-ident@1.0.14
	unicode-width@0.1.14
	untrusted@0.9.0
	url@2.5.4
	utf16_iter@1.0.5
	utf8_iter@1.0.4
	uuid@1.11.0
	value-bag@1.10.0
	vcpkg@0.2.15
	version-compare@0.2.0
	version_check@0.9.5
	waker-fn@1.2.0
	walkdir@2.5.0
	want@0.3.1
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.99
	wasm-bindgen-futures@0.4.49
	wasm-bindgen-macro-support@0.2.99
	wasm-bindgen-macro@0.2.99
	wasm-bindgen-shared@0.2.99
	wasm-bindgen@0.2.99
	web-sys@0.3.76
	widestring@1.1.0
	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-core@0.52.0
	windows-core@0.58.0
	windows-implement@0.58.0
	windows-interface@0.58.0
	windows-registry@0.2.0
	windows-result@0.2.0
	windows-strings@0.1.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.58.0
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	winnow@0.6.21
	winreg@0.50.0
	write16@1.0.0
	writeable@0.5.5
	xdg-home@1.3.0
	xxhash-rust@0.8.15
	yeslogic-fontconfig-sys@6.0.0
	yoke-derive@0.7.5
	yoke@0.7.5
	zbus@4.4.0
	zbus@5.2.0
	zbus_macros@4.4.0
	zbus_macros@5.2.0
	zbus_names@3.0.0
	zbus_names@4.1.0
	zerocopy-derive@0.7.35
	zerocopy@0.7.35
	zerofrom-derive@0.1.5
	zerofrom@0.1.5
	zeroize@1.8.1
	zerovec-derive@0.10.3
	zerovec@0.10.4
	zvariant@4.2.0
	zvariant@5.1.0
	zvariant_derive@4.2.0
	zvariant_derive@5.1.0
	zvariant_utils@2.1.0
	zvariant_utils@3.0.2
"

inherit autotools cargo meson gnome2

DESCRIPTION="Listen to internet radio"
HOMEPAGE="https://gitlab.gnome.org/World/Shortwave"
SRC_URI="
	https://gitlab.gnome.org/World/Shortwave/-/archive/${PV}/${P}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"
KEYWORDS="~amd64"

PATCHES=(
	${FILESDIR}/meson_cargo.patch
)

LICENSE="GPL-3+"
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD Boost-1.0 ISC
	MIT MPL-2.0 Unicode-3.0
"
SLOT="0"

RDEPEND="
	>=dev-db/sqlite-3.20
	>=dev-libs/openssl-1
	>=sys-apps/dbus-1
	>=sys-libs/glibc-2
	>=dev-libs/glib-2.66
	>=gui-libs/gtk-4.16
	>=x11-libs/gdk-pixbuf-2
	>=gui-libs/libadwaita-1.6.0
	>=media-libs/libshumate-1.3.0
	>=media-libs/lcms-2.12
	>=sys-libs/libseccomp-2.5
	>=media-libs/gstreamer-1.16
	>=media-plugins/gst-plugins-meta-1.16[mp3,http,aac,opus]
	>=media-libs/gst-plugins-base-1.16
	>=media-libs/gst-plugins-bad-1.16
	>=media-libs/gst-plugins-good-1.16
"

DEPEND="${RDEPEND}"
BDEPEND=""

pkg_setup() {
	rust_pkg_setup
}

src_unpack() {
	cargo_src_unpack
	default
}

src_prepare() {
	mv `ls -d ${WORKDIR}/Shortwave*`/* ${WORKDIR}/${P}/
	default
}

src_configure() {
	meson_src_configure
}

src_compile() {
	meson_src_compile ${MAKEOPTS}
}

src_install() {
	meson_src_install

	rmdir "${ED}/var/lib" 2>/dev/null
	rmdir "${ED}/var" 2>/dev/null
	rm -fr "${ED}/usr/share/applications/mimeinfo.cache"
}

pkg_preinst() {
	gnome2_pkg_preinst
}
pkg_postinst() {
	gnome2_pkg_postinst
}
pkg_postrm() {
	gnome2_pkg_postrm
}