gnu: Add r-bac.
[jackhill/guix/guix.git] / gnu / packages / pcre.scm
CommitLineData
10d1822b
AE
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
fd19fa55 3;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
7ea3099b 4;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
ccda7c83 5;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
9bb766e7 6;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
a97f0ee1 7;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
e3de5d67 8;;; Copyright © 2017, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
8297ff0f 9;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7db9573e
JBV
10;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
11;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
10d1822b
AE
12;;;
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28(define-module (gnu packages pcre)
b5b73a82 29 #:use-module ((guix licenses) #:prefix license:)
10d1822b
AE
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages readline)
d46dd72c 32 #:use-module (gnu packages)
bbb0420e 33 #:use-module (guix utils)
10d1822b
AE
34 #:use-module (guix packages)
35 #:use-module (guix download)
89022186 36 #:use-module (guix utils)
10d1822b
AE
37 #:use-module (guix build-system gnu))
38
39(define-public pcre
40 (package
41 (name "pcre")
81d0ac2d 42 (version "8.45")
10d1822b
AE
43 (source (origin
44 (method url-fetch)
e3de5d67
EF
45 (uri (string-append "mirror://sourceforge/pcre/pcre/"
46 version "/pcre-" version ".tar.bz2"))
10d1822b
AE
47 (sha256
48 (base32
81d0ac2d 49 "1f7zichy6iimmkfrqdl575sdlm795cyc75szgg1vc2xvsbf6zbjd"))))
10d1822b 50 (build-system gnu-build-system)
6d49ca3b
LC
51 (outputs '("out" ;library & headers
52 "bin" ;depends on Readline (adds 20MiB to the closure)
50849734
MB
53 "doc" ;1.8 MiB of HTML
54 "static")) ;1.8 MiB static libraries
8394619b 55 (inputs (list bzip2 readline zlib))
10d1822b 56 (arguments
af823dc6 57 `(#:disallowed-references ("doc")
d786d2f8 58 #:configure-flags '("--enable-utf"
10d1822b
AE
59 "--enable-pcregrep-libz"
60 "--enable-pcregrep-libbz2"
90dcf9c8 61 "--enable-pcretest-libreadline"
16f71908
MW
62 "--enable-unicode-properties"
63 "--enable-pcre16"
64 "--enable-pcre32"
af823dc6 65 ;; pcretest fails on powerpc32.
89022186
EF
66 ;; riscv64-linux is an unsupported architecture.
67 ,@(if (or (target-ppc32?)
68 (target-riscv64?))
af823dc6
EF
69 '()
70 `("--enable-jit")))
50849734
MB
71 #:phases (modify-phases %standard-phases
72 (add-after 'install 'move-static-libs
73 (lambda* (#:key outputs #:allow-other-keys)
74 (let ((source (string-append (assoc-ref outputs "out") "/lib"))
75 (static (string-append (assoc-ref outputs "static") "/lib")))
76 (mkdir-p static)
77 (for-each (lambda (lib)
78 (link lib (string-append static "/"
79 (basename lib)))
80 (delete-file lib))
81d0ac2d 81 (find-files source "\\.a$"))))))))
35b9e423 82 (synopsis "Perl Compatible Regular Expressions")
10d1822b
AE
83 (description
84 "The PCRE library is a set of functions that implement regular expression
35b9e423 85pattern matching using the same syntax and semantics as Perl 5. PCRE has its
10d1822b
AE
86own native API, as well as a set of wrapper functions that correspond to the
87POSIX regular expression API.")
88 (license license:bsd-3)
265c31f5 89 (home-page "https://www.pcre.org/")))
7ea3099b
RW
90
91(define-public pcre2
92 (package
93 (name "pcre2")
fff2e2d2 94 (version "10.37")
7ea3099b
RW
95 (source (origin
96 (method url-fetch)
97 (uri (string-append "mirror://sourceforge/pcre/pcre2/"
98 version "/pcre2-" version ".tar.bz2"))
7ea3099b
RW
99 (sha256
100 (base32
fff2e2d2 101 "0w6jaswjmg3bc0wsw6msn5bvk66p90kf2asnnj9rhll0idpak5ad"))))
7ea3099b 102 (build-system gnu-build-system)
8394619b 103 (inputs (list bzip2 readline zlib))
7ea3099b
RW
104 (arguments
105 `(#:configure-flags '("--enable-unicode"
af6e2385
LF
106 "--enable-pcre2grep-libz"
107 "--enable-pcre2grep-libbz2"
108 "--enable-pcre2test-libreadline"
7ea3099b
RW
109 "--enable-pcre2-16"
110 "--enable-pcre2-32"
bbb0420e 111 ;; pcre2_jit_test fails on powerpc32.
2bae32e1
EF
112 ;; riscv64-linux is an unsupported architecture.
113 ,@(if (or (target-ppc32?)
114 (target-riscv64?))
bbb0420e
EF
115 '()
116 `("--enable-jit"))
f6943db7 117 "--disable-static")
9bb766e7
MB
118 #:phases
119 (modify-phases %standard-phases
120 (add-after 'unpack 'patch-paths
121 (lambda _
122 (substitute* "RunGrepTest"
fff2e2d2 123 (("/bin/echo") (which "echo"))))))))
7ea3099b
RW
124 (synopsis "Perl Compatible Regular Expressions")
125 (description
126 "The PCRE library is a set of functions that implement regular expression
127pattern matching using the same syntax and semantics as Perl 5. PCRE has its
128own native API, as well as a set of wrapper functions that correspond to the
129POSIX regular expression API.")
130 (license license:bsd-3)
265c31f5 131 (home-page "https://www.pcre.org/")))