Re: [PATCH v2] meson: disable PCRE2 dependency by default in macOS
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 13, 2025, 15:42 UTC
- Message-ID
- <xmqqtt3gw10v.fsf@gitster.g>
- In-Reply-To
- <20250713122341.17976-1-carenas@gmail.com>
Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:
Show 12 quoted lines
> Makefile requires the user to provide the USE_LIBPCRE2 flag to > enable this dependency, but meson has it enabled by default, > which can be problematic, at least in macOS. > > 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. > > Add an option that will need to be turned to true once an > alternative PCRE2 library is installed (which hopefully provides > its own pkgconf module earlier in PKG_CONFIG_PATH) or meson has > been instructed to use the wrap by `--force-fallback-for=pcre2`
Here, and ...
Show 39 quoted lines
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> meson.build | 3 ++-
> meson_options.txt | 4 +++-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 7fea4a34d6..e1475be6c8 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1055,7 +1055,8 @@ 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').disable_auto_if(host_machine.system() == 'darwin' and not get_option('macos_workaround_system_pcre2'))
> +pcre2 = dependency('libpcre2-8', required: pcre2_feature, default_options: ['default_library=static', 'test=false'])
> if pcre2.found()
> libgit_dependencies += pcre2
> libgit_c_args += '-DUSE_LIBPCRE2'
> diff --git a/meson_options.txt b/meson_options.txt
> index e7f768df24..9c0cb6bbfa 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.')
> @@ -73,6 +73,8 @@ option('breaking_changes', type: 'boolean', value: false,
> description: 'Enable upcoming breaking changes.')
> option('macos_use_homebrew_gettext', type: 'boolean', value: true,
> description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')
> +option('macos_workaround_system_pcre2', type: 'boolean', value: false,
> + description: 'A working PCRE2 was provided or the fallback to the wrap is being forced.')... here, I do not understand what you wanted to refer to with the noun "wrap". Can you please rephrase them to clarify?
Thanks.
>
> # gitweb configuration.
> option('gitweb_config', type: 'string', value: 'gitweb_config.perl')