Check for Perl 5.26.0 from Meson build
PATCH v2 1/2 Check for Perl 5.26.0 from Meson build
Commit 702d8c1 (which landed not long before Meson was added) dropped support for Perl versions back to 5.8.1.
--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
@@ -755,7 +755,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', '')
Signature · 1 line
2.48.1
PATCH v2 2/2 Fix Meson Perl version check
Command perl --version says, e.g., “This is perl 5, version 26, subversion 0 (v5.26.0)”, which Meson interprets as version 26.
--- meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meson.build +5 -1
@@ -755,7 +755,11 @@ 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) +# +# When checking here, it would be better to say, +# version: '>=5.26.0', version_argument: '-eprint "$^V"' +# but that requires Meson 1.5.0, which at the time of writing is rather new. +perl = find_program('perl', version: '>=26', 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', '')
Signature · 1 line
2.48.1
Quoted 2 lines · Peter Oliver
Commit 702d8c1 (which landed not long before Meson was added) dropped support for Perl versions back to 5.8.1.
Makes sense. This commit was another thing that landed in parallel to the Meson effort, so it's not surprising that Meson still requires the old version.
A couple remarks for the commit message:
- The subject should typically start with the subsystem you're touching, followed by a short description of what you're doing to it.
- We aim to make the commit message work standalone, wihtout reading the commit subject. So saying something along the lines that the minimum required version in MEson hasn't been bumped accordingly would make sense.
- We use git log -1 --format=reference when mentioning commits.
So, my suggestion:
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.28.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 and require Perl 5.28.0 or newer in Meson, as well.
Patrick
Re: [PATCH 2/2] Fix Meson Perl version check
In reply to Peter OliverQuoted 2 lines · Peter Oliver
Command
perl --versionsays, e.g., “This is perl 5, version 26, subversion 0 (v5.26.0)”, which Meson interprets as version 26.
Yeah, I've also discovered this issue, but decided to improve it upstream in Meson [1]. Meson now prefers version numbers with dots when scanning through the output, which makes it match the "v5.26.0" part instead of the "version 26" part. This will be released with Meson 1.7.0, which should be released soonish.
I'm a little torn whether it still makes sense to fix the issue in that light. If we do, we should use a fix that properly fixes the underlying issue instead of adapting to the misdetected version, as that will stop working once the mentioned fix is released.
One way would be to use perl -V:version instead of perl --version, which will print the following:
version='5.40.0';
The support of overriding the version argument has only been added recently with Meson 1.5.0 though. We can still make it work though by making this conditional:
diff --git a/meson.build b/meson.build
index 07744c73b1..c452a79e37 100644
--- a/meson.build
+++ b/meson.build
@@ -754,7 +754,11 @@ 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)
+if meson.version().version_compare('>=1.5.0')
+ perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required, version_argument: '-V:version')
+else
+ perl = find_program('perl', version: '>=5.8.1', dirs: program_path, required: perl_required)
+endif
perl_features_enabled = perl.found() and get_option('perl').allowed()
if perl_features_enabled
build_options_config.set('NO_PERL', '')Is it worth it? I dunno. But also doesn't hurt if you want to go down that path.
Thanks!
Patrick
[1]: https://github.com/mesonbuild/meson/commit/a3679a64eec7c312c81d657880f34f015426c7db
v2 cover Fix Meson Perl version check
In reply to Peter OliverAs suggested, I have reworded the commit message of the first patch, and improved the second patch to work correctly with future versions of Meson.
Peter Oliver (2):
meson: bump minimum required Perl version to 5.26.0
meson: fix Perl version check for Meson versions before 1.7.0
meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.48.1
PATCH v2 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.
--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
@@ -755,7 +755,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', '')
Signature · 1 line
2.48.1
PATCH v2 2/2 meson: fix Perl version check for Meson versions before 1.7.0
In reply to Peter OliverCommand 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.
--- meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meson.build +5 -1
@@ -755,7 +755,11 @@ 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) +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', '')
Signature · 1 line
2.48.1
Re: [PATCH v2 2/2] meson: fix Perl version check for Meson versions before 1.7.0
meson.build endif · line 761
Quoted 13 lines · Peter Oliver
meson.build +4
-1@@ -755,7 +755,11 @@ 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) +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')
I'm still a bit sceptical whether we should adapt this second line to match against >=26. I guess as long as it doesn't break anything out there it's okayish, and if we do see breakage we can in the worst case revert it.
In any case, it deserves a comment why we're matching against the minor version and not the whole version. E.g. something like this:
# 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.
Thanks!
Patrick
v3 cover Fix Meson Perl version check
Suggested comments added.
Peter Oliver (2):
meson: bump minimum required Perl version to 5.26.0
meson: fix Perl version check for Meson versions before 1.7.0
meson.build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
Signature · 1 line
2.48.1
PATCH v3 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.
--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
@@ -755,7 +755,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', '')
Signature · 1 line
2.48.1
PATCH v3 2/2 meson: fix Perl version check for Meson versions before 1.7.0
In reply to Peter OliverCommand 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.
--- meson.build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
meson.build +16 -1
@@ -755,7 +755,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', '')
Signature · 1 line
2.48.1
Re: [PATCH v3 0/2] Fix Meson Perl version check
In reply to Peter OliverQuoted 8 lines · Peter Oliver
Suggested comments added.
Peter Oliver (2):
meson: bump minimum required Perl version to 5.26.0
meson: fix Perl version check for Meson versions before 1.7.0meson.build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
I wasn't involved in the review of the previous rounds (so it was a bit of surprise for me to be listed on the To: line), but it seems that Patrick and you polished these two together, so I'll see if I can add Patrick's acked-by/reviewed-by while queuing by waiting for the earth to turn one rotation.
Thanks.
Re: [PATCH v3 0/2] Fix Meson Perl version check
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · Peter Oliver
Suggested comments added.
Peter Oliver (2):
meson: bump minimum required Perl version to 5.26.0
meson: fix Perl version check for Meson versions before 1.7.0
Quoted 8 lines
Quoted 2 lines
meson.build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)I wasn't involved in the review of the previous rounds (so it was a bit of surprise for me to be listed on the To: line), but it seems that Patrick and you polished these two together, so I'll see if I can add Patrick's acked-by/reviewed-by while queuing by waiting for the earth to turn one rotation.
Yup, this version looks good to me, thanks Peter. So please feel free to add either my Acked-by or Reviewed-by, I'd be fine with either.
Patrick
Re: [PATCH v3 0/2] Fix Meson Perl version check
Quoted 12 lines · Patrick Steinhardt
Quoted 11 lines · Junio C Hamano
Quoted 8 lines · Peter Oliver
Suggested comments added.
Peter Oliver (2):
meson: bump minimum required Perl version to 5.26.0
meson: fix Perl version check for Meson versions before 1.7.0meson.build | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
Quoted 8 lines
Quoted 5 lines
I wasn't involved in the review of the previous rounds (so it was a bit of surprise for me to be listed on the To: line), but it seems that Patrick and you polished these two together, so I'll see if I can add Patrick's acked-by/reviewed-by while queuing by waiting for the earth to turn one rotation.
Yup, this version looks good to me, thanks Peter. So please feel free to add either my Acked-by or Reviewed-by, I'd be fine with either.
Thanks for working well together. Let me mark the topic for 'next'.
Re: [PATCH v3 0/2] Fix Meson Perl version check
In reply to Junio C HamanoQuoted 2 lines · Junio C Hamano
I wasn't involved in the review of the previous rounds (so it was a bit of surprise for me to be listed on the To: line)
Apologies if that wasn’t the correct process. I am not a regular contributor, and was trying to follow the process described at https://git-scm.com/docs/SubmittingPatches#_choosing_your_reviewers, “After the list reached a consensus…”.
Signature · 1 line
Peter Oliver
Re: [PATCH v3 0/2] Fix Meson Perl version check
Quoted 9 lines · Peter Oliver
Quoted 2 lines · Junio C Hamano
I wasn't involved in the review of the previous rounds (so it was a bit of surprise for me to be listed on the To: line)
Apologies if that wasn’t the correct process. I am not a regular contributor, and was trying to follow the process described at
https://git-scm.com/docs/SubmittingPatches#_choosing_your_reviewers,
“After the list reached a consensus…”.
No apology needed. Thanks for the update.