From 92969629bd58713a80d45c2721f755c83c54f709 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 27 Oct 2026 12:06:49 -0400 Subject: [PATCH 1/4] meson: remove if conditionals for meson versions less than meson_version The minimum version is too high to allow these checks to ever be false. We can delete else branches as dead code and remove "if true" constants. Fixes: ``` meson.build:170: WARNING: Conditional on version '>= 0.55.0' always evaluates to true meson.build:232: WARNING: Conditional on version '>= 0.55.0' always evaluates to true ``` Signed-off-by: Eli Schwartz --- meson.build | 52 +++++++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/meson.build b/meson.build index dc314f73..ae0bde79 100644 --- a/meson.build +++ b/meson.build @@ -167,11 +167,7 @@ if not (host_machine.system() == 'windows' and get_option('debug')) test_ldflags += '-Wl,--dynamicbase' endif foreach ldflag : test_ldflags - if meson.version().version_compare('>= 0.55.0') - has_arg = cc.has_link_argument(ldflag) - else - has_arg = cc.has_argument(ldflag) - endif + has_arg = cc.has_link_argument(ldflag) if has_arg and cc.links('int main (void) { return 0; }', args: ldflag) global_ldflags += ldflag @@ -229,29 +225,27 @@ if cc.get_id() != 'msvc' meson.add_install_script('meson_post_install.py') endif -if meson.version().version_compare('>= 0.55.0') - summary({ - 'prefix': get_option('prefix'), - 'bindir': get_option('bindir'), - 'libdir': get_option('libdir'), - 'datadir': get_option('datadir'), - }, section: 'Directories') +summary({ + 'prefix': get_option('prefix'), + 'bindir': get_option('bindir'), + 'libdir': get_option('libdir'), + 'datadir': get_option('datadir'), +}, section: 'Directories') - summary({ - 'GTK Frontend': get_option('gtk-frontend') ? 'enabled (GTK+ 3.22+)' : 'disabled', - 'TLS (openssl)': libssl_dep.found(), - 'Plugin Support': get_option('plugin'), - 'DBus Support': dbus_dep.found(), - 'libcanberra': libcanberra_dep.found(), - }, section: 'Features') +summary({ + 'GTK Frontend': get_option('gtk-frontend') ? 'enabled (GTK+ 3.22+)' : 'disabled', + 'TLS (openssl)': libssl_dep.found(), + 'Plugin Support': get_option('plugin'), + 'DBus Support': dbus_dep.found(), + 'libcanberra': libcanberra_dep.found(), +}, section: 'Features') - summary({ - 'Lua': get_option('with-lua'), - 'Python': get_option('with-python'), - 'Perl': get_option('with-perl'), - 'Perl Legacy API': get_option('with-perl-legacy-api'), - 'FiSH': get_option('with-fishlim'), - 'Sysinfo': get_option('with-sysinfo'), - 'DCC Checksum': get_option('with-checksum'), - }, section: 'Plugins') -endif +summary({ + 'Lua': get_option('with-lua'), + 'Python': get_option('with-python'), + 'Perl': get_option('with-perl'), + 'Perl Legacy API': get_option('with-perl-legacy-api'), + 'FiSH': get_option('with-fishlim'), + 'Sysinfo': get_option('with-sysinfo'), + 'DCC Checksum': get_option('with-checksum'), +}, section: 'Plugins') From 2b4e79faa7c5c47be31346241ed38714c854ac96 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 27 Oct 2026 12:07:09 -0400 Subject: [PATCH 2/4] meson: explicitly mark run_command as fallible when returncode is checked Meson emits a warning stating that the default will change from false to true, in some future version, and that one should always pass `check: BOOL` explicitly. Normally this is because commands that unexpectedly fail would result in wrong behavior if the build treats it as though it succeeded. In this case, we were specifically relying on it being `check: false`, as the returncode is immediately checked in order to provide a better error message. Make this explicit in the meson.build file. Signed-off-by: Eli Schwartz --- plugins/perl/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/perl/meson.build b/plugins/perl/meson.build index 95421a06..a2d215ef 100644 --- a/plugins/perl/meson.build +++ b/plugins/perl/meson.build @@ -28,7 +28,7 @@ endif perl = find_program(get_option('with-perl')) -ret = run_command([perl, '-MExtUtils::Embed', '-e', 'ccopts']) +ret = run_command([perl, '-MExtUtils::Embed', '-e', 'ccopts'], check: false) if ret.returncode() != 0 error('perl: Failed to get cflags') endif @@ -38,7 +38,7 @@ foreach flag : ret.stdout().strip().split(' ') endif endforeach -ret = run_command([perl, '-MExtUtils::Embed', '-e', 'ldopts']) +ret = run_command([perl, '-MExtUtils::Embed', '-e', 'ldopts'], check: false) if ret.returncode() != 0 error('perl: Failed to get ldflags') endif From ede2251c36f78980bdc70a9f3fb411f6f526d8ef Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 27 Oct 2026 12:10:37 -0400 Subject: [PATCH 3/4] meson: port off of deprecated functions meson.source_root() is deprecated since 0.56, and should be replaced with either project_source_root or global_source_root depending on whether it is supposed to refer to a different subproject if the current project is a subproject. The default for source_root itself was the latter, which is broken in subproject builds, and is also incorrect for us since our usage is to construct the path to a file that is part of the zoitechat source tree. Make this work semantically correctly by specifically accessing the root of the current (sub)project, and fix a deprecation warning in the process. Signed-off-by: Eli Schwartz --- plugins/perl/meson.build | 2 +- src/fe-gtk/meson.build | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/perl/meson.build b/plugins/perl/meson.build index a2d215ef..aa7a16af 100644 --- a/plugins/perl/meson.build +++ b/plugins/perl/meson.build @@ -79,7 +79,7 @@ perl_cflags += ['-Wno-strict-prototypes'] perl_cflags += [ # Perl has its own 'config.h' that we must override # TODO: Just rename ours to something more unique. - '-include', meson.build_root() + '/config.h' + '-include', meson.project_build_root() + '/config.h' ] if not cc.links(''' diff --git a/src/fe-gtk/meson.build b/src/fe-gtk/meson.build index 699d0ccc..fa8c2c6c 100644 --- a/src/fe-gtk/meson.build +++ b/src/fe-gtk/meson.build @@ -167,7 +167,7 @@ emoji_ui_tests = executable('emoji_ui_tests', dependencies: emoji_font_deps, ) test('Emoji UI Tests', emoji_ui_tests, - env: ['ZOITECHAT_EMOJI_FONT=' + join_paths(meson.source_root(), 'data/fonts/NotoColorEmoji.ttf')], + env: ['ZOITECHAT_EMOJI_FONT=' + join_paths(meson.project_source_root(), 'data/fonts/NotoColorEmoji.ttf')], protocol: 'tap', timeout: 120, ) @@ -291,7 +291,7 @@ emoji_font_tests = executable('emoji_font_tests', dependencies: emoji_font_deps, ) test('Emoji Font Tests', emoji_font_tests, - env: ['ZOITECHAT_EMOJI_FONT=' + join_paths(meson.source_root(), 'data/fonts/NotoColorEmoji.ttf')], + env: ['ZOITECHAT_EMOJI_FONT=' + join_paths(meson.project_source_root(), 'data/fonts/NotoColorEmoji.ttf')], protocol: 'tap', timeout: 120, ) From dc4d6203a508525b8df196f9c3a1d8d11b94d283 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 27 Oct 2026 12:16:11 -0400 Subject: [PATCH 4/4] meson: extract the version directly from ./VERSION without subprocesses With the new minimum meson_version, it is possible to retrieve the project version from a file by passing a files() output directly to the version argument. It is no longer necessary to call run_command with various arguments to configure its behavior, nor depend on a system /usr/bin/cat (which admittedly does exist on non-Windows systems). And meson will also treat the VERSION file as a build input, and reconfigure the build if it changes -- meaning that the built binaries are updated to have the correct version number (configure_file, PACKAGE_VERSION, etc). Signed-off-by: Eli Schwartz --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ae0bde79..d29af737 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('zoitechat', 'c', - version: run_command('cat', 'VERSION', check: true).stdout().strip(), + version: files('VERSION'), meson_version: '>= 0.59.0', default_options: [ 'c_std=c17',