1{ stdenv, fetchurl, fetchpatch }:
2
3stdenv.mkDerivation rec {
4 name = "pcre2-${version}";
5 version = "10.23";
6 src = fetchurl {
7 url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${name}.tar.bz2";
8 sha256 = "0vn5g0mkkp99mmzpissa06hpyj6pk9s4mlwbjqrjvw3ihy8rpiyz";
9 };
10
11 configureFlags = [
12 "--enable-pcre2-16"
13 "--enable-pcre2-32"
14 "--enable-jit"
15 ];
16
17 patches = [
18 (fetchpatch {
19 name = "CVE-2017-7186-part1.patch";
20 url = "https://vcs.pcre.org/pcre2/code/trunk/src/pcre2_ucd.c?view=patch&r1=316&r2=670&sortby=date";
21 sha256 = "10yzglvbn7h06hg7zffr5zh378i5jihvx7d5gggkynws79vgwvfr";
22 stripLen = 2;
23 addPrefixes = true;
24 })
25 (fetchpatch {
26 name = "CVE-2017-7186-part2.patch";
27 url = "https://vcs.pcre.org/pcre2/code/trunk/src/pcre2_internal.h?view=patch&r1=600&r2=670&sortby=date";
28 sha256 = "1bggk7vd5hg0bjg96lj4h1lacmr6grq68dm6iz1n7vg3zf7virjn";
29 stripLen = 2;
30 addPrefixes = true;
31 })
32 ];
33
34 outputs = [ "bin" "dev" "out" "doc" "man" "devdoc" ];
35
36 postFixup = ''
37 moveToOutput bin/pcre2-config "$dev"
38 '';
39
40 meta = with stdenv.lib; {
41 description = "Perl Compatible Regular Expressions";
42 homepage = http://www.pcre.org/;
43 license = licenses.bsd3;
44 maintainers = with maintainers; [ ttuegel ];
45 platforms = platforms.all;
46 };
47}