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

EAPI=8

inherit meson xdg gnome2-utils vala

DESCRIPTION="A GTK4 music player"
HOMEPAGE="https://gitlab.gnome.org/neithern/g4music"
SRC_URI="https://gitlab.gnome.org/neithern/g4music/-/archive/v${PV}/g4music-v${PV}.tar.bz2"
S="${WORKDIR}/g4music-v${PV}"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"

IUSE="pipewire"

DEPEND="
		>=gui-libs/gtk-4.6
		>=dev-libs/glib-2.78.6
		>=media-libs/graphene-1.10.8-r1
		>=media-libs/gst-plugins-base-1.22.12
		>=x11-libs/gdk-pixbuf-2.42.10-r1
		>=x11-libs/pango-1.52.2
		>=gui-libs/libadwaita-1
		>=media-libs/gstreamer-1.20.6[introspection]
		>=media-plugins/gst-plugins-taglib-1.20.6
		>=dev-libs/appstream-glib-0.8.2
		pipewire? ( media-video/pipewire[gstreamer] )
"
RDEPEND="${DEPEND}"
BDEPEND="
		>=dev-build/meson-1.1.1
		>=dev-lang/vala-0.56.8
		$(vala_depend)
"

src_prepare() {
	default
	vala_setup
	xdg_environment_reset

	sed -i \
		-e '/^gnome.post_install(/,/)/d' \
		meson.build \
		|| die
}

pkg_postinst() {
	xdg_pkg_postinst
	gnome2_schemas_update
}

pkg_postrm() {
	xdg_pkg_postrm
	gnome2_schemas_update
}
