meson: make ‘alsa’ plugin compile time optional

This commit is contained in:
Daniel Eklöf 2022-12-13 16:40:49 +01:00
parent f8f0d7ae99
commit 4c1398f1a5
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 19 additions and 6 deletions

View file

@ -132,10 +132,11 @@ yambar = executable(
dependencies: [bar, libepoll, libinotify, pixman, yaml, threads, dl, tllist, fcft] +
decorations + particles + modules,
c_args: [
plugin_mpd_enabled? '-DPLUGIN_ENABLED_MPD':[],
plugin_pulse_enabled? '-DPLUGIN_ENABLED_PULSE':[],
plugin_pipewire_enabled? '-DPLUGIN_ENABLED_PIPEWIRE':[],
plugin_dwl_enabled? '-DPLUGIN_ENABLED_DWL':[],
plugin_alsa_enabled ? '-DPLUGIN_ENABLED_ALSA' : [],
plugin_dwl_enabled ? '-DPLUGIN_ENABLED_DWL' : [],
plugin_mpd_enabled ? '-DPLUGIN_ENABLED_MPD' : [],
plugin_pipewire_enabled ? '-DPLUGIN_ENABLED_PIPEWIRE' : [],
plugin_pulse_enabled ? '-DPLUGIN_ENABLED_PULSE' : [],
],
build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles',
export_dynamic: true,
@ -174,6 +175,7 @@ summary(
summary(
{
'ALSA': plugin_alsa_enabled,
'DWL (dwm for Wayland)': plugin_dwl_enabled,
'Music Player Daemon (MPD)': plugin_mpd_enabled,
'Pipewire': plugin_pipewire_enabled,

View file

@ -6,6 +6,7 @@ option(
'core-plugins-as-shared-libraries', type: 'boolean', value: false,
description: 'Compiles modules, particles and decorations as shared libraries, which are loaded on-demand')
option('plugin-alsa', type: 'feature', value: 'auto', description: 'ALSA')
option('plugin-dwl', type: 'feature', value: 'auto',
description: 'DWL (dwm for wayland) support')
option('plugin-mpd', type: 'feature', value: 'auto',

View file

@ -2,14 +2,17 @@ module_sdk = declare_dependency(dependencies: [pixman, threads, tllist, fcft])
modules = []
alsa = dependency('alsa')
udev = dependency('libudev')
json = dependency('json-c')
xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11'))
# Optional deps
alsa = dependency('alsa', required: get_option('plugin-alsa'))
plugin_alsa_enabled = alsa.found()
mpd = dependency('libmpdclient', required: get_option('plugin-mpd'))
plugin_mpd_enabled = mpd.found()
pipewire = dependency('libpipewire-0.3', required: get_option('plugin-pipewire'))
plugin_pipewire_enabled = pipewire.found()
@ -20,7 +23,6 @@ plugin_dwl_enabled = get_option('plugin-dwl').allowed()
# Module name -> (source-list, dep-list)
mod_data = {
'alsa': [[], [m, alsa]],
'backlight': [[], [m, udev]],
'battery': [[], [udev]],
'clock': [[], []],
@ -35,6 +37,10 @@ mod_data = {
'sway-xkb': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
}
if plugin_alsa_enabled
mod_data += {'alsa': [[], [m, alsa]]}
endif
if plugin_dwl_enabled
mod_data += {'dwl': [[], [dynlist]]}
endif

View file

@ -32,7 +32,9 @@
keychain_t *chain, const struct yml_node *node); \
extern struct deco *plug_name##_from_conf(const struct yml_node *node);
#if defined(PLUGIN_ENABLED_ALSA)
EXTERN_MODULE(alsa);
#endif
EXTERN_MODULE(backlight);
EXTERN_MODULE(battery);
EXTERN_MODULE(clock);
@ -124,7 +126,9 @@ init(void)
tll_back(plugins).decoration = &deco_##func_prefix##_iface; \
} while (0)
#if defined(PLUGIN_ENABLED_ALSA)
REGISTER_CORE_MODULE(alsa, alsa);
#endif
REGISTER_CORE_MODULE(backlight, backlight);
REGISTER_CORE_MODULE(battery, battery);
REGISTER_CORE_MODULE(clock, clock);