From 8514f7bfa074ac9962ba6937c6bd9a79a60e9335 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Feb 2025 12:03:55 +0000 Subject: [PATCH 1/5] build: If expat is a submodule, explicitly disable its unit tests If we're falling back to building a local copy of expat, running or debugging its unit tests is out-of-scope for maintenance of dbus. In fact this is the default in the meson_options.txt provided by WrapDB[1], but explicit is better than implicit. [1] https://github.com/mesonbuild/wrapdb/blob/HEAD/subprojects/packagefiles/expat/meson_options.txt Signed-off-by: Simon McVittie --- meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 97d14593..2d8a1c6c 100644 --- a/meson.build +++ b/meson.build @@ -396,7 +396,12 @@ endif use_glib = glib.found() and gio.found() if message_bus - expat = dependency('expat') + expat = dependency( + 'expat', + default_options: [ + 'build_tests=false', + ], + ) else expat = dependency('', required: false) endif From 0d820a6e17e2dc3f1d3cba7b6c6ae76e78dd7670 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Feb 2025 12:05:02 +0000 Subject: [PATCH 2/5] build: Indent GLib subproject options consistently Signed-off-by: Simon McVittie --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2d8a1c6c..ff1312c3 100644 --- a/meson.build +++ b/meson.build @@ -376,7 +376,7 @@ else required: get_option('modular_tests'), fallback: ['glib', 'libglib_dep'], default_options: [ - 'tests=false', + 'tests=false', ], ) endif From 3ca6a3fec49cc39ed18a7bed0afe28685dca10de Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Feb 2025 12:29:55 +0000 Subject: [PATCH 3/5] build: Never make compiler warnings in subprojects fatal If one of our subprojects has compiler warnings, fixing them is out-of-scope for dbus. Signed-off-by: Simon McVittie --- meson.build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index ff1312c3..f46b551c 100644 --- a/meson.build +++ b/meson.build @@ -364,6 +364,10 @@ config.set( and cc.has_header_symbol('time.h', 'clock_getres', args: compile_args_c), ) +fallback_subproject_options = [ + 'werror=false', +] + # Controls whether message bus daemon is built. Tests which depend on # a running dbus-daemon will be disabled if message_bus is not set. message_bus = get_option('message_bus') @@ -375,7 +379,7 @@ else 'glib-2.0', version: '>=2.40', required: get_option('modular_tests'), fallback: ['glib', 'libglib_dep'], - default_options: [ + default_options: fallback_subproject_options + [ 'tests=false', ], ) @@ -398,7 +402,7 @@ use_glib = glib.found() and gio.found() if message_bus expat = dependency( 'expat', - default_options: [ + default_options: fallback_subproject_options + [ 'build_tests=false', ], ) From 57abac5bc890292c1d60c6df6ebef5987c2cbef2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Feb 2025 12:31:01 +0000 Subject: [PATCH 4/5] build: Link subprojects statically if built as a subproject If we're building a dependency as a fallback subproject, we don't want to be responsible for installing it as a shared library. Anyone wanting shared libraries should install the dependencies separately. Ideally we'd do this with MSVC too, but that doesn't currently link successfully (dbus#549). Signed-off-by: Simon McVittie --- meson.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/meson.build b/meson.build index f46b551c..19d842ce 100644 --- a/meson.build +++ b/meson.build @@ -368,6 +368,12 @@ fallback_subproject_options = [ 'werror=false', ] +if cc.get_id() != 'msvc' + # TODO: Ideally we'd have default_library=static with MSVC too, + # but see https://gitlab.freedesktop.org/dbus/dbus/-/issues/549 + fallback_subproject_options += ['default_library=static'] +endif + # Controls whether message bus daemon is built. Tests which depend on # a running dbus-daemon will be disabled if message_bus is not set. message_bus = get_option('message_bus') From 0a01eb02aefca258e1b970d36fa04886eeb03d5d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Feb 2025 12:15:22 +0000 Subject: [PATCH 5/5] build: If GLib is a subproject, disable GObject-Introspection We don't need this and it will only slow down the build. Signed-off-by: Simon McVittie --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 19d842ce..3f4ad316 100644 --- a/meson.build +++ b/meson.build @@ -386,6 +386,7 @@ else required: get_option('modular_tests'), fallback: ['glib', 'libglib_dep'], default_options: fallback_subproject_options + [ + 'introspection=disabled', 'tests=false', ], )