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

# Autogenerated by pycargoebuild 0.15.1

EAPI=8

BLUEPRINT_COMPILER_VER="0.20.4"

CRATES="
	aho-corasick@1.1.4
	annotate-snippets@0.11.5
	anstyle@1.0.14
	anyhow@1.0.102
	autocfg@1.5.0
	bindgen@0.72.1
	bitflags@2.11.1
	bitmaps@3.2.1
	block@0.1.6
	cairo-rs@0.21.5
	cairo-sys-rs@0.21.5
	cc@1.2.61
	cexpr@0.6.0
	cfg-expr@0.15.8
	cfg-expr@0.20.7
	cfg-if@1.0.4
	cfg_aliases@0.2.1
	clang-sys@1.8.1
	convert_case@0.8.0
	cookie-factory@0.3.3
	either@1.15.0
	equivalent@1.0.2
	field-offset@0.3.6
	find-msvc-tools@0.1.9
	formatx@0.2.4
	futures-channel@0.3.32
	futures-core@0.3.32
	futures-executor@0.3.32
	futures-io@0.3.32
	futures-macro@0.3.32
	futures-sink@0.3.32
	futures-task@0.3.32
	futures-util@0.3.32
	futures@0.3.32
	gdk-pixbuf-sys@0.21.5
	gdk-pixbuf@0.21.5
	gdk4-sys@0.10.3
	gdk4@0.10.3
	gettext-rs@0.7.7
	gettext-sys@0.26.0
	gio-sys@0.21.5
	gio@0.21.5
	glib-macros@0.21.5
	glib-sys@0.21.5
	glib@0.21.5
	glob@0.3.3
	gobject-sys@0.21.5
	graphene-rs@0.21.5
	graphene-sys@0.21.5
	gsk4-sys@0.10.3
	gsk4@0.10.3
	gtk4-macros@0.10.3
	gtk4-sys@0.10.3
	gtk4@0.10.3
	hashbrown@0.17.0
	heck@0.5.0
	imbl-sized-chunks@0.1.3
	imbl@3.0.0
	indexmap@2.14.0
	itertools@0.13.0
	lazy_static@1.5.0
	libadwaita-sys@0.8.1
	libadwaita@0.8.1
	libc@0.2.186
	libloading@0.8.9
	libspa-sys@0.9.2
	libspa@0.9.2
	locale_config@0.3.0
	log@0.4.29
	malloc_buf@0.0.6
	memchr@2.8.0
	memoffset@0.9.1
	minimal-lexical@0.2.1
	nix@0.30.1
	nom@7.1.3
	nom@8.0.0
	objc-foundation@0.1.1
	objc@0.2.7
	objc_id@0.1.1
	once_cell@1.21.4
	pango-sys@0.21.5
	pango@0.21.5
	pin-project-lite@0.2.17
	pipewire-sys@0.9.2
	pipewire@0.9.2
	pkg-config@0.3.33
	proc-macro-crate@3.5.0
	proc-macro2@1.0.106
	quote@1.0.45
	rand_core@0.6.4
	rand_xoshiro@0.6.0
	regex-automata@0.4.14
	regex-syntax@0.8.10
	regex@1.12.3
	rustc-hash@2.1.2
	rustc_version@0.4.1
	semver@1.0.28
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_spanned@0.6.9
	serde_spanned@1.1.1
	shlex@1.3.0
	slab@0.4.12
	smallvec@1.15.1
	syn@2.0.117
	system-deps@6.2.2
	system-deps@7.0.8
	target-lexicon@0.12.16
	target-lexicon@0.13.3
	temp-dir@0.1.16
	thiserror-impl@2.0.18
	thiserror@2.0.18
	toml@0.8.23
	toml@1.1.2+spec-1.1.0
	toml_datetime@0.6.11
	toml_datetime@1.1.1+spec-1.1.0
	toml_edit@0.22.27
	toml_edit@0.25.11+spec-1.1.0
	toml_parser@1.1.2+spec-1.1.0
	toml_writer@1.1.1+spec-1.1.0
	unicode-ident@1.0.24
	unicode-segmentation@1.13.2
	unicode-width@0.2.2
	version-compare@0.2.1
	version_check@0.9.5
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-link@0.2.1
	windows-sys@0.61.2
	winnow@0.7.15
	winnow@1.0.2
"

declare -A GIT_CRATES=(
	[wireplumber-sys]='https://github.com/saivert/wireplumber.rs;04fbbc6ea157cdd7061f6a5f2a6b22e102fccbcc;wireplumber.rs-%commit%/sys'
	[wireplumber]='https://github.com/saivert/wireplumber.rs;04fbbc6ea157cdd7061f6a5f2a6b22e102fccbcc;wireplumber.rs-%commit%'
)

RUST_MIN_VER="1.85.0"

inherit gnome2-utils virtualx cargo meson

DESCRIPTION="Volume control applet for Pipewire"
HOMEPAGE="https://github.com/saivert/pwvucontrol/"
SRC_URI="
	https://github.com/saivert/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"

DEPEND="
	dev-libs/glib:2=
	gui-libs/gtk:4=
	gui-libs/libadwaita:1=
	media-video/pipewire:=
	media-video/wireplumber:=
"
RDEPEND="
	${DEPEND}
"
BDEPEND="
	dev-libs/glib:2
	dev-util/desktop-file-utils
	dev-libs/appstream-glib
	dev-util/blueprint-compiler
	dev-util/gtk-update-icon-cache
	sys-devel/gettext
"

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

PATCHES=(
	"${FILESDIR}/${PN}-0.5.2-audiovideo-category.patch"
)

src_prepare() {
	default

	# this hackery is copied from games-strategy/naev
	# meson.build overrides CARGO_HOME, symlink to use our config.toml
	# # (note need to set BUILD_DIR either way due to cargo_env's subshell)
	BUILD_DIR=${WORKDIR}/${P}-build
	mkdir -p -- "${BUILD_DIR}" || die
	ln -s -- "${CARGO_HOME}" "${BUILD_DIR}"/cargo-home || die
}

src_configure() {
	local emesonargs=(
		-Dprofile=default
	)
	cargo_env meson_src_configure
}

src_compile() {
	cargo_env meson_src_compile
}

src_test() {
	cargo_env virtx meson_src_test
}

src_install() {
	cargo_env meson_src_install
}

pkg_postinst() {
	gnome2_schemas_update
}

pkg_postrm() {
	gnome2_schemas_update
}
