blob: 0203f8bf5098d120c5916fef0c3cbf008d583430 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "Session / policy manager implementation for PipeWire"
2HOMEPAGE = "https://gitlab.freedesktop.org/pipewire/wireplumber"
3BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/wireplumber/issues"
4AUTHOR = "George Kiagiadakis <george.kiagiadakis@collabora.com>"
5SECTION = "multimedia"
6
7LICENSE = "MIT"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=17d1fe479cdec331eecbc65d26bc7e77"
9
10DEPENDS = "glib-2.0 glib-2.0-native lua pipewire \
11 ${@bb.utils.contains("DISTRO_FEATURES", "gobject-introspection-data", "python3-native python3-lxml-native doxygen-native", "", d)} \
12"
13
14SRCREV = "7cb1b8b92e96ebd1b7e632cda32715fed713d333"
15SRC_URI = " \
16 git://gitlab.freedesktop.org/pipewire/wireplumber.git;branch=master;protocol=https \
17 file://90-OE-disable-session-dbus-dependent-features.lua \
18"
19
20S = "${WORKDIR}/git"
21
22inherit meson pkgconfig gobject-introspection systemd
23
24GIR_MESON_ENABLE_FLAG = 'enabled'
25GIR_MESON_DISABLE_FLAG = 'disabled'
26
27# Enable system-lua to let wireplumber use OE's lua.
28# Documentation needs python-sphinx, which is not in oe-core or meta-python2 for now.
29# elogind is not (yet) available in OE, so disable support.
30EXTRA_OEMESON += " \
31 -Ddoc=disabled \
32 -Dsystem-lua=true \
33 -Delogind=disabled \
34 -Dsystemd-system-unit-dir=${systemd_system_unitdir} \
35 -Dsystemd-user-unit-dir=${systemd_user_unitdir} \
36 -Dtests=false \
37"
38
39PACKAGECONFIG ??= " dbus \
40 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \
41"
42
43PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd"
44PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=true,-Dsystemd-system-service=false,systemd"
45# "systemd-user-service" packageconfig will only install service
46# files to rootfs but not enable them as systemd.bbclass
47# currently lacks the feature of enabling user services.
48PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=true,-Dsystemd-user-service=false,systemd"
49PACKAGECONFIG[dbus] = ""
50
51PACKAGESPLITFUNCS:prepend = " split_dynamic_packages "
52PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends "
53
54WP_MODULE_SUBDIR = "wireplumber-0.4"
55
56do_install:append() {
57 if ${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'false', 'true', d)}; then
58 install -m 0644 ${WORKDIR}/90-OE-disable-session-dbus-dependent-features.lua ${D}${datadir}/wireplumber/main.lua.d
59 fi
60}
61
62python split_dynamic_packages () {
63 # Create packages for each WirePlumber module.
64 wp_module_libdir = d.expand('${libdir}/${WP_MODULE_SUBDIR}')
65 do_split_packages(d, wp_module_libdir, r'^libwireplumber-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'WirePlumber %s module', extra_depends='', recursive=False)
66}
67
68python set_dynamic_metapkg_rdepends () {
69 import os
70 import oe.utils
71
72 # Go through all generated WirePlumber module packages
73 # (excluding the main package and the -meta package itself)
74 # and add them to the -meta package as RDEPENDS.
75
76 base_pn = d.getVar('PN')
77
78 wp_module_pn = base_pn + '-modules'
79 wp_module_metapkg = wp_module_pn + '-meta'
80
81 d.setVar('ALLOW_EMPTY:' + wp_module_metapkg, "1")
82 d.setVar('FILES:' + wp_module_metapkg, "")
83
84 blacklist = [ wp_module_pn, wp_module_metapkg ]
85 wp_module_metapkg_rdepends = []
86 pkgdest = d.getVar('PKGDEST')
87
88 for pkg in oe.utils.packages_filter_out_system(d):
89 if pkg in blacklist:
90 continue
91
92 is_wp_module_pkg = pkg.startswith(wp_module_pn)
93 if not is_wp_module_pkg:
94 continue
95
96 if pkg in wp_module_metapkg_rdepends:
97 continue
98
99 # See if the package is empty by looking at the contents of its
100 # PKGDEST subdirectory. If this subdirectory is empty, then then
101 # package is empty as well. Empty packages do not get added to
102 # the meta package's RDEPENDS.
103 pkgdir = os.path.join(pkgdest, pkg)
104 if os.path.exists(pkgdir):
105 dir_contents = os.listdir(pkgdir) or []
106 else:
107 dir_contents = []
108 is_empty = len(dir_contents) == 0
109 if not is_empty:
110 if is_wp_module_pkg:
111 wp_module_metapkg_rdepends.append(pkg)
112
113 d.setVar('RDEPENDS:' + wp_module_metapkg, ' '.join(wp_module_metapkg_rdepends))
114 d.setVar('DESCRIPTION:' + wp_module_metapkg, wp_module_pn + ' meta package')
115}
116
117PACKAGES =+ "\
118 libwireplumber \
119 ${PN}-default-config \
120 ${PN}-scripts \
121 ${PN}-modules \
122 ${PN}-modules-meta \
123"
124
125PACKAGES_DYNAMIC = "^${PN}-modules.*"
126
127CONFFILES:${PN} += " \
128 ${datadir}/wireplumber/wireplumber.conf \
129 ${datadir}/wireplumber/*.lua.d/* \
130"
131# Add pipewire to RRECOMMENDS, since WirePlumber expects a PipeWire daemon to
132# be present. While in theory any application that uses libpipewire can configure
133# itself to become a daemon, in practice, the PipeWire daemon is used.
134RRECOMMENDS:${PN} += "pipewire ${PN}-scripts ${PN}-modules-meta"
135
136FILES:${PN} += "${systemd_user_unitdir} ${systemd_system_unitdir}"
137
138FILES:libwireplumber = " \
139 ${libdir}/libwireplumber-*.so.* \
140"
141
142FILES:${PN}-scripts += "${datadir}/wireplumber/scripts/*"
143
144# Dynamic packages (see set_dynamic_metapkg_rdepends).
145FILES:${PN}-modules = ""
146RRECOMMENDS:${PN}-modules += "${PN}-modules-meta"