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