From d874d378379f4a2e7fa0a8ab52ff6e407f4da343 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Tue, 18 Feb 2025 15:30:42 +0000 Subject: [PATCH 1/2] meson: bump minimum required Perl version to 5.26.0 Commit 702d8c1f3b (Require Perl 5.26.0, 2024-10-23) dropped support for Perl versions older than 5.26.0. The Meson build system, which has been developed in parallel to that commit, hasn't been bumped accordingly and thus still requires Perl 5.8.1 or newer. Fix this by requiring Perl 5.26.0 or newer with Meson. Signed-off-by: Peter Oliver Reviewed-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 0df3872c6a..2ffea06aa7 100644 --- a/meson.build +++ b/meson.build @@ -777,7 +777,7 @@ endif # Note that we only set NO_PERL if the Perl features were disabled by the user. # It may not be set when we have found Perl, but only use it to run tests. -perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required) +perl = find_program('perl', version: '>=5.26.0', dirs: program_path, required: perl_required) perl_features_enabled = perl.found() and get_option('perl').allowed() if perl_features_enabled build_options_config.set('NO_PERL', '') From 0bf8d1b3954920eb6d9304d187af18fea5f318fd Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Tue, 18 Feb 2025 15:30:43 +0000 Subject: [PATCH 2/2] meson: fix Perl version check for Meson versions before 1.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Command `perl --version` says, e.g., “This is perl 5, version 26, subversion 0 (v5.26.0)”, which older versions of Meson interpret as version 26. This will be fixed in Meson 1.7.0, but at the time of writing that isn’t yet released. If we run `perl -V:version` we get the unambiguous response “version='5.26.0';”, but we need at least Meson 1.5.0 to be able to do that. Note that Perl are seriously considering dropping the leading 5 entirely in the near future (https://perl.github.io/PPCs/ppc0025-perl-version/), but that shouldn’t affect us. Signed-off-by: Peter Oliver Co-authored-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- meson.build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2ffea06aa7..9c5f593771 100644 --- a/meson.build +++ b/meson.build @@ -777,7 +777,22 @@ endif # Note that we only set NO_PERL if the Perl features were disabled by the user. # It may not be set when we have found Perl, but only use it to run tests. -perl = find_program('perl', version: '>=5.26.0', dirs: program_path, required: perl_required) +# +# At the time of writing, executing `perl --version` results in a string +# similar to the following output: +# +# This is perl 5, version 40, subversion 0 (v5.40.0) built for x86_64-linux-thread-multi +# +# Meson picks up the "40" as version number instead of using "v5.40.0" +# due to the regular expression it uses. This got fixed in Meson 1.7.0, +# but meanwhile we have to either use `-V:version` instead of `--version`, +# which we can do starting with Meson 1.5.0 and newer, or we have to +# match against the minor version. +if meson.version().version_compare('>=1.5.0') + perl = find_program('perl', dirs: program_path, required: perl_required, version: '>=5.26.0', version_argument: '-V:version') +else + perl = find_program('perl', dirs: program_path, required: perl_required, version: '>=26') +endif perl_features_enabled = perl.found() and get_option('perl').allowed() if perl_features_enabled build_options_config.set('NO_PERL', '')