at master 2.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 updateAutotoolsGnuConfigScriptsHook, 7 pcre, 8 windows ? null, 9 # Disable jit on Apple Silicon, https://github.com/zherczeg/sljit/issues/51 10 enableJit ? !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64), 11 variant ? null, 12}: 13 14assert lib.elem variant [ 15 null 16 "cpp" 17 "pcre32" 18]; 19 20stdenv.mkDerivation rec { 21 pname = 22 "pcre" 23 + lib.optionalString (variant == "cpp") "-cpp" 24 + lib.optionalString (variant != "cpp" && variant != null) variant; 25 version = "8.45"; 26 27 src = fetchurl { 28 url = "mirror://sourceforge/project/pcre/pcre/${version}/pcre-${version}.tar.bz2"; 29 sha256 = "sha256-Ta5v3NK7C7bDe1+Xwzwr6VTadDmFNpzdrDVG4yGL/7g="; 30 }; 31 32 outputs = [ 33 "bin" 34 "dev" 35 "out" 36 "doc" 37 "man" 38 ]; 39 40 hardeningDisable = lib.optional enableJit "shadowstack"; 41 42 configureFlags = [ 43 "--enable-unicode-properties" 44 "--disable-cpp" 45 ] 46 ++ lib.optional enableJit "--enable-jit=auto" 47 ++ lib.optional (variant != null) "--enable-${variant}"; 48 49 patches = [ 50 # https://bugs.exim.org/show_bug.cgi?id=2173 51 ./stacksize-detection.patch 52 53 # Fix segfaults & tests on powerpc64 54 (fetchpatch { 55 name = "sljit-ppc-icache-flush.patch"; 56 url = "https://github.com/void-linux/void-packages/raw/d286e231ee680875ad8e80f90ea62e46f5edd812/srcpkgs/pcre/patches/ppc-icache-flush.patch"; 57 hash = "sha256-pttmKwihLzKrAV6O4qVLp2pu4NwNJEFS/9Id8/b3nAU="; 58 }) 59 ]; 60 61 # necessary to build on FreeBSD native pending inclusion of 62 # https://git.savannah.gnu.org/cgit/config.git/commit/?id=e4786449e1c26716e3f9ea182caf472e4dbc96e0 63 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]; 64 65 preCheck = '' 66 patchShebangs RunGrepTest 67 ''; 68 69 doCheck = 70 !(with stdenv.hostPlatform; isCygwin || isFreeBSD) && stdenv.hostPlatform == stdenv.buildPlatform; 71 # XXX: test failure on Cygwin 72 # we are running out of stack on both freeBSDs on Hydra 73 74 postFixup = '' 75 moveToOutput bin/pcre-config "$dev" 76 '' 77 + lib.optionalString (variant != null) '' 78 ln -sf -t "$out/lib/" '${pcre.out}'/lib/libpcre{,posix}.{so.*.*.*,*dylib,*a} 79 ''; 80 81 meta = { 82 homepage = "https://www.pcre.org/"; 83 description = "Library for Perl Compatible Regular Expressions"; 84 license = lib.licenses.bsd3; 85 86 longDescription = '' 87 The PCRE library is a set of functions that implement regular 88 expression pattern matching using the same syntax and semantics as 89 Perl 5. PCRE has its own native API, as well as a set of wrapper 90 functions that correspond to the POSIX regular expression API. The 91 PCRE library is free, even for building proprietary software. 92 ''; 93 94 platforms = lib.platforms.all; 95 maintainers = [ ]; 96 pkgConfigModules = [ 97 "libpcre" 98 "libpcreposix" 99 ]; 100 }; 101}