From 881359183f163046ccc3c9dd4ded63a11e030e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 13 Dec 2022 16:47:48 +0100 Subject: [PATCH] =?UTF-8?q?meson:=20make=20=E2=80=98backlight=E2=80=99=20p?= =?UTF-8?q?lugin=20compile=20time=20optional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meson.build | 2 ++ meson_options.txt | 7 ++++++- modules/meson.build | 10 ++++++++-- plugin.c | 4 ++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index f176467..102cbc0 100644 --- a/meson.build +++ b/meson.build @@ -133,6 +133,7 @@ yambar = executable( decorations + particles + modules, c_args: [ plugin_alsa_enabled ? '-DPLUGIN_ENABLED_ALSA' : [], + plugin_backlight_enabled ? '-DPLUGIN_ENABLED_BACKLIGHT' : [], plugin_dwl_enabled ? '-DPLUGIN_ENABLED_DWL' : [], plugin_mpd_enabled ? '-DPLUGIN_ENABLED_MPD' : [], plugin_pipewire_enabled ? '-DPLUGIN_ENABLED_PIPEWIRE' : [], @@ -176,6 +177,7 @@ summary( summary( { 'ALSA': plugin_alsa_enabled, + 'Backlight': plugin_backlight_enabled, 'DWL (dwm for Wayland)': plugin_dwl_enabled, 'Music Player Daemon (MPD)': plugin_mpd_enabled, 'Pipewire': plugin_pipewire_enabled, diff --git a/meson_options.txt b/meson_options.txt index fd0718f..ab8837f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,7 +6,12 @@ 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-alsa', type: 'feature', value: 'auto', + description: 'ALSA support') +option('plugin-backlight', type: 'feature', value: 'auto', + description: 'Backlight support') +option('plugin-battery', type: 'feature', value: 'auto', + description: 'Battery support') option('plugin-dwl', type: 'feature', value: 'auto', description: 'DWL (dwm for wayland) support') option('plugin-mpd', type: 'feature', value: 'auto', diff --git a/modules/meson.build b/modules/meson.build index 4adc705..e4b7027 100644 --- a/modules/meson.build +++ b/modules/meson.build @@ -2,7 +2,7 @@ module_sdk = declare_dependency(dependencies: [pixman, threads, tllist, fcft]) modules = [] -udev = dependency('libudev') +udev = dependency('udev') json = dependency('json-c') xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11')) @@ -10,6 +10,9 @@ xcb_xkb = dependency('xcb-xkb', required: get_option('backend-x11')) alsa = dependency('alsa', required: get_option('plugin-alsa')) plugin_alsa_enabled = alsa.found() +udev_backlight = dependency('libudev', required: get_option('plugin-backlight')) +plugin_backlight_enabled = udev_backlight.found() + mpd = dependency('libmpdclient', required: get_option('plugin-mpd')) plugin_mpd_enabled = mpd.found() @@ -23,7 +26,6 @@ plugin_dwl_enabled = get_option('plugin-dwl').allowed() # Module name -> (source-list, dep-list) mod_data = { - 'backlight': [[], [m, udev]], 'battery': [[], [udev]], 'clock': [[], []], 'cpu': [[], []], @@ -41,6 +43,10 @@ if plugin_alsa_enabled mod_data += {'alsa': [[], [m, alsa]]} endif +if plugin_backlight_enabled + mod_data += {'backlight': [[], [m, udev_backlight]]} +endif + if plugin_dwl_enabled mod_data += {'dwl': [[], [dynlist]]} endif diff --git a/plugin.c b/plugin.c index a83dbad..8421176 100644 --- a/plugin.c +++ b/plugin.c @@ -35,7 +35,9 @@ #if defined(PLUGIN_ENABLED_ALSA) EXTERN_MODULE(alsa); #endif +#if defined(PLUGIN_ENABLED_BACKLIGHT) EXTERN_MODULE(backlight); +#endif EXTERN_MODULE(battery); EXTERN_MODULE(clock); EXTERN_MODULE(disk_io); @@ -129,7 +131,9 @@ init(void) #if defined(PLUGIN_ENABLED_ALSA) REGISTER_CORE_MODULE(alsa, alsa); #endif +#if defined(PLUGIN_ENABLED_BACKLIGHT) REGISTER_CORE_MODULE(backlight, backlight); +#endif REGISTER_CORE_MODULE(battery, battery); REGISTER_CORE_MODULE(clock, clock); REGISTER_CORE_MODULE(disk-io, disk_io);