pipewire_1.4.1.bb 16 KB

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