1 { lib, stdenv, fetchurl
8 assert elem variant [ null "cpp" "pcre16" "pcre32" ];
12 pname = if (variant == null) then "pcre"
13 else if (variant == "cpp") then "pcre-cpp"
16 in stdenv.mkDerivation {
17 name = "${pname}-${version}";
20 url = "https://ftp.pcre.org/pub/pcre/pcre-${version}.tar.bz2";
21 sha256 = "0v9nk51wh55pcbnf2jr36yarz8ayajn6d7ywiq2wagivn9c8c40r";
24 outputs = [ "bin" "dev" "out" "doc" "man" ];
26 configureFlags = optional (!stdenv.hostPlatform.isRiscV) "--enable-jit" ++ [
27 "--enable-unicode-properties"
30 ++ optional (variant != null) "--enable-${variant}";
32 # https://bugs.exim.org/show_bug.cgi?id=2173
33 patches = [ ./stacksize-detection.patch ];
36 patchShebangs RunGrepTest
39 doCheck = !(with stdenv.hostPlatform; isCygwin || isFreeBSD) && stdenv.hostPlatform == stdenv.buildPlatform;
40 # XXX: test failure on Cygwin
41 # we are running out of stack on both freeBSDs on Hydra
44 moveToOutput bin/pcre-config "$dev"
46 + optionalString (variant != null) ''
47 ln -sf -t "$out/lib/" '${pcre.out}'/lib/libpcre{,posix}.{so.*.*.*,*dylib}
51 homepage = "http://www.pcre.org/";
52 description = "A library for Perl Compatible Regular Expressions";
53 license = lib.licenses.bsd3;
56 The PCRE library is a set of functions that implement regular
57 expression pattern matching using the same syntax and semantics as
58 Perl 5. PCRE has its own native API, as well as a set of wrapper
59 functions that correspond to the POSIX regular expression API. The
60 PCRE library is free, even for building proprietary software.
63 platforms = platforms.all;