meson: make it possible to compile without dbus

Make an option to disable dbus and all the code that depends on
it.

Fixes #1685
This commit is contained in:
Wim Taymans 2021-10-09 15:00:04 +02:00
parent caf0b2df19
commit 5f7c4dec34
8 changed files with 39 additions and 20 deletions

View file

@ -201,15 +201,10 @@ pipewire_module_protocol_native = shared_library('pipewire-module-protocol-nativ
pipewire_module_protocol_pulse_deps = pipewire_module_protocol_deps
if dbus_dep.found()
pipewire_module_protocol_pulse_deps += dbus_dep
endif
pipewire_module_protocol_pulse_sources = [
'module-protocol-pulse.c',
'module-protocol-pulse/client.c',
'module-protocol-pulse/collect.c',
'module-protocol-pulse/dbus-name.c',
'module-protocol-pulse/extension.c',
'module-protocol-pulse/format.c',
'module-protocol-pulse/manager.c',
@ -246,6 +241,14 @@ pipewire_module_protocol_pulse_sources = [
'module-protocol-pulse/modules/module-zeroconf-discover.c',
]
if dbus_dep.found()
pipewire_module_protocol_pulse_sources += [
'module-protocol-pulse/dbus-name.c',
]
pipewire_module_protocol_pulse_deps += dbus_dep
cdata.set('HAVE_DBUS', 1)
endif
if avahi_dep.found()
pipewire_module_protocol_pulse_sources += [
'module-protocol-pulse/modules/module-zeroconf-publish.c',

View file

@ -4936,8 +4936,10 @@ static void impl_free(struct impl *impl)
struct client *c;
struct message *msg;
#if HAVE_DBUS
if (impl->dbus_name)
dbus_release_name(impl->dbus_name);
#endif
spa_list_consume(msg, &impl->free_messages, link)
message_free(impl, msg, true, true);
@ -5111,7 +5113,9 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
pw_context_add_listener(context, &impl->context_listener,
&context_events, impl);
#if HAVE_DBUS
impl->dbus_name = dbus_request_name(context, "org.pulseaudio.Server");
#endif
return (struct pw_protocol_pulse *) impl;

View file

@ -67,8 +67,10 @@ elif not sndfile_dep.found() and get_option('pw-cat').enabled()
endif
summary({'Build pw-cat tool': build_pw_cat}, bool_yn: true, section: 'pw-cat/pw-play/pw-dump tool')
executable('pw-reserve',
'pw-reserve.c',
install: true,
dependencies : [dbus_dep, pipewire_dep],
)
if dbus_dep.found()
executable('pw-reserve',
'pw-reserve.c',
install: true,
dependencies : [dbus_dep, pipewire_dep],
)
endif