From: Junio C Hamano <gitster@pobox•com>
To: "Carlo Marcelo Arenas Belón" <carenas@gmail•com>
Cc: git@vger•kernel.org, sandals@crustytoothpaste•net, ps@pks•im,
eschwartz@gentoo•org
Subject: Re: [PATCH v4] meson: woraround broken system PCRE2 dependency in macOS
Date: Tue, 15 Jul 2025 09:48:23 -0700 [thread overview]
Message-ID: <xmqqikjtienc.fsf@gitster.g> (raw)
In-Reply-To: <20250715114407.37955-1-carenas@gmail.com> ("Carlo Marcelo Arenas Belón"'s message of "Tue, 15 Jul 2025 04:44:07 -0700")
Carlo Marcelo Arenas Belón <carenas@gmail•com> writes:
> macOS provides a PCRE2 library in base that is not usable and not
> configured properly, as it installs a pkgconf module that
> points to a non existent pcre2.h header in /usr/local/include.
>
> Detect that case and allow a fallback to a wrapped submodule
> if the feature is enabled and that is possible, or print a
> warning and disable the feature if the feature was set to "auto".
> which is the new default.
>
> Suggested-by: Eli Schwartz <eschwartz@gentoo•org>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail•com>
> ---
Thanks. Will queue.
> meson.build | 20 +++++++++++++++++++-
> meson_options.txt | 2 +-
> 2 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 596f5ac711..0e480e65cf 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1055,7 +1055,25 @@ else
> build_options_config.set('NO_ICONV', '1')
> endif
>
> -pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false'])
> +pcre2_feature = get_option('pcre2')
> +pcre2 = dependency('libpcre2-8', required: pcre2_feature, default_options: ['default_library=static', 'test=false'])
> +if pcre2.found() and pcre2.type_name() != 'internal' and host_machine.system() == 'darwin'
> + # macOS installs a broken system package, double check
> + if not compiler.has_header('pcre2.h', dependencies: pcre2)
> + if pcre2_feature.enabled()
> + # Attempt to fallback
> + pcre2 = dependency('libpcre2-8', required: true, method: 'builtin', default_options: ['default_library=static', 'test=false'])
> + if not pcre2.found()
> + error('only a broken pcre2 install found and pcre2 is required')
> + endif
> + elif pcre2_feature.auto()
> + # Replace with not-found-dependency
> + pcre2 = dependency('', required: false)
> + warning('broken pcre2 install found, disabling pcre2 feature')
> + endif
> + endif
> +endif
> +
> if pcre2.found()
> libgit_dependencies += pcre2
> libgit_c_args += '-DUSE_LIBPCRE2'
> diff --git a/meson_options.txt b/meson_options.txt
> index e7f768df24..1668f260a1 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -45,7 +45,7 @@ option('gitweb', type: 'feature', value: 'auto',
> description: 'Build Git web interface. Requires Perl.')
> option('iconv', type: 'feature', value: 'auto',
> description: 'Support reencoding strings with different encodings.')
> -option('pcre2', type: 'feature', value: 'enabled',
> +option('pcre2', type: 'feature', value: 'auto',
> description: 'Support Perl-compatible regular expressions in e.g. git-grep(1).')
> option('perl', type: 'feature', value: 'auto',
> description: 'Build tools written in Perl.')
next prev parent reply other threads:[~2025-07-15 16:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-12 17:26 [PATCH] meson: disable PCRE2 dependency by default Carlo Marcelo Arenas Belón
2025-07-12 17:51 ` brian m. carlson
2025-07-14 14:00 ` Carlo Arenas
2025-07-14 15:20 ` Junio C Hamano
2025-07-14 16:46 ` Carlo Marcelo Arenas Belón
2025-07-14 16:58 ` Junio C Hamano
2025-07-13 12:23 ` [PATCH v2] meson: disable PCRE2 dependency by default in macOS Carlo Marcelo Arenas Belón
2025-07-13 15:42 ` Junio C Hamano
2025-07-13 17:48 ` [PATCH v3] " Carlo Marcelo Arenas Belón
2025-07-15 1:55 ` Eli Schwartz
2025-07-15 8:46 ` Patrick Steinhardt
2025-07-15 8:56 ` Carlo Arenas
2025-07-15 10:32 ` Patrick Steinhardt
2025-07-15 12:08 ` Carlo Arenas
2025-07-15 14:14 ` Eli Schwartz
2025-07-15 12:01 ` Carlo Arenas
2025-07-15 14:22 ` Eli Schwartz
2025-07-15 11:44 ` [PATCH v4] meson: woraround broken system PCRE2 dependency " Carlo Marcelo Arenas Belón
2025-07-15 16:48 ` Junio C Hamano [this message]
2025-07-15 16:50 ` Eric Sunshine
2025-07-16 19:30 ` [PATCH v5] meson: work around " Carlo Marcelo Arenas Belón
2025-07-16 21:13 ` Junio C Hamano
2025-07-16 21:17 ` Junio C Hamano
2025-07-16 22:10 ` Eli Schwartz
2025-07-16 22:17 ` Carlo Arenas
2025-07-18 17:02 ` [PATCH v6] " Carlo Marcelo Arenas Belón
2025-07-23 22:17 ` Junio C Hamano
2025-07-24 5:28 ` Patrick Steinhardt
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=xmqqikjtienc.fsf@gitster.g \
--to=gitster@pobox$(echo .)com \
--cc=carenas@gmail$(echo .)com \
--cc=eschwartz@gentoo$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=ps@pks$(echo .)im \
--cc=sandals@crustytoothpaste$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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