blob: 25c87d26da7be197d967d0d087596cbf7aa64f4a [file] [log] [blame]
Andrew Geissler97771a32021-03-05 15:23:11 -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"
5LICENSE = "MIT"
6LIC_FILES_CHKSUM = " \
7 file://LICENSE;md5=e2c0b7d86d04e716a3c4c9ab34260e69 \
8 file://COPYING;md5=97be96ca4fab23e9657ffa590b931c1a \
9"
10SECTION = "multimedia"
11
12DEPENDS = "dbus"
13
Andrew Geissler32b11992021-03-31 13:37:05 -050014SRCREV = "c81d44e8a9497899d01bcc3054b6aa845e7a066e"
Andrew Geissler97771a32021-03-05 15:23:11 -060015SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https"
16
17S = "${WORKDIR}/git"
18
19inherit meson pkgconfig systemd manpages gettext useradd
20
21USERADD_PACKAGES = "${PN}"
22
23GROUPADD_PARAM_${PN} = "--system pipewire"
24
25USERADD_PARAM_${PN} = "--system --home / --no-create-home \
26 --comment 'PipeWire multimedia daemon' \
27 --gid pipewire --groups audio,video \
28 pipewire"
29
30# For "EVL", look up https://evlproject.org/ . It involves
31# a specially prepared kernel, and is currently unavailable
32# in Yocto.
Andrew Geissler32b11992021-03-31 13:37:05 -050033#
Andrew Geissler97771a32021-03-05 15:23:11 -060034# FFmpeg and Vulkan aren't really supported - at the current
35# stage (version 0.3.22), these are just experiments, not
36# actual features.
Andrew Geissler32b11992021-03-31 13:37:05 -050037#
Andrew Geissler97771a32021-03-05 15:23:11 -060038# libcamera support currently does not build successfully.
Andrew Geissler32b11992021-03-31 13:37:05 -050039#
Andrew Geissler97771a32021-03-05 15:23:11 -060040# systemd user service files are disabled because per-user
41# PipeWire instances aren't really something that makes
42# much sense in an embedded environment. A system-wide
43# instance does.
Andrew Geissler32b11992021-03-31 13:37:05 -050044#
45# manpage generation requires xmltoman, which is not available.
Andrew Geissler97771a32021-03-05 15:23:11 -060046EXTRA_OEMESON += " \
Andrew Geissler32b11992021-03-31 13:37:05 -050047 -Daudiotestsrc=enabled \
48 -Devl=disabled \
49 -Dsystemd-user-service=disabled \
50 -Dtests=disabled \
Andrew Geissler97771a32021-03-05 15:23:11 -060051 -Dudevrulesdir=${nonarch_base_libdir}/udev/rules.d/ \
Andrew Geissler32b11992021-03-31 13:37:05 -050052 -Dvideotestsrc=enabled \
53 -Dffmpeg=disabled \
54 -Dvulkan=disabled \
55 -Dlibcamera=disabled \
56 -Dman=disabled \
Andrew Geissler97771a32021-03-05 15:23:11 -060057"
58
59PACKAGECONFIG ??= "\
60 ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \
61 ${@bb.utils.filter('DISTRO_FEATURES', 'alsa systemd', d)} \
62 gstreamer jack v4l2 \
63"
64
65# "jack" and "pipewire-jack" packageconfigs cannot be both enabled,
66# since "jack" imports libjack, and "pipewire-jack" generates
67# libjack.so* files, thus colliding with the libpack package. This
68# is why these two are marked in their respective packageconfigs
69# as being in conflict.
70
Andrew Geissler32b11992021-03-31 13:37:05 -050071PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib udev"
72PACKAGECONFIG[bluez] = "-Dbluez5=enabled,-Dbluez5=disabled,bluez5 sbc"
73PACKAGECONFIG[docs] = "-Ddocs=enabled,-Ddocs=disabled,doxygen-native"
74PACKAGECONFIG[gstreamer] = "-Dgstreamer=enabled,-Dgstreamer=disabled,glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base"
75PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack,,,pipewire-jack"
Andrew Geissler97771a32021-03-05 15:23:11 -060076PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,virtual/libsdl2"
77PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1"
Andrew Geissler32b11992021-03-31 13:37:05 -050078PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsystemd-system-service=enabled ,-Dsystemd=disabled -Dsystemd-system-service=disabled,systemd"
79PACKAGECONFIG[v4l2] = "-Dv4l2=enabled,-Dv4l2=disabled,udev"
80PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=enabled,-Dpipewire-alsa=disabled,alsa-lib"
81PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=disabled,jack,,,jack"
Andrew Geissler97771a32021-03-05 15:23:11 -060082
83PACKAGESPLITFUNCS_prepend = " split_dynamic_packages "
84PACKAGESPLITFUNCS_append = " set_dynamic_metapkg_rdepends "
85
86SPA_SUBDIR = "spa-0.2"
87PW_MODULE_SUBDIR = "pipewire-0.3"
88
89remove_unused_installed_files() {
90 # jack.conf is used by pipewire-jack (not the JACK SPA plugin).
91 # Remove it if pipewire-jack is not built to avoid creating the
92 # pipewire-jack package.
93 if ${@bb.utils.contains('PACKAGECONFIG', 'pipewire-jack', 'false', 'true', d)}; then
94 rm -f "${D}${sysconfdir}/pipewire/jack.conf"
95 fi
96}
97
98do_install[postfuncs] += "remove_unused_installed_files"
99
100python split_dynamic_packages () {
101 # Create packages for each SPA plugin. These plugins are located
102 # in individual subdirectories, so a recursive search is needed.
103 spa_libdir = d.expand('${libdir}/${SPA_SUBDIR}')
104 do_split_packages(d, spa_libdir, r'^libspa-(.*)\.so$', d.expand('${PN}-spa-plugins-%s'), 'PipeWire SPA plugin for %s', extra_depends='', recursive=True)
105
106 # Create packages for each PipeWire module.
107 pw_module_libdir = d.expand('${libdir}/${PW_MODULE_SUBDIR}')
108 do_split_packages(d, pw_module_libdir, r'^libpipewire-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'PipeWire %s module', extra_depends='', recursive=False)
109}
110
111python set_dynamic_metapkg_rdepends () {
112 import os
113 import oe.utils
114
115 # Go through all generated SPA plugin and PipeWire module packages
116 # (excluding the main package and the -meta package itself) and
117 # add them to the -meta package as RDEPENDS.
118
119 base_pn = d.getVar('PN')
120
121 spa_pn = base_pn + '-spa-plugins'
122 spa_metapkg = spa_pn + '-meta'
123
124 pw_module_pn = base_pn + '-modules'
125 pw_module_metapkg = pw_module_pn + '-meta'
126
127 d.setVar('ALLOW_EMPTY_' + spa_metapkg, "1")
128 d.setVar('FILES_' + spa_metapkg, "")
129
130 d.setVar('ALLOW_EMPTY_' + pw_module_metapkg, "1")
131 d.setVar('FILES_' + pw_module_metapkg, "")
132
133 blacklist = [ spa_pn, spa_metapkg, pw_module_pn, pw_module_metapkg ]
134 spa_metapkg_rdepends = []
135 pw_module_metapkg_rdepends = []
136 pkgdest = d.getVar('PKGDEST')
137
138 for pkg in oe.utils.packages_filter_out_system(d):
139 if pkg in blacklist:
140 continue
141
142 is_spa_pkg = pkg.startswith(spa_pn)
143 is_pw_module_pkg = pkg.startswith(pw_module_pn)
144 if not is_spa_pkg and not is_pw_module_pkg:
145 continue
146
147 if pkg in spa_metapkg_rdepends or pkg in pw_module_metapkg_rdepends:
148 continue
149
150 # See if the package is empty by looking at the contents of its
151 # PKGDEST subdirectory. If this subdirectory is empty, then then
152 # package is empty as well. Empty packages do not get added to
153 # the meta package's RDEPENDS.
154 pkgdir = os.path.join(pkgdest, pkg)
155 if os.path.exists(pkgdir):
156 dir_contents = os.listdir(pkgdir) or []
157 else:
158 dir_contents = []
159 is_empty = len(dir_contents) == 0
160 if not is_empty:
161 if is_spa_pkg:
162 spa_metapkg_rdepends.append(pkg)
163 if is_pw_module_pkg:
164 pw_module_metapkg_rdepends.append(pkg)
165
166 d.setVar('RDEPENDS_' + spa_metapkg, ' '.join(spa_metapkg_rdepends))
167 d.setVar('DESCRIPTION_' + spa_metapkg, spa_pn + ' meta package')
168
169 d.setVar('RDEPENDS_' + pw_module_metapkg, ' '.join(pw_module_metapkg_rdepends))
170 d.setVar('DESCRIPTION_' + pw_module_metapkg, pw_module_pn + ' meta package')
171}
172
173PACKAGES =+ "\
174 libpipewire \
175 ${PN}-tools \
176 ${PN}-pulse \
177 ${PN}-alsa \
178 ${PN}-jack \
179 ${PN}-media-session \
180 ${PN}-spa-plugins \
181 ${PN}-spa-plugins-meta \
182 ${PN}-spa-tools \
183 ${PN}-modules \
184 ${PN}-modules-meta \
185 ${PN}-alsa-card-profile \
186 gstreamer1.0-pipewire \
187"
188
189PACKAGES_DYNAMIC = "^${PN}-spa-plugins.* ^${PN}-modules.*"
190
191SYSTEMD_SERVICE_${PN} = "pipewire.service"
192CONFFILES_${PN} += "${sysconfdir}/pipewire/pipewire.conf"
193FILES_${PN} = " \
194 ${sysconfdir}/pipewire/pipewire.conf \
195 ${systemd_user_unitdir}/pipewire.* \
196 ${bindir}/pipewire \
197"
198
199FILES_${PN}-dev += " \
200 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so \
201"
202
203CONFFILES_libpipewire += "${sysconfdir}/pipewire/client.conf"
204FILES_libpipewire = " \
205 ${sysconfdir}/pipewire/client.conf \
206 ${libdir}/libpipewire-*.so.* \
207"
208# Add the bare minimum modules and plugins required to be able
209# to use libpipewire. Without these, it is essentially unusable.
210RDEPENDS_libpipewire += " \
211 ${PN}-modules-client-node \
212 ${PN}-modules-protocol-native \
213 ${PN}-spa-plugins-support \
214"
215
216FILES_${PN}-tools = " \
217 ${bindir}/pw-* \
218"
219
220# This is a shim daemon that is intended to be used as a
221# drop-in PulseAudio replacement, providing a pulseaudio-compatible
222# socket that can be used by applications that use libpulse.
223CONFFILES_${PN}-pulse += "${sysconfdir}/pipewire/pipewire-pulse.conf"
224FILES_${PN}-pulse = " \
225 ${sysconfdir}/pipewire/pipewire-pulse.conf \
226 ${systemd_user_unitdir}/pipewire-pulse.* \
227 ${bindir}/pipewire-pulse \
228"
229RDEPENDS_${PN}-pulse += " \
230 ${PN}-modules-protocol-pulse \
231"
232
233# alsa plugin to redirect audio to pipewire
234FILES_${PN}-alsa = "\
235 ${libdir}/alsa-lib/* \
236 ${datadir}/alsa/alsa.conf.d/* \
237"
238
239# jack drop-in libraries to redirect audio to pipewire
240CONFFILES_${PN}-jack = "${sysconfdir}/pipewire/jack.conf"
241FILES_${PN}-jack = "\
242 ${sysconfdir}/pipewire/jack.conf \
243 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \
244"
245
246# Example session manager. Not intended for use in production.
247CONFFILES_${PN}-media-session = "${sysconfdir}/pipewire/media-session.d/*"
Andrew Geissler32b11992021-03-31 13:37:05 -0500248SYSTEMD_SERVICE_${PN}-media-session = "pipewire-media-session.service"
Andrew Geissler97771a32021-03-05 15:23:11 -0600249FILES_${PN}-media-session = " \
250 ${bindir}/pipewire-media-session \
251 ${sysconfdir}/pipewire/media-session.d/* \
Andrew Geissler32b11992021-03-31 13:37:05 -0500252 ${systemd_system_unitdir}/pipewire-media-session.service \
Andrew Geissler97771a32021-03-05 15:23:11 -0600253"
254RPROVIDES_${PN}-media-session = "virtual/pipewire-sessionmanager"
255
256# Dynamic packages (see set_dynamic_metapkg_rdepends).
257FILES_${PN}-spa-plugins = ""
258RRECOMMENDS_${PN}-spa-plugins += "${PN}-spa-plugins-meta"
259
260FILES_${PN}-spa-tools = " \
261 ${bindir}/spa-* \
262"
263
264# Dynamic packages (see set_dynamic_metapkg_rdepends).
265FILES_${PN}-modules = ""
266RRECOMMENDS_${PN}-modules += "${PN}-modules-meta"
267
268CONFFILES_${PN}-modules-rtkit = "${sysconfdir}/pipewire/client-rt.conf"
269FILES_${PN}-modules-rtkit += " \
270 ${sysconfdir}/pipewire/client-rt.conf \
271 "
272
273FILES_${PN}-alsa-card-profile = " \
274 ${datadir}/alsa-card-profile/* \
275 ${nonarch_base_libdir}/udev/rules.d/90-pipewire-alsa.rules \
276"
277
278FILES_gstreamer1.0-pipewire = " \
279 ${libdir}/gstreamer-1.0/* \
280"