Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / pcre.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
6 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
7 ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
8 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages pcre)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages readline)
29 #:use-module (gnu packages)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix build-system gnu))
33
34 (define-public pcre
35 (package
36 (name "pcre")
37 (version "8.41")
38 (source (origin
39 (method url-fetch)
40 (uri (list
41 (string-append "ftp://ftp.csx.cam.ac.uk"
42 "/pub/software/programming/pcre/"
43 "pcre-" version ".tar.bz2")
44 (string-append "mirror://sourceforge/pcre/pcre/"
45 version "/pcre-" version ".tar.bz2")))
46 (sha256
47 (base32
48 "0c5m469p5pd7jip621ipq6hbgh7128lzh7xndllfgh77ban7wb76"))))
49 (build-system gnu-build-system)
50 (outputs '("out" ;library & headers
51 "bin" ;depends on Readline (adds 20MiB to the closure)
52 "doc")) ;1.8 MiB of HTML
53 (inputs `(("bzip2" ,bzip2)
54 ("readline" ,readline)
55 ("zlib" ,zlib)))
56 (arguments
57 '(#:disallowed-references ("doc")
58 #:configure-flags '("--enable-utf"
59 "--enable-pcregrep-libz"
60 "--enable-pcregrep-libbz2"
61 "--enable-pcretest-libreadline"
62 "--enable-unicode-properties"
63 "--enable-pcre16"
64 "--enable-pcre32"
65 "--enable-jit")))
66 (synopsis "Perl Compatible Regular Expressions")
67 (description
68 "The PCRE library is a set of functions that implement regular expression
69 pattern matching using the same syntax and semantics as Perl 5. PCRE has its
70 own native API, as well as a set of wrapper functions that correspond to the
71 POSIX regular expression API.")
72 (license license:bsd-3)
73 (home-page "https://www.pcre.org/")))
74
75 (define-public pcre2
76 (package
77 (name "pcre2")
78 (version "10.23")
79 (source (origin
80 (method url-fetch)
81 (uri (string-append "mirror://sourceforge/pcre/pcre2/"
82 version "/pcre2-" version ".tar.bz2"))
83
84 (sha256
85 (base32
86 "0vn5g0mkkp99mmzpissa06hpyj6pk9s4mlwbjqrjvw3ihy8rpiyz"))
87 (patches (search-patches "pcre2-CVE-2017-7186.patch"
88 "pcre2-CVE-2017-8786.patch"))))
89 (build-system gnu-build-system)
90 (inputs `(("bzip2" ,bzip2)
91 ("readline" ,readline)
92 ("zlib" ,zlib)))
93 (arguments
94 `(#:configure-flags '("--enable-unicode"
95 "--enable-pcre2grep-libz"
96 "--enable-pcre2grep-libbz2"
97 "--enable-pcre2test-libreadline"
98 "--enable-pcre2-16"
99 "--enable-pcre2-32"
100 "--enable-jit")
101 #:phases
102 (modify-phases %standard-phases
103 (add-after 'unpack 'patch-paths
104 (lambda _
105 (substitute* "RunGrepTest"
106 (("/bin/echo") (which "echo")))
107 #t)))))
108 (synopsis "Perl Compatible Regular Expressions")
109 (description
110 "The PCRE library is a set of functions that implement regular expression
111 pattern matching using the same syntax and semantics as Perl 5. PCRE has its
112 own native API, as well as a set of wrapper functions that correspond to the
113 POSIX regular expression API.")
114 (license license:bsd-3)
115 (home-page "https://www.pcre.org/")))