From 19716312945cefff6196a141e468781f30d7aa6f Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 21 May 2025 13:08:50 +0200 Subject: [PATCH] meson: Don't define targets for standalone binaries if option is not enabled These are built from the same sources as the regular binaries, so we end up with the same sources multiple times in the compilation database but with different command line arguments, which trips up tooling that uses the compilation database. Let's not define the standalone targets if the option is not enabled to avoid this problem. --- meson.build | 4 ++++ src/repart/meson.build | 4 +--- src/shutdown/meson.build | 2 -- src/sysusers/meson.build | 4 +--- src/tmpfiles/meson.build | 4 +--- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/meson.build b/meson.build index 5dd5f348aa7..733390ae8f6 100644 --- a/meson.build +++ b/meson.build @@ -2424,6 +2424,10 @@ foreach dict : executables continue endif + if name.endswith('.standalone') and not have_standalone_binaries + continue + endif + kwargs = {} foreach key, val : dict if key in ['name', 'dbus', 'public', 'conditions', diff --git a/src/repart/meson.build b/src/repart/meson.build index 9c5778dffdc..369410bab8d 100644 --- a/src/repart/meson.build +++ b/src/repart/meson.build @@ -22,7 +22,7 @@ executables += [ }, executable_template + { 'name' : 'systemd-repart.standalone', - 'public' : have_standalone_binaries, + 'public' : true, 'sources' : files('repart.c'), 'c_args' : '-DSTANDALONE', 'link_with' : [ @@ -37,8 +37,6 @@ executables += [ libopenssl, threads, ], - 'build_by_default' : have_standalone_binaries, - 'install' : have_standalone_binaries, }, ] diff --git a/src/shutdown/meson.build b/src/shutdown/meson.build index c91253ca8e0..c67d19abcc5 100644 --- a/src/shutdown/meson.build +++ b/src/shutdown/meson.build @@ -28,8 +28,6 @@ executables += [ libsystemd_static, ], 'dependencies' : libmount, - 'build_by_default' : have_standalone_binaries, - 'install' : have_standalone_binaries, }, test_template + { 'sources' : files('test-umount.c'), diff --git a/src/sysusers/meson.build b/src/sysusers/meson.build index c968f55110c..88494d8cfce 100644 --- a/src/sysusers/meson.build +++ b/src/sysusers/meson.build @@ -13,7 +13,7 @@ executables += [ }, executable_template + { 'name' : 'systemd-sysusers.standalone', - 'public' : have_standalone_binaries, + 'public' : true, 'sources' : files('sysusers.c'), 'c_args' : '-DSTANDALONE', 'link_with' : [ @@ -22,7 +22,5 @@ executables += [ libsystemd_static, ], 'dependencies' : libaudit, - 'build_by_default' : have_standalone_binaries, - 'install' : have_standalone_binaries, }, ] diff --git a/src/tmpfiles/meson.build b/src/tmpfiles/meson.build index 1016573969a..404f265f918 100644 --- a/src/tmpfiles/meson.build +++ b/src/tmpfiles/meson.build @@ -21,7 +21,7 @@ executables += [ }, executable_template + { 'name' : 'systemd-tmpfiles.standalone', - 'public' : have_standalone_binaries, + 'public' : true, 'sources' : systemd_tmpfiles_sources + systemd_tmpfiles_extract_sources, 'c_args' : '-DSTANDALONE', 'link_with' : [ @@ -30,8 +30,6 @@ executables += [ libsystemd_static, ], 'dependencies' : libacl, - 'build_by_default' : have_standalone_binaries, - 'install' : have_standalone_binaries, }, test_template + { 'sources' : files('test-offline-passwd.c'), -- 2.47.3