LADI
/
spa
1
Fork 0

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

@ -322,7 +322,11 @@ mathlib = cc.find_library('m', required : false)
rt_lib = cc.find_library('rt', required : false) # clock_gettime
dl_lib = cc.find_library('dl', required : false)
pthread_lib = dependency('threads')
dbus_dep = dependency('dbus-1')
dbus_dep = dependency('dbus-1', required : get_option('dbus'))
summary({'dbus (Bluetooth, rtkit, portal, pw-reserve)': dbus_dep.found()}, bool_yn: true, section: 'Misc dependencies')
if dbus_dep.found()
cdata.set('HAVE_DBUS', 1)
endif
sdl_dep = dependency('sdl2', required : get_option('sdl2'))
summary({'SDL 2': sdl_dep.found()}, bool_yn: true, section: 'Misc dependencies')
readline_dep = dependency('readline', required : false)

View File

@ -137,6 +137,10 @@ option('v4l2',
description: 'Enable v4l2 spa plugin integration',
type: 'feature',
value: 'auto')
option('dbus',
description: 'Enable code that depends on dbus',
type: 'feature',
value: 'enabled')
option('libcamera',
description: 'Enable libcamera spa plugin integration',
type: 'feature',

View File

@ -34,14 +34,16 @@ if not get_option('evl').disabled()
install_dir : spa_plugindir / 'support')
endif
spa_dbus_sources = ['dbus.c']
if dbus_dep.found()
spa_dbus_sources = ['dbus.c']
spa_dbus_lib = shared_library('spa-dbus',
spa_dbus_sources,
include_directories : [ spa_inc],
dependencies : [dbus_dep, ],
install : true,
install_dir : spa_plugindir / 'support')
spa_dbus_lib = shared_library('spa-dbus',
spa_dbus_sources,
include_directories : [ spa_inc],
dependencies : [dbus_dep, ],
install : true,
install_dir : spa_plugindir / 'support')
endif
if systemd_dep.found()

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

View File

@ -74,8 +74,6 @@ test('test context',
'test-config.c',
include_directories: pwtest_inc,
link_with: [pwtest_lib,
spa_support_lib,
spa_dbus_lib,
pipewire_module_protocol_native,
pipewire_module_client_node,
pipewire_module_client_device,

View File

@ -227,7 +227,9 @@ PWTEST(context_support)
SPA_TYPE_INTERFACE_Loop,
SPA_TYPE_INTERFACE_LoopUtils,
SPA_TYPE_INTERFACE_Log,
#if HAVE_DBUS
SPA_TYPE_INTERFACE_DBus,
#endif
SPA_TYPE_INTERFACE_CPU
};