deps: make pcre2 the bundled regular expression engine

This commit is contained in:
Edward Thomson
2026-05-26 16:21:02 +01:00
parent 64469259a5
commit 315f8102de
3 changed files with 12 additions and 7 deletions

View File

@@ -56,9 +56,9 @@ elseif(USE_REGEX STREQUAL "builtin")
add_feature_info("Regular expressions" ON "using bundled implementation")
set(GIT_REGEX_BUILTIN 1)
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/pcre" "${PROJECT_BINARY_DIR}/deps/pcre")
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/pcre")
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:pcre>)
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/pcre2" "${PROJECT_BINARY_DIR}/deps/pcre2")
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/pcre2")
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $<TARGET_OBJECTS:pcre2>)
else()
message(FATAL_ERROR "unknown setting to ${OPTION_NAME}: ${USE_REGEX}")
endif()

View File

@@ -7,7 +7,7 @@
#include "regexp.h"
#if defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE)
#if defined(GIT_REGEX_PCRE)
int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
{
@@ -73,7 +73,7 @@ out:
return 0;
}
#elif defined(GIT_REGEX_PCRE2)
#elif defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE2)
int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
{

View File

@@ -10,8 +10,13 @@
#include "git2_util.h"
#if defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE)
# include "pcre.h"
#if defined(GIT_REGEX_BUILTIN)
# define PCRE2_CODE_UNIT_WIDTH 8
# include "pcre2.h"
typedef pcre2_code *git_regexp;
# define GIT_REGEX_INIT NULL
#elif defined(GIT_REGEX_PCRE)
# include <pcre.h>
typedef pcre *git_regexp;
# define GIT_REGEX_INIT NULL
#elif defined(GIT_REGEX_PCRE2)