From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1415375-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 584D7158094
	for <garchives@archives.gentoo.org>; Mon,  4 Jul 2022 21:40:55 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 6EE63E09B1;
	Mon,  4 Jul 2022 21:40:54 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 16DD0E09B1
	for <gentoo-commits@lists.gentoo.org>; Mon,  4 Jul 2022 21:40:54 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id D535B341924
	for <gentoo-commits@lists.gentoo.org>; Mon,  4 Jul 2022 21:40:52 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 2D3414ED
	for <gentoo-commits@lists.gentoo.org>; Mon,  4 Jul 2022 21:40:51 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1656970533.21f12bb743b94242f73cef85ef24fdf6ff703eed.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/pipewire/
X-VCS-Repository: repo/gentoo
X-VCS-Files: media-video/pipewire/metadata.xml media-video/pipewire/pipewire-0.3.53.ebuild
X-VCS-Directories: media-video/pipewire/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 21f12bb743b94242f73cef85ef24fdf6ff703eed
X-VCS-Branch: master
Date: Mon,  4 Jul 2022 21:40:51 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 1230dfe4-fb13-470b-a650-8c1dd0bb750d
X-Archives-Hash: bd8623076c6b1d62c76cb5f32822cf5a

commit:     21f12bb743b94242f73cef85ef24fdf6ff703eed
Author:     Igor V. Kovalenko <igor.v.kovalenko <AT> gmail <DOT> com>
AuthorDate: Sat Jul  2 06:13:11 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul  4 21:35:33 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21f12bb7

media-video/pipewire: Add USE sound-server

Add USE sound-server to enable sound server with alsa and bluetooth devices.
Conditionally enable required wireplumber monitor parts and pipewire-pulse.

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-video/pipewire/metadata.xml           |  1 +
 media-video/pipewire/pipewire-0.3.53.ebuild | 21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/media-video/pipewire/metadata.xml b/media-video/pipewire/metadata.xml
index b7e4f57f5480..08adc4c25b4f 100644
--- a/media-video/pipewire/metadata.xml
+++ b/media-video/pipewire/metadata.xml
@@ -28,5 +28,6 @@
 		<flag name="ssl">Enable raop-sink support (needs <pkg>dev-libs/openssl</pkg>)</flag>
 		<flag name="system-service">Install systemd unit files for running as a system service. Not recommended.</flag>
 		<flag name="X">Enable audible bell for X11</flag>
+		<flag name="sound-server">Provide sound server using ALSA and bluetooth devices</flag>
 	</use>
 </pkgmetadata>

diff --git a/media-video/pipewire/pipewire-0.3.53.ebuild b/media-video/pipewire/pipewire-0.3.53.ebuild
index 9ab78449ccc3..a2f1daf3b80c 100644
--- a/media-video/pipewire/pipewire-0.3.53.ebuild
+++ b/media-video/pipewire/pipewire-0.3.53.ebuild
@@ -28,7 +28,8 @@ HOMEPAGE="https://pipewire.org/"
 LICENSE="MIT LGPL-2.1+ GPL-2"
 # ABI was broken in 0.3.42 for https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/49
 SLOT="0/0.4"
-IUSE="bluetooth doc echo-cancel extra gstreamer jack-client jack-sdk lv2 pipewire-alsa ssl system-service systemd test udev v4l X zeroconf"
+IUSE="bluetooth doc echo-cancel extra gstreamer jack-client jack-sdk lv2 pipewire-alsa
+sound-server ssl system-service systemd test udev v4l X zeroconf"
 
 # Once replacing system JACK libraries is possible, it's likely that
 # jack-client IUSE will need blocking to avoid users accidentally
@@ -36,6 +37,7 @@ IUSE="bluetooth doc echo-cancel extra gstreamer jack-client jack-sdk lv2 pipewir
 # JACK's sink - doing so is likely to yield no audio, cause a CPU
 # cycles consuming loop (and may even cause GUI crashes)!
 
+# TODO: There should be "sound-server? ( || ( alsa bluetooth ) )" here, but ALSA is always enabled
 REQUIRED_USE="
 	jack-sdk? ( !jack-client )
 	system-service? ( systemd )
@@ -250,12 +252,26 @@ multilib_src_install_all() {
 		dosym ../../../usr/share/alsa/alsa.conf.d/99-pipewire-default-hook.conf /etc/alsa/conf.d/99-pipewire-default-hook.conf
 	fi
 
+	# Enable required wireplumber alsa and bluez monitors
+	if use sound-server; then
+		dodir /etc/wireplumber/main.lua.d
+		echo "alsa_monitor.enabled = true" > ${D}/etc/wireplumber/main.lua.d/89-gentoo-sound-server-enable-alsa-monitor.lua
+		dodir /etc/wireplumber/bluetooth.lua.d
+		echo "bluez_monitor.enabled = true" > ${D}/etc/wireplumber/bluetooth.lua.d/89-gentoo-sound-server-enable-bluez-monitor.lua
+	fi
+
 	if ! use systemd; then
 		insinto /etc/xdg/autostart
 		newins "${FILESDIR}"/pipewire.desktop-r1 pipewire.desktop
 
 		exeinto /usr/bin
 		newexe "${FILESDIR}"/gentoo-pipewire-launcher.in gentoo-pipewire-launcher
+
+		# Disable pipewire-pulse if sound-server is disabled.
+		if ! use sound-server ; then
+			sed -i -s '/pipewire -c pipewire-pulse.conf/s/^/#/' "${ED}"/usr/bin/gentoo-pipewire-launcher || die
+		fi
+
 		eprefixify "${ED}"/usr/bin/gentoo-pipewire-launcher
 	fi
 }
@@ -310,7 +326,8 @@ pkg_postinst() {
 		ewarn "now on start ${EROOT}/usr/bin/gentoo-pipewire-launcher instead! It is highly"
 		ewarn "advised that a D-Bus user session is set up before starting the script."
 		ewarn
-		if has_version 'media-sound/pulseaudio[daemon]' || has_version 'media-sound/pulseaudio-daemon'; then
+
+		if use sound-server && ( has_version 'media-sound/pulseaudio[daemon]' || has_version 'media-sound/pulseaudio-daemon' ) ; then
 			elog "This ebuild auto-enables PulseAudio replacement. Because of that, users"
 			elog "are recommended to edit pulseaudio client configuration files:"
 			elog "${EROOT}/etc/pulse/client.conf and ${EROOT}/etc/pulse/client.conf.d/enable-autospawn.conf"