Show 48 quoted lines
> 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.')