commit:     fac4d19f4f5f8f0ff0c9514dd58f24d0ccc55662
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  4 23:16:11 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul  4 23:16:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fac4d19f

media-video/pipewire: add ewarn for upgrades w/o USE=sound-server; sync live

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...ire-0.3.53.ebuild => pipewire-0.3.53-r1.ebuild} | 12 +++++++
 media-video/pipewire/pipewire-9999.ebuild          | 42 ++++++++++++++++++++--
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/media-video/pipewire/pipewire-0.3.53.ebuild 
b/media-video/pipewire/pipewire-0.3.53-r1.ebuild
similarity index 97%
rename from media-video/pipewire/pipewire-0.3.53.ebuild
rename to media-video/pipewire/pipewire-0.3.53-r1.ebuild
index e9b41b72f455..f881800c5a79 100644
--- a/media-video/pipewire/pipewire-0.3.53.ebuild
+++ b/media-video/pipewire/pipewire-0.3.53-r1.ebuild
@@ -295,6 +295,18 @@ pkg_postinst() {
        elog "  usermod -aG audio <youruser>"
        elog
 
+       local ver
+       for ver in ${REPLACING_VERSIONS} ; do
+               if ver_test ${ver} -le 0.3.53-r1 && ! use sound-server ; then
+                       ewarn "USE=sound-server is disabled! If you want 
PipeWire to provide"
+                       ewarn "your sound, please enable it. See the wiki at"
+                       ewarn 
"https://wiki.gentoo.org/wiki/PipeWire#Replacing_PulseAudio";
+                       ewarn "for more details."
+
+                       break
+               fi
+       done
+
        if ! use jack-sdk; then
                elog "JACK emulation is incomplete and not all programs will 
work. PipeWire's"
                elog "alternative libraries have been installed to a 
non-default location."

diff --git a/media-video/pipewire/pipewire-9999.ebuild 
b/media-video/pipewire/pipewire-9999.ebuild
index 9ab78449ccc3..f881800c5a79 100644
--- a/media-video/pipewire/pipewire-9999.ebuild
+++ b/media-video/pipewire/pipewire-9999.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,9 +37,15 @@ 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
+# TODO: Pulseaudio alsa plugin performs runtime check that pulseaudio server 
connection will work
+# which provides adequate guarantee that alsa-lib will be able to provide 
audio services.
+# If that works, pulseaudio defaults are loaded into alsa-lib runtime 
replacing default PCM and CTL.
+# When pipewire-alsa will be able to perform similar check, pipewire-alsa can 
be enabled unconditionally.
 REQUIRED_USE="
        jack-sdk? ( !jack-client )
        system-service? ( systemd )
+       !sound-server? ( !pipewire-alsa )
 "
 
 RESTRICT="!test? ( test )"
@@ -87,6 +94,10 @@ RDEPEND="
                >=media-libs/alsa-lib-1.1.7[${MULTILIB_USEDEP}]
        )
        !pipewire-alsa? ( 
media-plugins/alsa-plugins[${MULTILIB_USEDEP},pulseaudio] )
+       sound-server? (
+               !media-sound/pulseaudio[daemon(+)]
+               !media-sound/pulseaudio-daemon
+       )
        ssl? ( dev-libs/openssl:= )
        systemd? ( sys-apps/systemd )
        system-service? (
@@ -250,12 +261,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
 }
@@ -270,6 +295,18 @@ pkg_postinst() {
        elog "  usermod -aG audio <youruser>"
        elog
 
+       local ver
+       for ver in ${REPLACING_VERSIONS} ; do
+               if ver_test ${ver} -le 0.3.53-r1 && ! use sound-server ; then
+                       ewarn "USE=sound-server is disabled! If you want 
PipeWire to provide"
+                       ewarn "your sound, please enable it. See the wiki at"
+                       ewarn 
"https://wiki.gentoo.org/wiki/PipeWire#Replacing_PulseAudio";
+                       ewarn "for more details."
+
+                       break
+               fi
+       done
+
        if ! use jack-sdk; then
                elog "JACK emulation is incomplete and not all programs will 
work. PipeWire's"
                elog "alternative libraries have been installed to a 
non-default location."
@@ -310,7 +347,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"

Reply via email to