From 82c564f5eed195dfecc66cd976d048b856566103 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 9 Mar 2025 21:43:47 +0100 Subject: [PATCH] modules/mpris: fix dependency search Move dependency discovery to be with other module dependency searches. Also only define the `sdbus` dependency if the module is enabled. For some reason, `mpris.c` was attempted to be compiled even with the option off otherwise. It is also just more consistent. --- meson.build | 4 ---- modules/meson.build | 8 +++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 1a6d211..e1f695a 100644 --- a/meson.build +++ b/meson.build @@ -77,10 +77,6 @@ backend_wayland = wayland_client.found() and wayland_cursor.found() tllist = dependency('tllist', version: '>=1.0.1', fallback: 'tllist') fcft = dependency('fcft', version: ['>=3.0.0', '<4.0.0'], fallback: 'fcft') -# DBus dependency. Used by 'modules/mpris' -sdbus_library = dependency('libsystemd', 'libelogind', 'basu', required: get_option('plugin-mpris')) -sdbus = declare_dependency(compile_args: ['-DHAVE_' + sdbus_library.name().to_upper()], dependencies:[sdbus_library]) - add_project_arguments( cc_flags + ['-D_GNU_SOURCE'] + diff --git a/modules/meson.build b/modules/meson.build index 0e65812..f6d53d8 100644 --- a/modules/meson.build +++ b/modules/meson.build @@ -22,8 +22,9 @@ plugin_mem_enabled = get_option('plugin-mem').allowed() mpd = dependency('libmpdclient', required: get_option('plugin-mpd')) plugin_mpd_enabled = mpd.found() -mpris = sdbus -plugin_mpris_enabled = sdbus.found() +# DBus dependency. Used by 'mpris' +sdbus_library = dependency('libsystemd', 'libelogind', 'basu', required: get_option('plugin-mpris')) +plugin_mpris_enabled = sdbus_library.found() json_i3 = dependency('json-c', required: get_option('plugin-i3')) plugin_i3_enabled = json_i3.found() @@ -99,7 +100,8 @@ if plugin_mpd_enabled endif if plugin_mpris_enabled - mod_data += {'mpris': [[], [mpris]]} + sdbus = declare_dependency(compile_args: ['-DHAVE_' + sdbus_library.name().to_upper()], dependencies:[sdbus_library]) + mod_data += {'mpris': [[], [sdbus]]} endif if plugin_i3_enabled