commit:     e4e2707733bb6b2c35242e351587e1e95883934c
Author:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  5 23:55:11 2022 +0000
Commit:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Sat Feb  5 23:57:30 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4e27077

media-video/pipewire: add masked USE=system-service

Closes: https://github.com/gentoo/gentoo/pull/23972
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>

 media-video/pipewire/metadata.xml           |  1 +
 media-video/pipewire/pipewire-0.3.45.ebuild | 30 ++++++++++++++++++++++++++---
 media-video/pipewire/pipewire-9999.ebuild   | 30 ++++++++++++++++++++++++++---
 profiles/base/package.use.mask              |  5 +++++
 4 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/media-video/pipewire/metadata.xml 
b/media-video/pipewire/metadata.xml
index a61d898b80e4..f88730b7d3ba 100644
--- a/media-video/pipewire/metadata.xml
+++ b/media-video/pipewire/metadata.xml
@@ -30,6 +30,7 @@
                <flag name="lv2">Allow loading LV2 plugins via 
<pkg>media-libs/lv2</pkg></flag>
                <flag name="pipewire-alsa">Replace PulseAudio's ALSA plugin 
with PipeWire's plugin</flag>
                <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>
        </use>
 </pkgmetadata>

diff --git a/media-video/pipewire/pipewire-0.3.45.ebuild 
b/media-video/pipewire/pipewire-0.3.45.ebuild
index 033d3614a241..a6d8db4e1bda 100644
--- a/media-video/pipewire/pipewire-0.3.45.ebuild
+++ b/media-video/pipewire/pipewire-0.3.45.ebuild
@@ -21,7 +21,7 @@ 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 systemd test v4l X zeroconf"
+IUSE="bluetooth doc echo-cancel extra gstreamer jack-client jack-sdk lv2 
pipewire-alsa ssl system-service systemd test v4l X zeroconf"
 
 # Once replacing system JACK libraries is possible, it's likely that
 # jack-client IUSE will need blocking to avoid users accidentally
@@ -29,7 +29,10 @@ 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)!
 
-REQUIRED_USE="jack-sdk? ( !jack-client )"
+REQUIRED_USE="
+       jack-sdk? ( !jack-client )
+       system-service? ( systemd )
+"
 
 RESTRICT="!test? ( test )"
 
@@ -81,6 +84,10 @@ RDEPEND="
        !pipewire-alsa? ( 
media-plugins/alsa-plugins[${MULTILIB_USEDEP},pulseaudio] )
        ssl? ( dev-libs/openssl:= )
        systemd? ( sys-apps/systemd )
+       system-service? (
+               acct-user/pipewire
+               acct-group/pipewire
+       )
        v4l? ( media-libs/libv4l )
        X? (
                media-libs/libcanberra
@@ -128,6 +135,12 @@ src_prepare() {
 
                @audio  -       memlock 256
 
+               $(use system-service && {
+                       echo @pipewire - rtprio 95
+                       echo @pipewire - priority -19
+                       echo @pipewire - memlock 4194304
+               })
+
                # End of ${limitsdfile} from ${P}
        EOF
 }
@@ -146,7 +159,7 @@ multilib_src_configure() {
                $(meson_native_use_feature gstreamer gstreamer-device-provider)
                $(meson_native_use_feature systemd)
 
-               -Dsystemd-system-service=disabled # Matches upstream
+               $(meson_native_use_feature system-service 
systemd-system-service)
                -Dsystemd-system-unit-dir="$(systemd_get_systemunitdir)"
                -Dsystemd-user-unit-dir="$(systemd_get_userunitdir)"
 
@@ -316,4 +329,15 @@ pkg_postinst() {
                fi
                ewarn
        fi
+
+       if use system-service; then
+               ewarn
+               ewarn "WARNING: you have enabled the system-service USE flag, 
which installs"
+               ewarn "the system-wide systemd units that enable PipeWire to 
run as a system"
+               ewarn "service. This is more than likely NOT what you want. You 
are strongly"
+               ewarn "advised not to enable this mode and instead stick with 
systemd user"
+               ewarn "units. The default configuration files will likely not 
work out of"
+               ewarn "box, and you are on your own with configuration."
+               ewarn
+       fi
 }

diff --git a/media-video/pipewire/pipewire-9999.ebuild 
b/media-video/pipewire/pipewire-9999.ebuild
index 033d3614a241..a6d8db4e1bda 100644
--- a/media-video/pipewire/pipewire-9999.ebuild
+++ b/media-video/pipewire/pipewire-9999.ebuild
@@ -21,7 +21,7 @@ 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 systemd test v4l X zeroconf"
+IUSE="bluetooth doc echo-cancel extra gstreamer jack-client jack-sdk lv2 
pipewire-alsa ssl system-service systemd test v4l X zeroconf"
 
 # Once replacing system JACK libraries is possible, it's likely that
 # jack-client IUSE will need blocking to avoid users accidentally
@@ -29,7 +29,10 @@ 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)!
 
-REQUIRED_USE="jack-sdk? ( !jack-client )"
+REQUIRED_USE="
+       jack-sdk? ( !jack-client )
+       system-service? ( systemd )
+"
 
 RESTRICT="!test? ( test )"
 
@@ -81,6 +84,10 @@ RDEPEND="
        !pipewire-alsa? ( 
media-plugins/alsa-plugins[${MULTILIB_USEDEP},pulseaudio] )
        ssl? ( dev-libs/openssl:= )
        systemd? ( sys-apps/systemd )
+       system-service? (
+               acct-user/pipewire
+               acct-group/pipewire
+       )
        v4l? ( media-libs/libv4l )
        X? (
                media-libs/libcanberra
@@ -128,6 +135,12 @@ src_prepare() {
 
                @audio  -       memlock 256
 
+               $(use system-service && {
+                       echo @pipewire - rtprio 95
+                       echo @pipewire - priority -19
+                       echo @pipewire - memlock 4194304
+               })
+
                # End of ${limitsdfile} from ${P}
        EOF
 }
@@ -146,7 +159,7 @@ multilib_src_configure() {
                $(meson_native_use_feature gstreamer gstreamer-device-provider)
                $(meson_native_use_feature systemd)
 
-               -Dsystemd-system-service=disabled # Matches upstream
+               $(meson_native_use_feature system-service 
systemd-system-service)
                -Dsystemd-system-unit-dir="$(systemd_get_systemunitdir)"
                -Dsystemd-user-unit-dir="$(systemd_get_userunitdir)"
 
@@ -316,4 +329,15 @@ pkg_postinst() {
                fi
                ewarn
        fi
+
+       if use system-service; then
+               ewarn
+               ewarn "WARNING: you have enabled the system-service USE flag, 
which installs"
+               ewarn "the system-wide systemd units that enable PipeWire to 
run as a system"
+               ewarn "service. This is more than likely NOT what you want. You 
are strongly"
+               ewarn "advised not to enable this mode and instead stick with 
systemd user"
+               ewarn "units. The default configuration files will likely not 
work out of"
+               ewarn "box, and you are on your own with configuration."
+               ewarn
+       fi
 }

diff --git a/profiles/base/package.use.mask b/profiles/base/package.use.mask
index 67d7c4ca7ca1..ce62e749c618 100644
--- a/profiles/base/package.use.mask
+++ b/profiles/base/package.use.mask
@@ -6,6 +6,11 @@
 # This file is only for generic masks. For arch-specific masks (i.e.
 # mask everywhere, unmask on arch/*) use arch/base.
 
+# Jason A. Donenfeld <zx...@gentoo.org> (2022-02-04)
+# We're still ironing out some kinks and writing documentation for
+# this feature, so keep masked for now.
+media-video/pipewire system-service
+
 # Sam James <s...@gentoo.org> (2021-01-24)
 # USE=custom-cflags is _particularly_ dangerous on sys-libs/glibc and
 # can result in not just build-time failures for glibc itself, but

Reply via email to