| 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 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
| 10 | ;;; |
| 11 | ;;; This file is part of GNU Guix. |
| 12 | ;;; |
| 13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 14 | ;;; under the terms of the GNU General Public License as published by |
| 15 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 16 | ;;; your option) any later version. |
| 17 | ;;; |
| 18 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 19 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | ;;; GNU General Public License for more details. |
| 22 | ;;; |
| 23 | ;;; You should have received a copy of the GNU General Public License |
| 24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 25 | |
| 26 | (define-module (gnu packages pcre) |
| 27 | #:use-module ((guix licenses) #:prefix license:) |
| 28 | #:use-module (gnu packages compression) |
| 29 | #:use-module (gnu packages readline) |
| 30 | #:use-module (gnu packages) |
| 31 | #:use-module (guix packages) |
| 32 | #:use-module (guix download) |
| 33 | #:use-module (guix build-system gnu)) |
| 34 | |
| 35 | (define-public pcre |
| 36 | (package |
| 37 | (name "pcre") |
| 38 | (version "8.44") |
| 39 | (source (origin |
| 40 | (method url-fetch) |
| 41 | (uri (list |
| 42 | (string-append "ftp://ftp.csx.cam.ac.uk" |
| 43 | "/pub/software/programming/pcre/" |
| 44 | "pcre-" version ".tar.bz2") |
| 45 | (string-append "mirror://sourceforge/pcre/pcre/" |
| 46 | version "/pcre-" version ".tar.bz2"))) |
| 47 | (sha256 |
| 48 | (base32 |
| 49 | "0v9nk51wh55pcbnf2jr36yarz8ayajn6d7ywiq2wagivn9c8c40r")))) |
| 50 | (build-system gnu-build-system) |
| 51 | (outputs '("out" ;library & headers |
| 52 | "bin" ;depends on Readline (adds 20MiB to the closure) |
| 53 | "doc" ;1.8 MiB of HTML |
| 54 | "static")) ;1.8 MiB static libraries |
| 55 | (inputs `(("bzip2" ,bzip2) |
| 56 | ("readline" ,readline) |
| 57 | ("zlib" ,zlib))) |
| 58 | (arguments |
| 59 | '(#:disallowed-references ("doc") |
| 60 | #:configure-flags '("--enable-utf" |
| 61 | "--enable-pcregrep-libz" |
| 62 | "--enable-pcregrep-libbz2" |
| 63 | "--enable-pcretest-libreadline" |
| 64 | "--enable-unicode-properties" |
| 65 | "--enable-pcre16" |
| 66 | "--enable-pcre32" |
| 67 | "--enable-jit") |
| 68 | #:phases (modify-phases %standard-phases |
| 69 | (add-after 'install 'move-static-libs |
| 70 | (lambda* (#:key outputs #:allow-other-keys) |
| 71 | (let ((source (string-append (assoc-ref outputs "out") "/lib")) |
| 72 | (static (string-append (assoc-ref outputs "static") "/lib"))) |
| 73 | (mkdir-p static) |
| 74 | (for-each (lambda (lib) |
| 75 | (link lib (string-append static "/" |
| 76 | (basename lib))) |
| 77 | (delete-file lib)) |
| 78 | (find-files source "\\.a$")) |
| 79 | #t)))))) |
| 80 | (synopsis "Perl Compatible Regular Expressions") |
| 81 | (description |
| 82 | "The PCRE library is a set of functions that implement regular expression |
| 83 | pattern matching using the same syntax and semantics as Perl 5. PCRE has its |
| 84 | own native API, as well as a set of wrapper functions that correspond to the |
| 85 | POSIX regular expression API.") |
| 86 | (license license:bsd-3) |
| 87 | (home-page "https://www.pcre.org/"))) |
| 88 | |
| 89 | (define-public pcre2 |
| 90 | (package |
| 91 | (name "pcre2") |
| 92 | (version "10.35") |
| 93 | (source (origin |
| 94 | (method url-fetch) |
| 95 | (uri (string-append "mirror://sourceforge/pcre/pcre2/" |
| 96 | version "/pcre2-" version ".tar.bz2")) |
| 97 | (sha256 |
| 98 | (base32 |
| 99 | "04s6kmk9qdd4rjz477h547j4bx7hfz0yalpvrm381rqc5ghaijww")))) |
| 100 | (build-system gnu-build-system) |
| 101 | (inputs `(("bzip2" ,bzip2) |
| 102 | ("readline" ,readline) |
| 103 | ("zlib" ,zlib))) |
| 104 | (arguments |
| 105 | `(#:configure-flags '("--enable-unicode" |
| 106 | "--enable-pcre2grep-libz" |
| 107 | "--enable-pcre2grep-libbz2" |
| 108 | "--enable-pcre2test-libreadline" |
| 109 | "--enable-pcre2-16" |
| 110 | "--enable-pcre2-32" |
| 111 | "--enable-jit" |
| 112 | "--disable-static") |
| 113 | #:phases |
| 114 | (modify-phases %standard-phases |
| 115 | (add-after 'unpack 'patch-paths |
| 116 | (lambda _ |
| 117 | (substitute* "RunGrepTest" |
| 118 | (("/bin/echo") (which "echo"))) |
| 119 | #t))))) |
| 120 | (synopsis "Perl Compatible Regular Expressions") |
| 121 | (description |
| 122 | "The PCRE library is a set of functions that implement regular expression |
| 123 | pattern matching using the same syntax and semantics as Perl 5. PCRE has its |
| 124 | own native API, as well as a set of wrapper functions that correspond to the |
| 125 | POSIX regular expression API.") |
| 126 | (license license:bsd-3) |
| 127 | (home-page "https://www.pcre.org/"))) |