Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/pipewire/
Date: Wed, 28 Apr 2021 13:29:28
Message-Id: 1619616554.5f1c8ef0c5d29ec2afd65150a89b7ff188efbe02.whissi@gentoo
1 commit: 5f1c8ef0c5d29ec2afd65150a89b7ff188efbe02
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 28 13:23:14 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 28 13:29:14 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f1c8ef0
7
8 media-video/pipewire: add live ebuild
9
10 Package-Manager: Portage-3.0.18, Repoman-3.0.3
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 media-video/pipewire/pipewire-9999.ebuild | 243 ++++++++++++++++++++++++++++++
14 1 file changed, 243 insertions(+)
15
16 diff --git a/media-video/pipewire/pipewire-9999.ebuild b/media-video/pipewire/pipewire-9999.ebuild
17 new file mode 100644
18 index 00000000000..a90b445a81d
19 --- /dev/null
20 +++ b/media-video/pipewire/pipewire-9999.ebuild
21 @@ -0,0 +1,243 @@
22 +# Copyright 1999-2021 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=7
26 +
27 +inherit meson optfeature udev
28 +
29 +if [[ ${PV} == 9999 ]]; then
30 + EGIT_REPO_URI="https://gitlab.freedesktop.org/${PN}/${PN}.git"
31 +# EGIT_BRANCH="master"
32 + inherit git-r3
33 +else
34 + SRC_URI="https://gitlab.freedesktop.org/${PN}/${PN}/-/archive/${PV}/${P}.tar.gz"
35 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
36 +fi
37 +
38 +DESCRIPTION="Multimedia processing graphs"
39 +HOMEPAGE="https://pipewire.org/"
40 +
41 +LICENSE="LGPL-2.1+"
42 +SLOT="0/0.3"
43 +IUSE="aac aptx bluetooth doc extra gstreamer jack-client ldac pipewire-alsa systemd test v4l"
44 +
45 +# Once replacing system JACK libraries is possible, it's likely that
46 +# jack-client IUSE will need blocking to avoid users accidentally
47 +# configuring their systems to send PW sink output to the emulated
48 +# JACK's sink - doing so is likely to yield no audio, cause a CPU
49 +# cycles consuming loop (and may even cause GUI crashes)!
50 +
51 +REQUIRED_USE="
52 + aac? ( bluetooth )
53 + aptx? ( bluetooth )
54 + ldac? ( bluetooth )
55 +"
56 +
57 +BDEPEND="
58 + app-doc/xmltoman
59 + doc? (
60 + app-doc/doxygen
61 + media-gfx/graphviz
62 + )
63 +"
64 +RDEPEND="
65 + media-libs/alsa-lib
66 + sys-apps/dbus
67 + sys-libs/ncurses[unicode]
68 + virtual/libudev
69 + bluetooth? (
70 + aac? ( media-libs/fdk-aac )
71 + aptx? ( media-libs/libopenaptx )
72 + ldac? ( media-libs/libldac )
73 + media-libs/sbc
74 + >=net-wireless/bluez-4.101:=
75 + )
76 + extra? (
77 + >=media-libs/libsndfile-1.0.20
78 + )
79 + gstreamer? (
80 + >=dev-libs/glib-2.32.0:2
81 + >=media-libs/gstreamer-1.10.0:1.0
82 + media-libs/gst-plugins-base:1.0
83 + )
84 + jack-client? ( >=media-sound/jack2-1.9.10:2[dbus] )
85 + pipewire-alsa? (
86 + >=media-libs/alsa-lib-1.1.7
87 + || (
88 + media-plugins/alsa-plugins[-pulseaudio]
89 + !media-plugins/alsa-plugins
90 + )
91 + )
92 + !pipewire-alsa? ( media-plugins/alsa-plugins[pulseaudio] )
93 + systemd? ( sys-apps/systemd )
94 + v4l? ( media-libs/libv4l )
95 +"
96 +
97 +DEPEND="${RDEPEND}"
98 +
99 +# Present RDEPEND that are currently always disabled due to the PW
100 +# code using them being required to be disabled by Gentoo guidelines
101 +# (i.e. developer binaries not meant for users) and unready code
102 +# media-video/ffmpeg:=
103 +# media-libs/libsdl2
104 +# >=media-libs/vulkan-loader-1.1.69
105 +#
106 +# Ditto for DEPEND
107 +# >=dev-util/vulkan-headers-1.1.69
108 +
109 +DOCS=( {README,INSTALL}.md NEWS )
110 +
111 +RESTRICT="!test? ( test )"
112 +
113 +PATCHES=(
114 + "${FILESDIR}"/${PN}-0.3.25-enable-failed-mlock-warning.patch
115 +)
116 +
117 +# limitsdfile related code taken from =sys-auth/realtime-base-0.1
118 +# with changes as necessary.
119 +limitsdfile=40-${PN}.conf
120 +
121 +src_prepare() {
122 + default
123 +
124 + if ! use systemd; then
125 + # This can be applied non-conditionally but would make for a
126 + # significantly worse user experience on systemd then.
127 + eapply "${FILESDIR}"/${PN}-0.3.25-non-systemd-integration.patch
128 + fi
129 +}
130 +
131 +src_configure() {
132 + local emesonargs=(
133 + -Ddocdir="${EPREFIX}"/usr/share/doc/${PF}
134 + $(meson_feature doc docs)
135 + -Dexamples=enabled # Disabling this implicitly disables -Dmedia-session (not good)
136 + -Dmedia-session=enabled
137 + -Dman=enabled
138 + $(meson_feature test tests)
139 + -Dinstalled_tests=disabled # Matches upstream; Gentoo never installs tests
140 + $(meson_feature gstreamer)
141 + $(meson_feature gstreamer gstreamer-device-provider)
142 + $(meson_feature systemd) # Also covers logind integration
143 + -Dsystemd-system-service=disabled # Matches upstream
144 + $(meson_feature systemd systemd-user-service)
145 + $(meson_feature pipewire-alsa) # Allows integrating ALSA apps into PW graph
146 + -Dpipewire-jack=enabled # Allows integrating JACK apps into PW graph
147 + #-Dlibjack-path="" # Where to install libjack.so et al (if an absolute path is used, remember to prefix it with ${EROOT} or similar!); setting this will also break pw-jack's multilib support (but presumably that's okay as the intended use would be to replace system's libraries making the loader irrelevant)
148 + -Dspa-plugins=enabled
149 + -Dalsa=enabled # Allows using kernel ALSA for sound I/O (-Dmedia-session depends on this)
150 + -Daudiomixer=enabled # Matches upstream
151 + -Daudioconvert=enabled # Matches upstream
152 + $(meson_feature bluetooth bluez5)
153 + $(meson_feature bluetooth bluez5-backend-hsp-native)
154 + $(meson_feature bluetooth bluez5-backend-hfp-native)
155 + $(meson_feature bluetooth bluez5-backend-ofono)
156 + $(meson_feature bluetooth bluez5-backend-hsphfpd)
157 + $(meson_feature aac bluez5-codec-aac)
158 + $(meson_feature aptx bluez5-codec-aptx)
159 + $(meson_feature ldac bluez5-codec-ldac)
160 + -Dcontrol=enabled # Matches upstream
161 + -Daudiotestsrc=enabled # Matches upstream
162 + -Dffmpeg=disabled # Disabled by upstream and no major developments to spa/plugins/ffmpeg/ since May 2020
163 + $(meson_feature jack-client jack) # Allows PW to act as a JACK client
164 + -Dsupport=enabled # Miscellaneous/common plugins, such as null sink
165 + -Devl=disabled # Matches upstream
166 + -Dtest=disabled # fakesink and fakesource plugins
167 + $(meson_feature v4l v4l2)
168 + -Dlibcamera=disabled # libcamera is not in Portage tree
169 + -Dvideoconvert=enabled # Matches upstream
170 + -Dvideotestsrc=enabled # Matches upstream
171 + -Dvolume=enabled # Matches upstream
172 + -Dvulkan=disabled # Uses pre-compiled Vulkan compute shader to provide a CGI video source (dev thing; disabled by upstream)
173 + $(meson_feature extra pw-cat)
174 + -Dudev=enabled
175 + -Dudevrulesdir="$(get_udevdir)/rules.d"
176 + -Dsdl2=disabled # Controls SDL2 dependent code (currently only examples when -Dinstalled_tests=enabled which we never install)
177 + $(meson_feature extra sndfile) # Enables libsndfile dependent code (currently only pw-cat)
178 + )
179 + meson_src_configure
180 +}
181 +
182 +src_compile() {
183 + meson_src_compile
184 +
185 + einfo "Generating ${limitsdfile}"
186 + cat > ${limitsdfile} <<- EOF || die
187 + # Start of ${limitsdfile} from ${P}
188 +
189 + 1000:60000 - memlock 256
190 +
191 + # End of ${limitsdfile} from ${P}
192 + EOF
193 +}
194 +
195 +src_install() {
196 + meson_src_install
197 +
198 + insinto /etc/security/limits.d
199 + doins ${limitsdfile}
200 +
201 + if use pipewire-alsa; then
202 + dodir /etc/alsa/conf.d
203 + # These will break if someone has /etc that is a symbol link to a subfolder! See #724222
204 + # And the current dosym8 -r implementation is likely affected by the same issue, too.
205 + dosym ../../../usr/share/alsa/alsa.conf.d/50-pipewire.conf /etc/alsa/conf.d/50-pipewire.conf
206 + dosym ../../../usr/share/alsa/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/99-pipewire-default.conf
207 + fi
208 +
209 + if ! use systemd; then
210 + insinto /etc/xdg/autostart
211 + newins "${FILESDIR}"/pipewire.desktop pipewire.desktop
212 +
213 + exeinto /usr/libexec
214 + newexe "${FILESDIR}"/pipewire-launcher.sh pipewire-launcher
215 + fi
216 +}
217 +
218 +pkg_postinst() {
219 + if ! use pipewire-alsa; then
220 + elog "Contrary to what some online resources may suggest, avoid setting"
221 + elog "PULSE_LATENCY_MSEC environment variable since it may break ALSA clients."
222 + elog
223 + fi
224 +
225 + elog "JACK emulation is incomplete and not all programs will work. PipeWire's"
226 + elog "alternative libraries have been installed to a non-default location."
227 + elog "To use them, put pw-jack <application> before every JACK application."
228 + elog "When using pw-jack, do not run jackd/jackdbus. However, a virtual/jack"
229 + elog "provider is still needed to compile the JACK applications themselves."
230 + elog
231 +
232 + if use systemd; then
233 + elog "Per Gentoo policy installed systemd units must be manually enabled:"
234 + elog "systemctl --user disable pulseaudio.service pulseaudio.socket"
235 + elog "systemctl --user enable pipewire.socket pipewire-pulse.socket"
236 + elog "Rebooting is strongly recommended to avoid surprises from"
237 + elog "remnant PulseAudio daemon auto-spawning and surviving logouts."
238 + elog
239 + ewarn "Both new users and those upgrading need to enable pipewire-media-session:"
240 + ewarn "systemctl --user enable pipewire-media-session.service"
241 + else
242 + elog "This ebuild auto-enables PulseAudio replacement. Because of that users"
243 + elog "are recommended to edit: ${EROOT}/etc/pulse/client.conf and disable "
244 + elog "autospawn'ing of the original daemon by setting:"
245 + elog "autospawn = no"
246 + elog "Please note that the semicolon (;) must _NOT_ be at the beginning of the line!"
247 + elog
248 + elog "Alternatively, if replacing PulseAudio daemon is not desired, edit"
249 + elog "${EROOT}/etc/pipewire/pipewire.conf"
250 + elog "by commenting out the relevant command near the end of the file:"
251 + elog "#\"/usr/bin/pipewire\" = { args = \"-c pipewire-pulse.conf\" }"
252 + elog
253 + elog "It is still necessary to manually enable PipeWire startup. Setup specific"
254 + elog "instructions can be found at: https://wiki.gentoo.org/wiki/PipeWire"
255 + fi
256 +
257 + optfeature_header "The following can be installed for optional runtime features:"
258 + optfeature "restricted realtime capabilities vai D-Bus" sys-auth/rtkit
259 + # Once hsphfpd lands in tree, both it and ofono will need to be checked for presence here!
260 + if use bluetooth; then
261 + optfeature "better BT headset support (daemon startup required)" net-misc/ofono
262 + #optfeature "an oFono alternative (not packaged)" foo-bar/hsphfpd
263 + fi
264 +}