Make libmpdclient an optional dependency

Without this change yambar can't be installed/used without libmpdclient even for
people who do not use MPD. Let's make this optional.

We could put the optional module summary in the module meson.build but we'd have
to move summary() in main meson.build so that they appear in proper order.
This commit is contained in:
Stanislav Ochotnický 2021-09-16 10:24:53 +02:00
parent 12f7802537
commit e723b039ad
5 changed files with 26 additions and 2 deletions

View file

@ -11,6 +11,9 @@
## Unreleased
### Added
### Changed
* Made `libmpdclient` an optional dependency
### Deprecated
### Removed
### Fixed
@ -22,6 +25,7 @@
### Security
### Contributors
* [sochotnicky](https://codeberg.org/sochotnicky)
## 1.7.0

View file

@ -119,6 +119,7 @@ yambar = executable(
version,
dependencies: [bar, pixman, yaml, threads, dl, tllist, fcft] +
decorations + particles + modules,
c_args: [plugin_mpd_enabled? '-DPLUGIN_ENABLED_MPD':[]],
build_rpath: '$ORIGIN/modules:$ORIGIN/decorations:$ORIGIN/particles',
export_dynamic: true,
install: true,
@ -153,3 +154,9 @@ summary(
},
bool_yn: true
)
summary(
{'Music Player Daemon (MPD)': plugin_mpd_enabled},
section: 'Optional modules',
bool_yn: true
)

View file

@ -5,3 +5,6 @@ option(
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-mpd', type: 'feature', value: 'auto',
description: 'Music Player Daemon (MPD) support')

View file

@ -5,9 +5,12 @@ modules = []
alsa = dependency('alsa')
udev = dependency('libudev')
json = dependency('json-c')
mpd = dependency('libmpdclient')
xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11'))
# Optional deps
mpd = dependency('libmpdclient', required: get_option('plugin-mpd'))
plugin_mpd_enabled = mpd.found()
# Module name -> (source-list, dep-list)
mod_data = {
'alsa': [[], [m, alsa]],
@ -16,13 +19,16 @@ mod_data = {
'clock': [[], []],
'i3': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
'label': [[], []],
'mpd': [[], [mpd]],
'network': [[], []],
'removables': [[], [dynlist, udev]],
'script': [[], []],
'sway-xkb': [['i3-common.c', 'i3-common.h'], [dynlist, json]],
}
if plugin_mpd_enabled
mod_data += {'mpd': [[], [mpd]]}
endif
if backend_x11
mod_data += {
'xkb': [[], [xcb_stuff, xcb_xkb]],

View file

@ -39,7 +39,9 @@ EXTERN_MODULE(clock);
EXTERN_MODULE(foreign_toplevel);
EXTERN_MODULE(i3);
EXTERN_MODULE(label);
#if defined(PLUGIN_ENABLED_MPD)
EXTERN_MODULE(mpd);
#endif
EXTERN_MODULE(network);
EXTERN_MODULE(removables);
EXTERN_MODULE(river);
@ -117,7 +119,9 @@ init(void)
#endif
REGISTER_CORE_MODULE(i3, i3);
REGISTER_CORE_MODULE(label, label);
#if defined(PLUGIN_ENABLED_MPD)
REGISTER_CORE_MODULE(mpd, mpd);
#endif
REGISTER_CORE_MODULE(network, network);
REGISTER_CORE_MODULE(removables, removables);
#if defined(HAVE_PLUGIN_river)