PORTNAME=	pwvucontrol
DISTVERSION=	0.5.3
PORTREVISION=	1
CATEGORIES=	audio

MAINTAINER=	cashmere@autistici.org
COMMENT=	GTK4 volume control applet for PipeWire
WWW=		https://github.com/saivert/pwvucontrol

LICENSE=	GPLv3
LICENSE_FILE=	${WRKSRC}/COPYING

BUILD_DEPENDS=	blueprint-compiler:devel/blueprint-compiler
LIB_DEPENDS=	libpipewire-0.3.so:multimedia/pipewire \
		libwireplumber-0.5.so:multimedia/wireplumber

USES=		cargo gettext gnome llvm localbase:ldflags meson pkgconfig
USE_GITHUB=	yes
GH_ACCOUNT=	saivert
# wireplumber crate is a git dependency (see post-patch): fetch the pinned
# commit and point Cargo.toml at it as a path dependency
GH_TUPLE=	saivert:wireplumber.rs:04fbbc6ea157cdd7061f6a5f2a6b22e102fccbcc:wireplumber/wireplumber.rs
USE_GNOME=	glib20 gtk40 libadwaita

CARGO_BUILD=	no
CARGO_INSTALL=	no
CARGO_TEST=	no
MAKE_ENV=	${CARGO_ENV}

CARGO_CRATES=	aho-corasick-1.1.4 \
		annotate-snippets-0.11.5 \
		anstyle-1.0.14 \
		anyhow-1.0.103 \
		autocfg-1.5.1 \
		bindgen-0.72.1 \
		bitflags-2.13.0 \
		bitmaps-3.2.1 \
		block-0.1.6 \
		cairo-rs-0.21.5 \
		cairo-sys-rs-0.21.5 \
		cc-1.2.66 \
		cexpr-0.6.0 \
		cfg-expr-0.15.8 \
		cfg-expr-0.20.8 \
		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.16.0 \
		equivalent-1.0.2 \
		field-offset-0.3.6 \
		find-msvc-tools-0.1.9 \
		formatx-0.2.4 \
		futures-0.3.32 \
		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 \
		gdk-pixbuf-0.21.5 \
		gdk-pixbuf-sys-0.21.5 \
		gdk4-0.10.3 \
		gdk4-sys-0.10.3 \
		gettext-rs-0.7.7 \
		gettext-sys-0.26.0 \
		gio-0.21.5 \
		gio-sys-0.21.5 \
		glib-0.21.5 \
		glib-macros-0.21.5 \
		glib-sys-0.21.5 \
		glob-0.3.3 \
		gobject-sys-0.21.5 \
		graphene-rs-0.21.5 \
		graphene-sys-0.21.5 \
		gsk4-0.10.3 \
		gsk4-sys-0.10.3 \
		gtk4-0.10.3 \
		gtk4-macros-0.10.3 \
		gtk4-sys-0.10.3 \
		hashbrown-0.17.1 \
		heck-0.5.0 \
		imbl-3.0.0 \
		imbl-sized-chunks-0.1.3 \
		indexmap-2.14.0 \
		itertools-0.13.0 \
		lazy_static-1.5.0 \
		libadwaita-0.8.1 \
		libadwaita-sys-0.8.1 \
		libc-0.2.186 \
		libloading-0.8.9 \
		libspa-0.9.2 \
		libspa-sys-0.9.2 \
		locale_config-0.3.0 \
		log-0.4.33 \
		malloc_buf-0.0.6 \
		memchr-2.8.3 \
		memoffset-0.9.1 \
		minimal-lexical-0.2.1 \
		nix-0.30.1 \
		nom-7.1.3 \
		nom-8.0.0 \
		objc-0.2.7 \
		objc-foundation-0.1.1 \
		objc_id-0.1.1 \
		once_cell-1.21.4 \
		pango-0.21.5 \
		pango-sys-0.21.5 \
		pin-project-lite-0.2.17 \
		pipewire-0.9.2 \
		pipewire-sys-0.9.2 \
		pkg-config-0.3.33 \
		proc-macro-crate-3.5.0 \
		proc-macro2-1.0.106 \
		quote-1.0.46 \
		rand_core-0.6.4 \
		rand_xoshiro-0.6.0 \
		regex-1.12.4 \
		regex-automata-0.4.14 \
		regex-syntax-0.8.11 \
		rustc-hash-2.1.3 \
		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 \
		shlex-2.0.1 \
		slab-0.4.12 \
		smallvec-1.15.2 \
		syn-2.0.118 \
		system-deps-6.2.2 \
		system-deps-7.0.8 \
		target-lexicon-0.12.16 \
		target-lexicon-0.13.5 \
		temp-dir-0.1.16 \
		thiserror-2.0.18 \
		thiserror-impl-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.12+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.3 \
		unicode-width-0.2.2 \
		version-compare-0.2.1 \
		version_check-0.9.5 \
		winapi-0.3.9 \
		winapi-i686-pc-windows-gnu-0.4.0 \
		winapi-x86_64-pc-windows-gnu-0.4.0 \
		windows-link-0.2.1 \
		windows-sys-0.61.2 \
		winnow-0.7.15 \
		winnow-1.0.3

post-patch:
# clang-sys: use the llvm-config from devel/llvm (same fix as multimedia/helvum)
	@${REINPLACE_CMD} -e 's,"llvm-config,"${LLVM_CONFIG},' \
		${WRKSRC_crate_clang-sys}/build/common.rs \
		${WRKSRC_crate_clang-sys}/src/support.rs
# turn the wireplumber git dependency into a path dependency (GH_TUPLE above)
	@${REINPLACE_CMD} -e 's|^git = "https://github.com/saivert/wireplumber.rs.git"|path = "wireplumber.rs"|' \
		-e '/^branch = "wp-0.5-glib-0.21-pipewire-0.9"$$/d' ${WRKSRC}/Cargo.toml
	@${REINPLACE_CMD} -e '/^source = "git+https:\/\/github.com\/saivert\/wireplumber.rs.git/d' \
		${WRKSRC}/Cargo.lock
# do not override CARGO_HOME: the ports framework's vendor config lives there
	@${REINPLACE_CMD} -e "/'CARGO_HOME='/d" ${WRKSRC}/src/meson.build
# caches are rebuilt by pkg triggers on the target system, not staged
	@${REINPLACE_CMD} -e 's/: true,$$/: false,/' ${WRKSRC}/meson.build

.include <bsd.port.mk>
