On Mon, Jul 14, 2025 at 09:55:27PM -0400, Eli Schwartz wrote: > On 7/13/25 1:48 PM, Carlo Marcelo Arenas Belón wrote: > > 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' > > > Instead of disable_auto_if, we should simply verify a working install. > > 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 get_option('pcre2').enabled() > error('broken pcre2 install found but pcre2 is required') > endif > # Replace with not-found-dependency > pcre2 = dependency('', required: false) > warning('broken pcre2 install found, disabling pcre2 feature') Okay. So if the `pcre2` feature was explicitly enabled we error out and abort, otherwise we print a warning and disable it. This makes a lot of sense to me. > endif > endif > > if pcre2.found() > libgit_dependencies += pcre2 > > [...] > > > Please double-check my work, that this compiler.has_header() is > sufficient on your reproducer system to detect and disable the > non-working feature. I think auto-detecting such broken PCRE2 libraries is indeed the best way forward, thanks! > > diff --git a/meson_options.txt b/meson_options.txt > > index e7f768df24..f63ff32556 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', > > > This part is fine. We shouldn't default-fail if it isn't found, when we > can't expect it to be universally available. Agreed. I guess tha only reason why I picked "enabled" here is because we also got a wrapper in "subprojects/". But with this new workaround in place I agree that it is sensible to switch to "auto". Patrick