git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Peter Oliver <p.d.oliver@mavit.org.uk>
Cc: git@vger.kernel.org, Peter Oliver <git@mavit.org.uk>
Subject: Re: [PATCH 2/2] Fix Meson Perl version check
Date: Tue, 21 Jan 2025 07:44:29 +0100	[thread overview]
Message-ID: <Z49CTa-wconHakMs@pks.im> (raw)
In-Reply-To: <20250120160301.121245-2-git@mavit.org.uk>

On Mon, Jan 20, 2025 at 04:03:01PM +0000, Peter Oliver wrote:
> Command `perl --version` says, 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

  reply	other threads:[~2025-01-21  6:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20 16:03 [PATCH 1/2] Check for Perl 5.26.0 from Meson build Peter Oliver
2025-01-20 16:03 ` [PATCH 2/2] Fix Meson Perl version check Peter Oliver
2025-01-21  6:44   ` Patrick Steinhardt [this message]
2025-01-21  6:44 ` [PATCH 1/2] Check for Perl 5.26.0 from Meson build Patrick Steinhardt
2025-01-24 16:30 ` [PATCH v2 0/2] Fix Meson Perl version check Peter Oliver
2025-01-24 16:30   ` [PATCH v2 1/2] meson: bump minimum required Perl version to 5.26.0 Peter Oliver
2025-01-24 16:30   ` [PATCH v2 2/2] meson: fix Perl version check for Meson versions before 1.7.0 Peter Oliver
2025-01-27  7:39     ` Patrick Steinhardt
2025-02-18 15:30       ` [PATCH v3 0/2] Fix Meson Perl version check Peter Oliver
2025-02-18 15:30         ` [PATCH v3 1/2] meson: bump minimum required Perl version to 5.26.0 Peter Oliver
2025-02-18 15:30         ` [PATCH v3 2/2] meson: fix Perl version check for Meson versions before 1.7.0 Peter Oliver
2025-02-18 19:12         ` [PATCH v3 0/2] Fix Meson Perl version check Junio C Hamano
2025-02-19  7:17           ` Patrick Steinhardt
2025-02-19 16:05             ` Junio C Hamano
2025-02-25 12:28           ` Peter Oliver
2025-02-25 18:20             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z49CTa-wconHakMs@pks.im \
    --to=ps@pks.im \
    --cc=git@mavit.org.uk \
    --cc=git@vger.kernel.org \
    --cc=p.d.oliver@mavit.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).