From 10f048fcd18822d38348b2406e3e4bc898fb4a3a Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 9 Jul 2025 08:23:35 +0200 Subject: [PATCH 1/7] meson: stop discovering native version of Python When Python features are enabled we search both for a native and non-native version of Python. This is wrong though: we don't use Python in our build process, so there is no need to search for it in the first place. There is one location where we use the native version of Python, namely when deciding whether or not we want to wire up git-p4(1). This check is invalid though, as we shouldn't check for the build host to have Python, but for the target host. Fix this invalid check to use the non-native version of Python and stop searching for a native version of Python altogether. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 596f5ac711..8026a064c9 100644 --- a/meson.build +++ b/meson.build @@ -866,9 +866,11 @@ if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' endif build_options_config.set_quoted('X', executable_suffix) -python = import('python').find_installation('python3', required: get_option('python')) -target_python = find_program('python3', native: false, required: python.found()) -if python.found() +# Python is not used for our build system, but exclusively for git-p4. +# Consequently we only need to determine whether Python is available for the +# build target. +target_python = find_program('python3', native: false, required: get_option('python')) +if target_python.found() build_options_config.set('NO_PYTHON', '') else libgit_c_args += '-DNO_PYTHON' @@ -1979,7 +1981,7 @@ if perl_features_enabled subdir('perl') endif -if python.found() +if target_python.found() scripts_python = [ 'git-p4.py' ] @@ -2190,7 +2192,7 @@ summary({ 'iconv': iconv.found(), 'pcre2': pcre2.found(), 'perl': perl_features_enabled, - 'python': python.found(), + 'python': target_python.found(), }, section: 'Auto-detected features') summary({ From f61f538576c1e11c56e10587242de793fd4dde9a Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 9 Jul 2025 08:23:36 +0200 Subject: [PATCH 2/7] meson: stop printing 'https' option twice in our summaries The value for the 'https' backend option is printed twice: once via the summary of auto-detected features and once via our summary of backends. Drop it from the former summary. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/meson.build b/meson.build index 8026a064c9..0e9c7704e1 100644 --- a/meson.build +++ b/meson.build @@ -2188,7 +2188,6 @@ summary({ 'expat': expat.found(), 'gettext': intl.found(), 'gitweb': gitweb_option.allowed(), - 'https': https_backend, 'iconv': iconv.found(), 'pcre2': pcre2.found(), 'perl': perl_features_enabled, From dfc4617a5354dc8893b4453998d4307f211670bf Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 9 Jul 2025 08:23:37 +0200 Subject: [PATCH 3/7] meson: improve summary of auto-detected features The summary of auto-detected features prints a boolean for every option to tell the user whether or not the feature has been auto-enabled or not. This summary can be improved though, as in some cases this boolean is derived from a dependency. So if we pass in the dependency directly, then Meson knows to both print a boolean and, if the dependency was found, it also prints a version number. Adapt the code accordingly and enable `bool_yn` so that actual booleans are formatted similarly to dependencies. Before this change: Auto-detected features benchmarks : true curl : true expat : true gettext : true gitweb : true iconv : true pcre2 : true perl : true python : true And after this change, we now see the version numbers as expected: Auto-detected features benchmarks : YES curl : YES 8.14.1 expat : YES 2.7.1 gettext : YES gitweb : YES iconv : YES pcre2 : YES 10.44 perl : YES python : YES Note that this change also enables colorization of the boolean options, green for "YES" and red for "NO". Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 0e9c7704e1..235609db5c 100644 --- a/meson.build +++ b/meson.build @@ -2184,15 +2184,15 @@ meson.add_dist_script( summary({ 'benchmarks': get_option('tests') and perl.found() and time.found(), - 'curl': curl.found(), - 'expat': expat.found(), - 'gettext': intl.found(), + 'curl': curl, + 'expat': expat, + 'gettext': intl, 'gitweb': gitweb_option.allowed(), - 'iconv': iconv.found(), - 'pcre2': pcre2.found(), + 'iconv': iconv, + 'pcre2': pcre2, 'perl': perl_features_enabled, 'python': target_python.found(), -}, section: 'Auto-detected features') +}, section: 'Auto-detected features', bool_yn: true) summary({ 'csprng': csprng_backend, From e69b3b367fb6217b8d43ef8348dff82aabbba5e2 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 9 Jul 2025 08:23:38 +0200 Subject: [PATCH 4/7] meson: clean up unnecessary variables The `manpage_target` variable isn't used at all, and the `manpage_path` variable is only used in a single location. Remove the former variable and inline the latter. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- Documentation/meson.build | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Documentation/meson.build b/Documentation/meson.build index 1433acfd31..e64bf1b46e 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -375,8 +375,7 @@ foreach manpage, category : manpages output: fs.stem(manpage) + '.xml', ) - manpage_path = fs.stem(manpage) + '.' + category.to_string() - manpage_target = custom_target( + custom_target( command: [ xmlto, '-m', '@INPUT0@', @@ -392,7 +391,7 @@ foreach manpage, category : manpages 'manpage-normal.xsl', 'manpage-bold-literal.xsl', ], - output: manpage_path, + output: fs.stem(manpage) + '.' + category.to_string(), install: true, install_dir: get_option('mandir') / 'man' + category.to_string(), ) From fcf1014c5fcc1de6932572bede437f0049411eef Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 9 Jul 2025 08:23:39 +0200 Subject: [PATCH 5/7] meson: fix lookup of shell on MINGW64 In 4cba20fbdc6 (meson: prefer shell at "/bin/sh", 2025-04-25) we have addressed an issue where the shell path embedded into Git was looked up via PATH, which easily led to unportable shell paths other than the usual "/bin/sh" location. The fix was to simply add '/bin' to the search path explicitly, which made us prefer that directory over the PATH-based lookup. This fix causes issues on MINGW64 though, which uses Windows-style paths. "/bin" is not an absolute Windows-style path, but Meson expects the directories to be absolute. This leads to the following error: meson.build:248:15: ERROR: Search directory /bin is not an absolute path. Fix this by instead searching for both '/bin/sh' and 'sh', which also causes us to prefer '/bin/sh' over a PATH-based lookup. Meson does accept that path alright on MINGW64, even though it's not an absolute Windows-style path, either. Furthermore, this continues to work alright with cross-files, as well, in case one wants to explicitly override the shell path: $ meson setup build ... Runtime executable paths perl : /nix/store/gy10hw004rl2xfbfq41vnw0yb1w8rvbl-perl-5.40.0/bin/perl python : /nix/store/sd81bvmch7njdpwx3lkjslixcbj5mivz-python3-3.13.4/bin/python3 shell : /bin/sh $ cat >cross.ini <<-EOF [binaries] sh = '/nix/store/94lg0shvsfc845zy8gnflvpqxxiyijbz-bash-interactive-5.2p37/bin/bash' EOF $ meson setup build --cross-file=cross.ini --wipe ... Runtime executable paths perl : /nix/store/gy10hw004rl2xfbfq41vnw0yb1w8rvbl-perl-5.40.0/bin/perl python : /nix/store/sd81bvmch7njdpwx3lkjslixcbj5mivz-python3-3.13.4/bin/python3 shell : /nix/store/94lg0shvsfc845zy8gnflvpqxxiyijbz-bash-interactive-5.2p37/bin/bash Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 235609db5c..61e15cc554 100644 --- a/meson.build +++ b/meson.build @@ -245,7 +245,7 @@ time = find_program('time', dirs: program_path, required: get_option('benchmarks # "/bin/sh" over a PATH-based lookup, which provides a working shell on most # supported systems. This path is also the default shell path used by our # Makefile. This lookup can be overridden via `program_path`. -target_shell = find_program('sh', dirs: program_path + [ '/bin' ], native: false) +target_shell = find_program('/bin/sh', 'sh', dirs: program_path, native: false) # Sanity-check that programs required for the build exist. foreach tool : ['cat', 'cut', 'grep', 'sort', 'tr', 'uname'] From 164cbd679c1bc9daf3176655b007971257bd681d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 9 Jul 2025 08:23:41 +0200 Subject: [PATCH 6/7] meson: update subproject wrappers Update subproject wrappers to newer versions by executing `meson wrap update` in the project's root directory Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- subprojects/expat.wrap | 18 +++++++++--------- subprojects/pcre2.wrap | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap index 2e0427dcfd..0e9292f97b 100644 --- a/subprojects/expat.wrap +++ b/subprojects/expat.wrap @@ -1,13 +1,13 @@ [wrap-file] -directory = expat-2.6.3 -source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz -source_filename = expat-2.6.3.tar.bz2 -source_hash = 274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc -patch_filename = expat_2.6.3-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.6.3-1/get_patch -patch_hash = cf017fbe105e31428b2768360bd9be39094df4e948a1e8d1c54b6f7c76460cb1 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.6.3-1/expat-2.6.3.tar.bz2 -wrapdb_version = 2.6.3-1 +directory = expat-2.7.1 +source_url = https://github.com/libexpat/libexpat/releases/download/R_2_7_1/expat-2.7.1.tar.xz +source_filename = expat-2.7.1.tar.bz2 +source_hash = 354552544b8f99012e5062f7d570ec77f14b412a3ff5c7d8d0dae62c0d217c30 +patch_filename = expat_2.7.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.7.1-1/get_patch +patch_hash = fe28cbbc427a7c9787d08b969ad54d19f59d8dd18294b4a18651cecfc789d4ef +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.7.1-1/expat-2.7.1.tar.bz2 +wrapdb_version = 2.7.1-1 [provide] expat = expat_dep diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap index 7e18447254..f45c968e2f 100644 --- a/subprojects/pcre2.wrap +++ b/subprojects/pcre2.wrap @@ -1,13 +1,13 @@ [wrap-file] -directory = pcre2-10.44 -source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2 -source_filename = pcre2-10.44.tar.bz2 -source_hash = d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96 -patch_filename = pcre2_10.44-2_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.44-2/get_patch -patch_hash = 4336d422ee9043847e5e10dbbbd01940d4c9e5027f31ccdc33a7898a1ca94009 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.44-2/pcre2-10.44.tar.bz2 -wrapdb_version = 10.44-2 +directory = pcre2-10.45 +source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.tar.bz2 +source_filename = pcre2-10.45.tar.bz2 +source_hash = 21547f3516120c75597e5b30a992e27a592a31950b5140e7b8bfde3f192033c4 +patch_filename = pcre2_10.45-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.45-2/get_patch +patch_hash = 7c6f34b703708652a404f9dc2769c67658c437b6043573295fa3428a9b7a6807 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.45-2/pcre2-10.45.tar.bz2 +wrapdb_version = 10.45-2 [provide] libpcre2-8 = libpcre2_8 From d3d6493dcf35cc0ffb4ed88da85c3b206f02936a Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 9 Jul 2025 08:23:42 +0200 Subject: [PATCH 7/7] ci: use Meson's new `--slice` option As executing our test suite is notoriously slow on Windows we use matrix jobs in our CI systems to slice up tests and run them via multiple jobs. On Meson this is done with a comparatively complex PowerShell invocation as Meson didn't yet have a native way to slice tests like this. I have upstreamed a new `--slice` option [1] that addresses this use case though, which has been merged and released with Meson 1.8. Both GitLab and GitHub CI have Meson 1.8.2 available by now, so let's update the jobs to use that new option. [1]: https://github.com/mesonbuild/meson/pull/14092 Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- .github/workflows/main.yml | 2 +- .gitlab-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7dbf9f7f12..d122e79415 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -298,7 +298,7 @@ jobs: path: build - name: Test shell: pwsh - run: meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % 10 } | Where-Object Name -EQ ${{ matrix.nr }} | ForEach-Object { meson test -C build --no-rebuild --print-errorlogs $_.Group } + run: meson test -C build --no-rebuild --print-errorlogs --slice "$(1+${{ matrix.nr }})/10" regular: name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}}) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bb6d5b976c..af10ebb59a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -178,7 +178,7 @@ test:msvc-meson: - job: "build:msvc-meson" artifacts: true script: - - meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % $Env:CI_NODE_TOTAL + 1 } | Where-Object Name -EQ $Env:CI_NODE_INDEX | ForEach-Object { meson test -C build --no-rebuild --print-errorlogs $_.Group; if (!$?) { exit $LASTEXITCODE } } + - meson test -C build --no-rebuild --print-errorlogs --slice $Env:CI_NODE_INDEX/$Env:CI_NODE_TOTAL parallel: 10 test:fuzz-smoke-tests: