6 updateAutotoolsGnuConfigScriptsHook,
9 # Disable jit on Apple Silicon, https://github.com/zherczeg/sljit/issues/51
10 enableJit ? !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64),
14 assert lib.elem variant [
21 stdenv.mkDerivation rec {
24 + lib.optionalString (variant == "cpp") "-cpp"
25 + lib.optionalString (variant != "cpp" && variant != null) variant;
29 url = "mirror://sourceforge/project/pcre/pcre/${version}/pcre-${version}.tar.bz2";
30 sha256 = "sha256-Ta5v3NK7C7bDe1+Xwzwr6VTadDmFNpzdrDVG4yGL/7g=";
41 hardeningDisable = lib.optional enableJit "shadowstack";
45 "--enable-unicode-properties"
48 ++ lib.optional enableJit "--enable-jit=auto"
49 ++ lib.optional (variant != null) "--enable-${variant}";
52 # https://bugs.exim.org/show_bug.cgi?id=2173
53 ./stacksize-detection.patch
55 # Fix segfaults & tests on powerpc64
57 name = "sljit-ppc-icache-flush.patch";
58 url = "https://github.com/void-linux/void-packages/raw/d286e231ee680875ad8e80f90ea62e46f5edd812/srcpkgs/pcre/patches/ppc-icache-flush.patch";
59 hash = "sha256-pttmKwihLzKrAV6O4qVLp2pu4NwNJEFS/9Id8/b3nAU=";
63 # necessary to build on FreeBSD native pending inclusion of
64 # https://git.savannah.gnu.org/cgit/config.git/commit/?id=e4786449e1c26716e3f9ea182caf472e4dbc96e0
65 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
68 patchShebangs RunGrepTest
72 !(with stdenv.hostPlatform; isCygwin || isFreeBSD) && stdenv.hostPlatform == stdenv.buildPlatform;
73 # XXX: test failure on Cygwin
74 # we are running out of stack on both freeBSDs on Hydra
78 moveToOutput bin/pcre-config "$dev"
80 + lib.optionalString (variant != null) ''
81 ln -sf -t "$out/lib/" '${pcre.out}'/lib/libpcre{,posix}.{so.*.*.*,*dylib,*a}
85 homepage = "http://www.pcre.org/";
86 description = "Library for Perl Compatible Regular Expressions";
87 license = lib.licenses.bsd3;
90 The PCRE library is a set of functions that implement regular
91 expression pattern matching using the same syntax and semantics as
92 Perl 5. PCRE has its own native API, as well as a set of wrapper
93 functions that correspond to the POSIX regular expression API. The
94 PCRE library is free, even for building proprietary software.
97 platforms = lib.platforms.all;