blob: a7c77463e009c53cc1952e7c61960aeb44257383 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "Multimedia processing server for Linux"
2DESCRIPTION = "Linux server for handling and routing audio and video streams between applications and multimedia I/O devices"
3HOMEPAGE = "https://pipewire.org/"
4BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/pipewire/issues"
5AUTHOR = "Wim Taymans <wtaymans@redhat.com>"
6SECTION = "multimedia"
7
8LICENSE = "MIT & LGPL-2.1-or-later & GPL-2.0-only"
9LIC_FILES_CHKSUM = " \
10 file://LICENSE;md5=2158739e172e58dc9ab1bdd2d6ec9c72 \
11 file://COPYING;md5=97be96ca4fab23e9657ffa590b931c1a \
12"
13
14DEPENDS = "dbus ncurses"
15
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060016SRCREV = "08b0ed65765a1033424a5c0d897a392a61f8a2a3"
Andrew Geissler517393d2023-01-13 08:55:19 -060017SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https"
18
19S = "${WORKDIR}/git"
20
Andrew Geisslerc5535c92023-01-27 16:10:19 -060021inherit gsettings meson pkgconfig systemd gettext useradd
Andrew Geissler517393d2023-01-13 08:55:19 -060022
23USERADD_PACKAGES = "${PN}"
24
25GROUPADD_PARAM:${PN} = "--system pipewire"
26
27USERADD_PARAM:${PN} = "--system --home / --no-create-home \
28 --comment 'PipeWire multimedia daemon' \
29 --gid pipewire --groups audio,video \
30 pipewire"
31
32SYSTEMD_PACKAGES = "${PN}"
33
34# For "EVL", look up https://evlproject.org/ . It involves
35# a specially prepared kernel, and is currently unavailable
36# in Yocto.
37#
38# Vulkan support is currently (as of version 0.3.44) not functional.
39#
40# manpage generation requires xmltoman, which is not available.
41#
42# The session-managers list specifies which session managers Meson
43# shall download (via git clone) and build as subprojects. In OE,
44# this is not how a session manager should be built. Instead, they
45# should be integrated as separate OE recipes. To prevent PipeWire
46# from using this Meson feature, set an empty list.
47# This does not disable support or the need for session managers,
48# it just prevents this subproject feature.
49#
50# AptX and LDAC are not available in OE. Currently, neither
51# are lv2 and ROC.
52#
53# The RTKit module is deprecated in favor of the newer RT module.
54# It still exists for legacy setups that still include it in
55# their PipeWire configuration files.
56EXTRA_OEMESON += " \
57 -Devl=disabled \
58 -Dtests=disabled \
59 -Dudevrulesdir=${nonarch_base_libdir}/udev/rules.d/ \
60 -Dsystemd-system-unit-dir=${systemd_system_unitdir} \
61 -Dsystemd-user-unit-dir=${systemd_user_unitdir} \
62 -Dman=disabled \
63 -Dsession-managers='[]' \
64 -Dlv2=disabled \
65 -Droc=disabled \
66 -Dbluez5-codec-aptx=disabled \
67 -Dbluez5-codec-ldac=disabled \
68 -Dlegacy-rtkit=false \
69"
70
71# spa alsa plugin code uses typedef redefinition, which is officially a C11 feature.
72# Pipewire builds with 'c_std=gnu99' by default. Recent versions of gcc don't issue this warning in gnu99
73# mode but it looks like clang still does
74CFLAGS:append = " -Wno-typedef-redefinition"
75
76# According to wireplumber documentation only one session manager should be installed at a time
77# Possible options are media-session, which has fewer dependencies but is very simple,
78# or wireplumber, which is more powerful.
79PIPEWIRE_SESSION_MANAGER ??= "wireplumber"
80
81FFMPEG_AVAILABLE = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'ffmpeg', '', d)}"
82BLUETOOTH_AAC = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'bluez-aac', '', d)}"
83
84PACKAGECONFIG:class-target ??= " \
85 ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
86 ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez bluez-opus ${BLUETOOTH_AAC}', '', d)} \
87 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \
88 ${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio gtk', 'gsettings', '', d)} \
89 ${@bb.utils.filter('DISTRO_FEATURES', 'alsa vulkan pulseaudio', d)} \
90 ${PIPEWIRE_SESSION_MANAGER} \
Andrew Geisslerc5535c92023-01-27 16:10:19 -060091 ${FFMPEG_AVAILABLE} avahi flatpak gstreamer gsettings jack libusb pw-cat raop sndfile v4l2 udev volume webrtc-echo-cancelling libcamera \
Andrew Geissler517393d2023-01-13 08:55:19 -060092"
93
94# "jack" and "pipewire-jack" packageconfigs cannot be both enabled,
95# since "jack" imports libjack, and "pipewire-jack" generates
96# libjack.so* files, thus colliding with the libpack package. This
97# is why these two are marked in their respective packageconfigs
98# as being in conflict.
99PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib udev,,pipewire-alsa pipewire-alsa-card-profile"
100PACKAGECONFIG[avahi] = "-Davahi=enabled,-Davahi=disabled,avahi"
101PACKAGECONFIG[bluez] = "-Dbluez5=enabled,-Dbluez5=disabled,bluez5 sbc"
102PACKAGECONFIG[bluez-aac] = "-Dbluez5-codec-aac=enabled,-Dbluez5-codec-aac=disabled,fdk-aac"
103PACKAGECONFIG[bluez-opus] = "-Dbluez5-codec-opus=enabled,-Dbluez5-codec-opus=disabled,libopus"
104PACKAGECONFIG[docs] = "-Ddocs=enabled,-Ddocs=disabled,doxygen-native graphviz-native"
105PACKAGECONFIG[ffmpeg] = "-Dffmpeg=enabled,-Dffmpeg=disabled,ffmpeg"
106PACKAGECONFIG[flatpak] = "-Dflatpak=enabled,-Dflatpak=disabled,glib-2.0"
107PACKAGECONFIG[gsettings] = "-Dgsettings=enabled,-Dgsettings=disabled,glib-2.0"
108PACKAGECONFIG[gstreamer] = "-Dgstreamer=enabled,-Dgstreamer=disabled,glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base,,gstreamer1.0-pipewire"
109PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack,,,pipewire-jack"
110PACKAGECONFIG[libcamera] = "-Dlibcamera=enabled,-Dlibcamera=disabled,libcamera libdrm"
111PACKAGECONFIG[libcanberra] = "-Dlibcanberra=enabled,-Dlibcanberra=disabled,libcanberra"
112PACKAGECONFIG[libusb] = "-Dlibusb=enabled,-Dlibusb=disabled,libusb"
113PACKAGECONFIG[media-session] = ",,,pipewire-media-session,,wireplumber"
114PACKAGECONFIG[pulseaudio] = "-Dlibpulse=enabled,-Dlibpulse=disabled,pulseaudio,,pipewire-pulse"
115PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=enabled,-Dpipewire-alsa=disabled,alsa-lib"
116PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=disabled,jack,,pipewire-jack,jack"
117PACKAGECONFIG[pw-cat] = "-Dpw-cat=enabled,-Dpw-cat=disabled"
118PACKAGECONFIG[raop] = "-Draop=enabled,-Draop=disabled,openssl"
119PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,libsdl2"
120PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1"
121PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd"
122PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=enabled,-Dsystemd-system-service=disabled,systemd"
123# "systemd-user-service" packageconfig will only install service
124# files to rootfs but not enable them as systemd.bbclass
125# currently lacks the feature of enabling user services.
126PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=enabled,-Dsystemd-user-service=disabled,systemd"
127# pw-cat needs sndfile packageconfig to be enabled
128PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev"
129PACKAGECONFIG[v4l2] = "-Dv4l2=enabled,-Dv4l2=disabled,udev"
130PACKAGECONFIG[volume] = "-Dvolume=enabled,-Dvolume=disabled"
131PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled,vulkan-headers vulkan-loader"
132PACKAGECONFIG[webrtc-echo-cancelling] = "-Decho-cancel-webrtc=enabled,-Decho-cancel-webrtc=disabled,webrtc-audio-processing"
133PACKAGECONFIG[wireplumber] = ",,,wireplumber,,media-session"
134
135PACKAGESPLITFUNCS:prepend = " split_dynamic_packages "
136PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends "
137
138SPA_SUBDIR = "spa-0.2"
139PW_MODULE_SUBDIR = "pipewire-0.3"
140
141remove_unused_installed_files() {
142 # jack.conf is used by pipewire-jack (not the JACK SPA plugin).
143 # Remove it if pipewire-jack is not built to avoid creating the
144 # pipewire-jack package.
145 if ${@bb.utils.contains('PACKAGECONFIG', 'pipewire-jack', 'false', 'true', d)}; then
146 rm -f "${D}${datadir}/pipewire/jack.conf"
147 fi
148
149 # minimal.conf is an example of how to minimally configure the
150 # daemon and is not meant to be used for production.
151 rm -f "${D}${datadir}/pipewire/minimal.conf"
152}
153
154do_install[postfuncs] += "remove_unused_installed_files"
155
156python split_dynamic_packages () {
157 # Create packages for each SPA plugin. These plugins are located
158 # in individual subdirectories, so a recursive search is needed.
159 spa_libdir = d.expand('${libdir}/${SPA_SUBDIR}')
160 do_split_packages(d, spa_libdir, r'^libspa-(.*)\.so$', d.expand('${PN}-spa-plugins-%s'), 'PipeWire SPA plugin for %s', extra_depends='', recursive=True)
161
162 # Create packages for each PipeWire module.
163 pw_module_libdir = d.expand('${libdir}/${PW_MODULE_SUBDIR}')
164 do_split_packages(d, pw_module_libdir, r'^libpipewire-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'PipeWire %s module', extra_depends='', recursive=False)
165}
166
167python set_dynamic_metapkg_rdepends () {
168 import os
169 import oe.utils
170
Patrick Williams864cc432023-02-09 14:54:44 -0600171 if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('native', d):
172 return
173
Andrew Geissler517393d2023-01-13 08:55:19 -0600174 # Go through all generated SPA plugin and PipeWire module packages
175 # (excluding the main package and the -meta package itself) and
176 # add them to the -meta package as RDEPENDS.
177
178 base_pn = d.getVar('PN')
179
180 spa_pn = base_pn + '-spa-plugins'
181 spa_metapkg = spa_pn + '-meta'
182
183 pw_module_pn = base_pn + '-modules'
184 pw_module_metapkg = pw_module_pn + '-meta'
185
186 d.setVar('ALLOW_EMPTY:' + spa_metapkg, "1")
187 d.setVar('FILES:' + spa_metapkg, "")
188
189 d.setVar('ALLOW_EMPTY:' + pw_module_metapkg, "1")
190 d.setVar('FILES:' + pw_module_metapkg, "")
191
192 blacklist = [ spa_pn, spa_metapkg, pw_module_pn, pw_module_metapkg ]
193 spa_metapkg_rdepends = []
194 pw_module_metapkg_rdepends = []
195 pkgdest = d.getVar('PKGDEST')
196
197 for pkg in oe.utils.packages_filter_out_system(d):
198 if pkg in blacklist:
199 continue
200
201 is_spa_pkg = pkg.startswith(spa_pn)
202 is_pw_module_pkg = pkg.startswith(pw_module_pn)
203 if not is_spa_pkg and not is_pw_module_pkg:
204 continue
205
206 if pkg in spa_metapkg_rdepends or pkg in pw_module_metapkg_rdepends:
207 continue
208
209 # See if the package is empty by looking at the contents of its
210 # PKGDEST subdirectory. If this subdirectory is empty, then then
211 # package is empty as well. Empty packages do not get added to
212 # the meta package's RDEPENDS.
213 pkgdir = os.path.join(pkgdest, pkg)
214 if os.path.exists(pkgdir):
215 dir_contents = os.listdir(pkgdir) or []
216 else:
217 dir_contents = []
218 is_empty = len(dir_contents) == 0
219 if not is_empty:
220 if is_spa_pkg:
221 spa_metapkg_rdepends.append(pkg)
222 if is_pw_module_pkg:
223 pw_module_metapkg_rdepends.append(pkg)
224
225 d.setVar('RDEPENDS:' + spa_metapkg, ' '.join(spa_metapkg_rdepends))
226 d.setVar('DESCRIPTION:' + spa_metapkg, spa_pn + ' meta package')
227
228 d.setVar('RDEPENDS:' + pw_module_metapkg, ' '.join(pw_module_metapkg_rdepends))
229 d.setVar('DESCRIPTION:' + pw_module_metapkg, pw_module_pn + ' meta package')
230}
231
232PACKAGES =+ "\
233 libpipewire \
234 ${PN}-tools \
235 ${PN}-pulse \
236 ${PN}-alsa \
237 ${PN}-jack \
238 ${PN}-spa-plugins \
239 ${PN}-spa-plugins-meta \
240 ${PN}-spa-tools \
241 ${PN}-modules \
242 ${PN}-modules-meta \
243 ${PN}-alsa-card-profile \
244 ${PN}-v4l2 \
245 gstreamer1.0-pipewire \
246"
247
248PACKAGES_DYNAMIC = "^${PN}-spa-plugins.* ^${PN}-modules.*"
Patrick Williams864cc432023-02-09 14:54:44 -0600249PACKAGES_DYNAMIC:class-native = ""
Andrew Geissler517393d2023-01-13 08:55:19 -0600250
251SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd-system-service', 'pipewire.service', '', d)}"
252CONFFILES:${PN} += "${datadir}/pipewire/pipewire.conf"
253FILES:${PN} = " \
254 ${datadir}/pipewire \
255 ${systemd_system_unitdir}/pipewire* \
256 ${systemd_user_unitdir} \
257 ${bindir}/pipewire \
258 ${bindir}/pipewire-avb \
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600259 ${bindir}/pipewire-aes67 \
260 ${sysconfdir}/security/limits.d \
Andrew Geissler517393d2023-01-13 08:55:19 -0600261"
262
263RRECOMMENDS:${PN}:class-target += " \
264 pipewire-modules-meta \
265 pipewire-spa-plugins-meta \
266"
267
268FILES:${PN}-dev += " \
269 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so \
270"
271
272CONFFILES:libpipewire += "${datadir}/pipewire/client.conf"
273FILES:libpipewire = " \
274 ${datadir}/pipewire/client.conf \
275 ${libdir}/libpipewire-*.so.* \
276"
277# Add the bare minimum modules and plugins required to be able
278# to use libpipewire. Without these, it is essentially unusable.
279RDEPENDS:libpipewire += " \
280 ${PN}-modules-client-node \
281 ${PN}-modules-protocol-native \
282 ${PN}-spa-plugins-support \
283"
284
285FILES:${PN}-tools = " \
286 ${bindir}/pw-cat \
287 ${bindir}/pw-cli \
288 ${bindir}/pw-dot \
289 ${bindir}/pw-dsdplay \
290 ${bindir}/pw-dump \
291 ${bindir}/pw-link \
292 ${bindir}/pw-loopback \
293 ${bindir}/pw-metadata \
294 ${bindir}/pw-mididump \
295 ${bindir}/pw-midiplay \
296 ${bindir}/pw-midirecord \
297 ${bindir}/pw-mon \
298 ${bindir}/pw-play \
299 ${bindir}/pw-profiler \
300 ${bindir}/pw-record \
301 ${bindir}/pw-reserve \
302 ${bindir}/pw-top \
303"
304
305# This is a shim daemon that is intended to be used as a
306# drop-in PulseAudio replacement, providing a pulseaudio-compatible
307# socket that can be used by applications that use libpulse.
308CONFFILES:${PN}-pulse += "${datadir}/pipewire/pipewire-pulse.conf"
309FILES:${PN}-pulse = " \
310 ${datadir}/pipewire/pipewire-pulse.conf \
311 ${systemd_system_unitdir}/pipewire-pulse.* \
312 ${systemd_user_unitdir}/pipewire-pulse.* \
313 ${bindir}/pipewire-pulse \
314"
315RDEPENDS:${PN}-pulse += " \
316 ${PN}-modules-protocol-pulse \
317"
318
319# ALSA plugin to redirect audio to pipewire.
320FILES:${PN}-alsa = "\
321 ${libdir}/alsa-lib/* \
322 ${datadir}/alsa/alsa.conf.d/* \
323"
324
325# JACK drop-in libraries to redirect audio to pipewire.
326CONFFILES:${PN}-jack = "${datadir}/pipewire/jack.conf"
327FILES:${PN}-jack = "\
328 ${bindir}/pw-jack \
329 ${datadir}/pipewire/jack.conf \
330 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \
331"
332
333# Dynamic SPA plugin packages (see set_dynamic_metapkg_rdepends).
334FILES:${PN}-spa-plugins = ""
335RRECOMMENDS:${PN}-spa-plugins += "${PN}-spa-plugins-meta"
336
337FILES:${PN}-spa-plugins-bluez5 += " \
338 ${datadir}/${SPA_SUBDIR}/bluez5/* \
339"
340
341FILES:${PN}-spa-tools = " \
342 ${bindir}/spa-* \
343"
344
345# Dynamic PipeWire module packages (see set_dynamic_metapkg_rdepends).
346FILES:${PN}-modules = ""
347RRECOMMENDS:${PN}-modules += "${PN}-modules-meta"
348
349CONFFILES:${PN}-modules-rt = "${datadir}/pipewire/client-rt.conf"
350FILES:${PN}-modules-rt += " \
351 ${datadir}/pipewire/client-rt.conf \
352 "
353
354CONFFILES:${PN}-modules-filter-chain = "${datadir}/pipewire/filter-chain/*"
355FILES:${PN}-modules-filter-chain += " \
356 ${datadir}/pipewire/filter-chain/* \
357"
358
359FILES:${PN}-alsa-card-profile = " \
360 ${datadir}/alsa-card-profile/* \
361 ${nonarch_base_libdir}/udev/rules.d/90-pipewire-alsa.rules \
362"
363
364# V4L2 interface emulator for sending/receiving data between PipeWire and V4L2 applications.
365FILES:${PN}-v4l2 += " \
366 ${bindir}/pw-v4l2 \
367 ${libdir}/${PW_MODULE_SUBDIR}/v4l2/libpw-v4l2.so \
368"
369
370FILES:gstreamer1.0-pipewire = " \
371 ${libdir}/gstreamer-1.0/* \
372"
373
374BBCLASSEXTEND = "native nativesdk"