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

EAPI=8

CRATES="
	Inflector@0.11.4
	aho-corasick@1.1.3
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anyhow@1.0.89
	async-broadcast@0.7.1
	async-channel@1.9.0
	async-channel@2.3.1
	async-executor@1.13.1
	async-fs@2.1.2
	async-global-executor@2.4.1
	async-io@1.13.0
	async-io@2.3.4
	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.1
	async-std@1.13.0
	async-task@4.7.1
	async-trait@0.1.83
	atomic-waker@1.1.2
	atomic_refcell@0.1.13
	autocfg@1.4.0
	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.18.0
	byteorder@1.5.0
	bytes@1.7.2
	cacache@13.0.0
	cairo-rs@0.20.1
	cairo-sys-rs@0.20.0
	cast-sender@0.2.0
	castaway@0.1.2
	cc@1.1.28
	cfg-expr@0.17.0
	cfg-if@1.0.0
	cfg_aliases@0.2.1
	chrono@0.4.38
	concurrent-queue@2.5.0
	core-foundation-sys@0.8.7
	core-foundation@0.9.4
	cpufeatures@0.2.14
	crossbeam-utils@0.8.20
	crypto-common@0.1.6
	curl-sys@0.4.77+curl-8.10.1
	curl@0.4.47
	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.1
	derive_builder_core@0.20.1
	derive_builder_macro@0.20.1
	diesel@2.2.4
	diesel_derives@2.2.3
	diesel_migrations@2.2.0
	diesel_table_macro_syntax@0.2.0
	digest@0.10.7
	dlib@0.5.2
	dsl_auto_type@0.1.2
	dunce@1.0.5
	either@1.13.0
	encoding_rs@0.8.34
	endi@1.1.0
	enum-as-inner@0.6.1
	enumflags2@0.7.10
	enumflags2_derive@0.7.10
	env_filter@0.1.2
	env_logger@0.10.2
	env_logger@0.11.5
	equivalent@1.0.1
	errno@0.3.9
	event-listener-strategy@0.5.2
	event-listener@2.5.3
	event-listener@5.3.1
	fastrand@1.9.0
	fastrand@2.1.1
	field-offset@0.3.6
	flume@0.11.0
	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.3.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.4
	gdk-pixbuf@0.20.4
	gdk4-sys@0.9.2
	gdk4@0.9.2
	generic-array@0.14.7
	getrandom@0.2.15
	gettext-rs@0.7.1
	gettext-sys@0.21.4
	gio-sys@0.20.4
	gio@0.20.4
	glib-macros@0.20.4
	glib-sys@0.20.4
	glib@0.20.4
	gloo-timers@0.3.0
	glycin-utils@2.0.0
	glycin@2.0.1
	gobject-sys@0.20.4
	graphene-rs@0.20.4
	graphene-sys@0.20.4
	gsk4-sys@0.9.2
	gsk4@0.9.2
	gstreamer-audio-sys@0.23.2
	gstreamer-audio@0.23.2
	gstreamer-base-sys@0.23.2
	gstreamer-base@0.23.2
	gstreamer-sys@0.23.2
	gstreamer@0.23.2
	gtk4-macros@0.9.1
	gtk4-sys@0.9.2
	gtk4@0.9.2
	gufo-common@0.1.3
	gufo-exif@0.1.3
	hashbrown@0.12.3
	hashbrown@0.15.0
	heck@0.5.0
	hermit-abi@0.3.9
	hermit-abi@0.4.0
	hex@0.4.3
	hickory-proto@0.24.1
	hickory-resolver@0.24.1
	hostname@0.3.1
	http@0.2.12
	humantime@2.1.0
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.61
	ident_case@1.0.1
	idna@0.4.0
	idna@0.5.0
	if-addrs@0.13.3
	indexmap@1.9.3
	indexmap@2.6.0
	instant@0.1.13
	io-lifetimes@1.0.11
	ipconfig@0.3.2
	ipnet@2.10.1
	is-terminal@0.4.13
	isahc@1.7.2
	itertools@0.13.0
	itoa@1.0.11
	jobserver@0.1.32
	js-sys@0.3.70
	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.0
	libadwaita@0.7.0
	libc@0.2.159
	libloading@0.8.5
	libnghttp2-sys@0.1.10+1.61.0
	libseccomp-sys@0.2.1
	libseccomp@0.3.0
	libshumate-sys@0.6.0
	libshumate@0.6.0
	libsqlite3-sys@0.30.1
	libz-sys@1.1.20
	linked-hash-map@0.5.6
	linux-raw-sys@0.3.8
	linux-raw-sys@0.4.14
	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.11.5
	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
	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
	once_cell@1.20.2
	openssl-macros@0.1.1
	openssl-probe@0.1.5
	openssl-sys@0.9.103
	openssl@0.10.66
	option-operations@0.5.0
	ordered-stream@0.2.0
	pango-sys@0.20.4
	pango@0.20.4
	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-internal@1.1.6
	pin-project-lite@0.1.12
	pin-project-lite@0.2.14
	pin-project@1.1.6
	pin-utils@0.1.0
	piper@0.2.4
	pkg-config@0.3.31
	polling@2.8.0
	polling@3.7.3
	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.87
	prost-derive@0.13.3
	prost@0.13.3
	quick-error@1.2.3
	quote@1.0.37
	r2d2@0.8.10
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	redox_syscall@0.5.7
	reflink-copy@0.1.19
	regex-automata@0.4.8
	regex-syntax@0.8.5
	regex@1.11.0
	resolv-conf@0.7.0
	rmp-serde@1.3.0
	rmp@0.8.14
	rustc_version@0.4.1
	rustix@0.37.27
	rustix@0.38.37
	rustversion@1.0.17
	ryu@1.0.18
	same-file@1.0.6
	sanitize-filename@0.5.0
	schannel@0.1.26
	scheduled-thread-pool@0.2.7
	scopeguard@1.2.0
	security-framework-sys@2.12.0
	security-framework@2.11.1
	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.8
	serde_urlencoded@0.7.1
	serde_with@3.11.0
	serde_with_macros@3.11.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
	sluice@0.5.5
	smallvec@1.13.2
	smol-timeout@0.6.0
	smol@2.0.2
	socket2@0.4.10
	socket2@0.5.7
	spin@0.9.8
	ssri@9.2.0
	static_assertions@1.1.0
	strsim@0.11.1
	strum@0.26.3
	strum_macros@0.26.4
	syn@2.0.79
	sys-locale@0.3.1
	system-deps@7.0.3
	target-lexicon@0.12.16
	temp-dir@0.1.14
	tempfile@3.13.0
	termcolor@1.4.1
	thiserror-impl@1.0.64
	thiserror@1.0.64
	time-core@0.1.2
	time-macros@0.2.18
	time@0.3.36
	tinyvec@1.8.0
	tinyvec_macros@0.1.1
	toml@0.8.19
	toml_datetime@0.6.8
	toml_edit@0.22.22
	tracing-attributes@0.1.27
	tracing-core@0.1.32
	tracing-futures@0.2.5
	tracing@0.1.40
	trait-variant@0.1.2
	typenum@1.17.0
	uds_windows@1.1.0
	unicode-bidi@0.3.17
	unicode-ident@1.0.13
	unicode-normalization@0.1.24
	unicode-width@0.1.14
	url@2.5.2
	uuid@1.10.0
	value-bag@1.9.0
	vcpkg@0.2.15
	version-compare@0.2.0
	version_check@0.9.5
	waker-fn@1.2.0
	walkdir@2.5.0
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.93
	wasm-bindgen-futures@0.4.43
	wasm-bindgen-macro-support@0.2.93
	wasm-bindgen-macro@0.2.93
	wasm-bindgen-shared@0.2.93
	wasm-bindgen@0.2.93
	web-sys@0.3.70
	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-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.20
	winreg@0.50.0
	xdg-home@1.3.0
	xxhash-rust@0.8.12
	yeslogic-fontconfig-sys@6.0.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 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-DFS-2016
"
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.5.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() {
	cargo_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
}