1 # This recipe was written by Carlos Rafael Giani <crg7475@mailbox.org>
4 # The intention is to keep this synced with meta-oe and remove it when we
5 # can depend on meta-oe to provide this recipe for us
7 # AGL-specific overrides and configuration should go in the .bbappend file
9 SUMMARY = "Multimedia processing server for Linux"
10 DESCRIPTION = "Linux server for handling and routing audio and video streams between applications and multimedia I/O devices"
11 HOMEPAGE = "https://pipewire.org/"
12 BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/pipewire/issues"
13 LICENSE = "MIT & GPL-2.0-only & LGPL-2.1-or-later"
15 LIC_FILES_CHKSUM = " \
16 file://LICENSE;md5=2158739e172e58dc9ab1bdd2d6ec9c72 \
17 file://COPYING;md5=97be96ca4fab23e9657ffa590b931c1a \
19 SECTION = "multimedia"
23 # v1.0.0(El Presidente)
24 SRCREV = "4debdcd40b055b3eaa83a8f4443aa990ea566bfe"
25 SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https"
29 inherit meson pkgconfig systemd manpages gettext useradd
31 USERADD_PACKAGES = "${PN}"
33 GROUPADD_PARAM:${PN} = "--system pipewire"
35 USERADD_PARAM:${PN} = "--system --home / --no-create-home \
36 --comment 'PipeWire multimedia daemon' \
37 --gid pipewire --groups audio,video \
40 # For "EVL", look up https://evlproject.org/ . It involves
41 # a specially prepared kernel, and is currently unavailable
44 # FFmpeg and Vulkan aren't really supported - at the current
45 # stage (version 0.3.22), these are just experiments, not
48 # libcamera support currently does not build successfully.
50 # systemd user service files are disabled because per-user
51 # PipeWire instances aren't really something that makes
52 # much sense in an embedded environment. A system-wide
55 # manpage generation requires xmltoman, which is not available.
57 # Dont build any session managers along with pipewire
58 # wireplumber is the session manger used in AGL and it will
59 # be build in a different recipe
62 -Daudiotestsrc=enabled \
64 -Dsystemd-user-service=disabled \
66 -Dudevrulesdir=${nonarch_base_libdir}/udev/rules.d/ \
67 -Dvideotestsrc=enabled \
70 -Dlibcamera=disabled \
72 -Dsession-managers=[] \
76 ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \
77 ${@bb.utils.filter('DISTRO_FEATURES', 'alsa systemd', d)} \
81 # "jack" and "pipewire-jack" packageconfigs cannot be both enabled,
82 # since "jack" imports libjack, and "pipewire-jack" generates
83 # libjack.so* files, thus colliding with the libpack package. This
84 # is why these two are marked in their respective packageconfigs
85 # as being in conflict.
87 PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib udev,,pipewire-alsa-card-profile"
88 PACKAGECONFIG[bluez] = "-Dbluez5=enabled,-Dbluez5=disabled,bluez5 sbc"
89 PACKAGECONFIG[docs] = "-Ddocs=enabled,-Ddocs=disabled,doxygen-native"
90 PACKAGECONFIG[gstreamer] = "-Dgstreamer=enabled,-Dgstreamer=disabled,glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base"
91 PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack,,,pipewire-jack"
92 PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,virtual/libsdl2"
93 PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1"
94 PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsystemd-system-service=enabled ,-Dsystemd=disabled -Dsystemd-system-service=disabled,systemd"
95 PACKAGECONFIG[v4l2] = "-Dv4l2=enabled,-Dv4l2=disabled,udev"
96 PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=enabled,-Dpipewire-alsa=disabled,alsa-lib"
97 PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=disabled,jack,,,jack"
98 PACKAGECONFIG[pipewire-v4l2] = "-Dpipewire-v4l2=enabled -Dpipewire-v4l2=${libdir}/${PW_MODULE_SUBDIR}/v4l2,-Dpipewire-v4l2=disabled,v4l2"
100 PACKAGESPLITFUNCS:prepend = " split_dynamic_packages "
101 PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends "
102 PACKAGESPLITFUNCS:append = " fixup_dynamic_pkg_licenses "
104 SPA_SUBDIR = "spa-0.2"
105 PW_MODULE_SUBDIR = "pipewire-0.3"
107 remove_unused_installed_files() {
108 # jack.conf is used by pipewire-jack (not the JACK SPA plugin).
109 # Remove it if pipewire-jack is not built to avoid creating the
110 # pipewire-jack package.
111 if ${@bb.utils.contains('PACKAGECONFIG', 'pipewire-jack', 'false', 'true', d)}; then
112 rm -f "${D}${datadir}/pipewire/jack.conf"
116 do_install[postfuncs] += "remove_unused_installed_files"
118 python fixup_dynamic_pkg_licenses () {
119 #dynamic packages inherit currently whatever is specified in LICENSE (thus multiple)
120 packages = (d.getVar('PACKAGES') or "").split()
123 # we manually assign the LICENSES here to cover all packages (even dynamically created ones)
124 d.setVar("LICENSE:" + pkg ,"MIT")
126 # next handle special cases
127 # ==> LICENSE:${PN}-spa-plugins-alsa = "LGPL-2.1-or-later"
128 if "pipewire-spa-plugins-alsa" in pkg:
129 d.setVar("LICENSE:pipewire-spa-plugins-alsa", "LGPL-2.1-or-later")
130 # ==> LICENSE:${PN}-alsa-card-profile = "LGPL-2.1-or-later"
131 if "pipewire-alsa-card-profile" in pkg:
132 d.setVar("LICENSE:pipewire-alsa-card-profile", "LGPL-2.1-or-later")
133 # ==> LICENSE:${PN}-jack = "GPL-2.0-only"
134 if "pipewire-jack" in pkg:
135 d.setVar("LICENSE:pipewire-jack", "GPL-2.0-only")
138 python split_dynamic_packages () {
139 # Create packages for each SPA plugin. These plugins are located
140 # in individual subdirectories, so a recursive search is needed.
141 spa_libdir = d.expand('${libdir}/${SPA_SUBDIR}')
142 do_split_packages(d, spa_libdir, r'^libspa-(.*)\.so$', d.expand('${PN}-spa-plugins-%s'), 'PipeWire SPA plugin for %s', extra_depends='', recursive=True)
144 # Create packages for each PipeWire module.
145 pw_module_libdir = d.expand('${libdir}/${PW_MODULE_SUBDIR}')
146 do_split_packages(d, pw_module_libdir, r'^libpipewire-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'PipeWire %s module', extra_depends='', recursive=False)
149 python set_dynamic_metapkg_rdepends () {
153 # Go through all generated SPA plugin and PipeWire module packages
154 # (excluding the main package and the -meta package itself) and
155 # add them to the -meta package as RDEPENDS.
157 base_pn = d.getVar('PN')
159 spa_pn = base_pn + '-spa-plugins'
160 spa_metapkg = spa_pn + '-meta'
162 pw_module_pn = base_pn + '-modules'
163 pw_module_metapkg = pw_module_pn + '-meta'
165 d.setVar('ALLOW_EMPTY:' + spa_metapkg, "1")
166 d.setVar('FILES:' + spa_metapkg, "")
168 d.setVar('ALLOW_EMPTY:' + pw_module_metapkg, "1")
169 d.setVar('FILES:' + pw_module_metapkg, "")
171 blacklist = [ spa_pn, spa_metapkg, pw_module_pn, pw_module_metapkg ]
172 spa_metapkg_rdepends = []
173 pw_module_metapkg_rdepends = []
174 pkgdest = d.getVar('PKGDEST')
176 for pkg in oe.utils.packages_filter_out_system(d):
180 is_spa_pkg = pkg.startswith(spa_pn)
181 is_pw_module_pkg = pkg.startswith(pw_module_pn)
182 if not is_spa_pkg and not is_pw_module_pkg:
185 if pkg in spa_metapkg_rdepends or pkg in pw_module_metapkg_rdepends:
188 # See if the package is empty by looking at the contents of its
189 # PKGDEST subdirectory. If this subdirectory is empty, then then
190 # package is empty as well. Empty packages do not get added to
191 # the meta package's RDEPENDS.
192 pkgdir = os.path.join(pkgdest, pkg)
193 if os.path.exists(pkgdir):
194 dir_contents = os.listdir(pkgdir) or []
197 is_empty = len(dir_contents) == 0
200 spa_metapkg_rdepends.append(pkg)
202 pw_module_metapkg_rdepends.append(pkg)
204 d.setVar('RDEPENDS:' + spa_metapkg, ' '.join(spa_metapkg_rdepends))
205 d.setVar('DESCRIPTION:' + spa_metapkg, spa_pn + ' meta package')
207 d.setVar('RDEPENDS:' + pw_module_metapkg, ' '.join(pw_module_metapkg_rdepends))
208 d.setVar('DESCRIPTION:' + pw_module_metapkg, pw_module_pn + ' meta package')
219 ${PN}-spa-plugins-meta \
223 ${PN}-alsa-card-profile \
224 gstreamer1.0-pipewire \
227 PACKAGES_DYNAMIC = "^${PN}-spa-plugins.* ^${PN}-modules.*"
229 SYSTEMD_SERVICE:${PN} = "pipewire.service"
230 CONFFILES:${PN} += "${datadir}/pipewire/pipewire.conf"
232 ${datadir}/pipewire/pipewire.conf \
233 ${datadir}/pipewire/filter-chain.conf \
234 ${datadir}/pipewire/filter-chain \
235 ${systemd_user_unitdir}/pipewire.* \
236 ${systemd_system_unitdir}/pipewire* \
238 ${datadir}/pipewire/pipewire-avb.conf \
239 ${bindir}/pipewire-avb \
240 ${datadir}/pipewire/pipewire-aes67.conf \
241 ${bindir}/pipewire-aes67 \
242 ${datadir}/pipewire/pipewire.conf.avail \
243 ${datadir}/pipewire/pipewire-pulse.conf.avail \
244 ${datadir}/pipewire/client-rt.conf.avail \
245 ${datadir}/pipewire/client.conf.avail \
246 ${sysconfdir}/security/limits.d \
249 FILES:${PN}-dev += " \
250 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so \
253 CONFFILES:libpipewire += "${datadir}/pipewire/client.conf"
254 FILES:libpipewire = " \
255 ${datadir}/pipewire/client.conf \
256 ${datadir}/pipewire/client-rt.conf \
257 ${datadir}/pipewire/minimal.conf \
258 ${libdir}/libpipewire-*.so.* \
260 # Add the bare minimum modules and plugins required to be able
261 # to use libpipewire. Without these, it is essentially unusable.
262 RDEPENDS:libpipewire += " \
263 ${PN}-modules-client-node \
264 ${PN}-modules-protocol-native \
265 ${PN}-spa-plugins-support \
268 FILES:${PN}-tools = " \
272 # This is a shim daemon that is intended to be used as a
273 # drop-in PulseAudio replacement, providing a pulseaudio-compatible
274 # socket that can be used by applications that use libpulse.
275 CONFFILES:${PN}-pulse += "${datadir}/pipewire/pipewire-pulse.conf"
277 FILES:${PN}-pulse = " \
278 ${datadir}/pipewire/pipewire-pulse.conf \
279 ${systemd_user_unitdir}/pipewire-pulse.* \
280 ${bindir}/pipewire-pulse \
282 RDEPENDS:${PN}-pulse += " \
283 ${PN}-modules-protocol-pulse \
286 # alsa plugin to redirect audio to pipewire
287 FILES:${PN}-alsa = "\
288 ${libdir}/alsa-lib/* \
289 ${datadir}/alsa/alsa.conf.d/* \
292 #lib to emulate v4l2 system calls on top of PipeWire
293 FILES:${PN}-v4l2 = "\
294 ${libdir}/${PW_MODULE_SUBDIR}/v4l2/libpw-v4l2.so \
297 # jack drop-in libraries to redirect audio to pipewire
298 CONFFILES:${PN}-jack = "${datadir}/pipewire/jack.conf"
299 FILES:${PN}-jack = "\
300 ${datadir}/pipewire/jack.conf \
301 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \
303 # Dynamic packages (see set_dynamic_metapkg_rdepends).
304 FILES:${PN}-spa-plugins-bluez5 += " \
305 ${datadir}/${SPA_SUBDIR}/bluez5/bluez-hardware.conf \
307 RRECOMMENDS:${PN}-spa-plugins += "${PN}-spa-plugins-meta"
309 FILES:${PN}-spa-tools = " \
313 # Dynamic packages (see set_dynamic_metapkg_rdepends).
314 FILES:${PN}-modules = ""
315 RRECOMMENDS:${PN}-modules += "${PN}-modules-meta"
317 CONFFILES:${PN}-modules-rtkit = "${datadir}/pipewire/client-rt.conf"
318 FILES:${PN}-modules-rtkit += " \
319 ${datadir}/pipewire/client-rt.conf \
322 FILES:${PN}-alsa-card-profile = " \
323 ${datadir}/alsa-card-profile/* \
324 ${nonarch_base_libdir}/udev/rules.d/90-pipewire-alsa.rules \
327 FILES:gstreamer1.0-pipewire = " \
328 ${libdir}/gstreamer-1.0/* \