Subject: [PATCH] meson: disable PCRE2 dependency by default

From: Carlo Marcelo Arenas Belón <[email-masked]>
Date: Sat, 12 Jul 2025 10:26:15 -0700

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.

While a popular option and matching what was done by cmake
(which itself reflects what is preferred by Git for Windows)
could result in a broken build or linking with the wrong PCRE2
library.

While not git's fault, macOS provides a PCRE2 library in base
that is not usable (even if it would pass the test) and not
configured properly, as it installs a pkgconf module that
points to a non existent pcre2.h header in /usr/local/include.

Change the default to off, and let the user enable it once a
proper dependency is installed or meson instructed to fallback to
the wrap.

Signed-off-by: Carlo Marcelo Arenas Belón <[email-masked]>
---
 meson_options.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson_options.txt b/meson_options.txt
index e7f768df24..0a0cac6f99 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: 'disabled',
   description: 'Support Perl-compatible regular expressions in e.g. git-grep(1).')
 option('perl', type: 'feature', value: 'auto',
   description: 'Build tools written in Perl.')
-- 
2.39.5 (Apple Git-154)