diff --git a/build.zig b/build.zig index 2041fb7..8ec6c9e 100644 --- a/build.zig +++ b/build.zig @@ -283,42 +283,48 @@ pub fn build(b: *std.Build) !void { features.addValues(.{ .GIT_HTTPPARSER_BUILTIN = 1 }); } if (target.result.os.tag != .macos) { - const pcre = b.createModule(.{ + const pcre2 = b.createModule(.{ .target = target, .optimize = optimize, .link_libc = true, }); - pcre.addConfigHeader(b.addConfigHeader( - .{ .style = .{ .cmake = libgit_src.path("deps/pcre/config.h.in") } }, + pcre2.addConfigHeader(b.addConfigHeader( + .{ .style = .{ .cmake = libgit_src.path("deps/pcre2/config.h.in") } }, .{ - .SUPPORT_PCRE8 = 1, - .PCRE_LINK_SIZE = 2, - .PCRE_PARENS_NEST_LIMIT = 250, - .PCRE_MATCH_LIMIT = 10000000, - .PCRE_MATCH_LIMIT_RECURSION = "MATCH_LIMIT", - .NEWLINE = '\n', - .NO_RECURSE = 1, - .PCRE_POSIX_MALLOC_THRESHOLD = 10, - .BSR_ANYCRLF = 0, - .PCREGREP_BUFSIZE = null, + .SUPPORT_PCRE2_8 = 1, + .SUPPORT_UNICODE = 1, + .NEWLINE_DEFAULT = 2, + .PCRE2_LINK_SIZE = 2, + .PCRE2_MAX_VARLOOKBEHIND = 255, + .PCRE2_PARENS_NEST_LIMIT = 250, + .PCRE2_HEAP_LIMIT = 20000000, + .PCRE2_MATCH_LIMIT = 10000000, + .PCRE2_MATCH_LIMIT_DEPTH = "MATCH_LIMIT", + .PCRE2GREP_BUFSIZE = {}, + .PCRE2GREP_MAX_BUFSIZE = {}, }, )); - pcre.addIncludePath(libgit_src.path("deps/pcre")); - pcre.addCSourceFiles(.{ - .root = libgit_src.path("deps/pcre"), - .files = &sources.pcre, + pcre2.addIncludePath(libgit_src.path("deps/pcre2")); + pcre2.addCSourceFiles(.{ + .root = libgit_src.path("deps/pcre2"), + .files = &sources.pcre2, .flags = &.{ "-Wno-unused-function", "-Wno-implicit-fallthrough", "-DHAVE_CONFIG_H", + "-DPCRE2_CODE_UNIT_WIDTH=8", + "-DPCRE2_STATIC", + "-DPCRE2_EXPORT=", + "-DPCRE2_EXP_DECL=", + "-DPCRE2_EXP_DEFN=", }, }); - mod.addIncludePath(libgit_src.path("deps/pcre")); + mod.addIncludePath(libgit_src.path("deps/pcre2")); mod.linkLibrary(b.addLibrary(.{ - .name = "pcre", + .name = "pcre2", .linkage = .static, - .root_module = pcre, + .root_module = pcre2, })); features.addValues(.{ .GIT_REGEX_BUILTIN = 1 }); } @@ -489,7 +495,7 @@ pub fn build(b: *std.Build) !void { runner.addIncludePath(zlib_includes); runner.addIncludePath(libgit_src.path("deps/xdiff")); - runner.addIncludePath(libgit_src.path("deps/pcre")); + runner.addIncludePath(libgit_src.path("deps/pcre2")); maybeAddTlsIncludes(runner, tls_dep, tls_backend); runner.linkLibrary(lib); diff --git a/build.zig.zon b/build.zig.zon index 738dab3..c4e0840 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,9 +5,9 @@ .fingerprint = 0x7f0051374dea2cba, .dependencies = .{ .libgit2 = .{ - .version = "1.9.0", - .url = "https://github.com/libgit2/libgit2/archive/refs/tags/v1.9.0.tar.gz", - .hash = "N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg", + .version = "1.9.5", + .url = "https://github.com/libgit2/libgit2/archive/refs/tags/v1.9.5.tar.gz", + .hash = "N-V-__8AAL42NgFNPhVK1LtsZzl90Lnp-y3YLV_UFKSRzDzj", }, .openssl = .{ .url = "git+https://github.com/allyourcodebase/openssl.git#0ac677650d43eadf669067d050992118b13338d2", diff --git a/build/sources.zon b/build/sources.zon index 5c728a2..12344ba 100644 --- a/build/sources.zon +++ b/build/sources.zon @@ -200,31 +200,38 @@ "llhttp.c", }, - // deps/pcre - .pcre = .{ - "pcre_byte_order.c", - "pcre_chartables.c", - "pcre_compile.c", - "pcre_config.c", - "pcre_dfa_exec.c", - "pcre_exec.c", - "pcre_fullinfo.c", - "pcre_get.c", - "pcre_globals.c", - "pcre_jit_compile.c", - "pcre_maketables.c", - "pcre_newline.c", - "pcre_ord2utf8.c", - "pcre_printint.c", - "pcre_refcount.c", - "pcre_string_utils.c", - "pcre_study.c", - "pcre_tables.c", - "pcre_ucd.c", - "pcre_valid_utf8.c", - "pcre_version.c", - "pcre_xclass.c", - "pcreposix.c", + // deps/pcre2 + .pcre2 = .{ + "pcre2_auto_possess.c", + "pcre2_chartables.c", + "pcre2_chkdint.c", + "pcre2_compile.c", + "pcre2_compile_cgroup.c", + "pcre2_compile_class.c", + "pcre2_config.c", + "pcre2_context.c", + "pcre2_convert.c", + "pcre2_dfa_match.c", + "pcre2_error.c", + "pcre2_extuni.c", + "pcre2_find_bracket.c", + "pcre2_maketables.c", + "pcre2_match.c", + "pcre2_match_data.c", + "pcre2_match_next.c", + "pcre2_newline.c", + "pcre2_ord2utf.c", + "pcre2_pattern_info.c", + "pcre2_script_run.c", + "pcre2_serialize.c", + "pcre2_string_utils.c", + "pcre2_study.c", + "pcre2_substitute.c", + "pcre2_substring.c", + "pcre2_tables.c", + "pcre2_ucd.c", + "pcre2_valid_utf.c", + "pcre2_xclass.c", }, .xdiff = .{