gnu: python-babel: Update to 2.7.0.
[guix.git] / gnu / packages / regex.scm
bloba64944080ba97aec5eb43aac576058e16955a1b8
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 John Darrington
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages regex)
23   #:use-module ((guix licenses) #:prefix license:)
24   #:use-module (guix packages)
25   #:use-module (guix download)
26   #:use-module (guix git-download)
27   #:use-module (guix build-system gnu)
28   #:use-module (guix utils))
30 (define-public re2
31    (package
32      (name "re2")
33      (version "2019-06-01")
34      (home-page "https://github.com/google/re2")
35      (source (origin
36                (method git-fetch)
37                (uri (git-reference (url home-page) (commit version)))
38                (file-name (git-file-name name version))
39                (sha256
40                 (base32
41                  "01613z66wgiffdngbq3031rwd92jf87j93h7y5mn8hlx19gg5k4j"))))
42      (build-system gnu-build-system)
43      (arguments
44       `(#:modules ((guix build gnu-build-system)
45                    (guix build utils)
46                    (srfi srfi-1))
47         #:test-target "test"
48         ;; There is no configure step, but the Makefile respects a prefix.
49         ;; As ./configure does not know anything about the target CXX
50         ;; we need to specify TARGET-g++ explicitly.
51         #:make-flags (list (string-append "prefix=" %output)
52                            (string-append
53                              "CXX=" ,(string-append
54                                        (if (%current-target-system)
55                                            (string-append
56                                              (%current-target-system) "-")
57                                            "")
58                                        "g++")))
59         #:phases
60         (modify-phases %standard-phases
61           (delete 'configure)
62           (add-after 'install 'delete-static-library
63             (lambda* (#:key outputs #:allow-other-keys)
64               ;; No make target for shared-only; delete the static version.
65               (delete-file (string-append (assoc-ref outputs "out")
66                                           "/lib/libre2.a"))
67               #t)))))
68      (synopsis "Fast, safe, thread-friendly regular expression engine")
69      (description "RE2 is a fast, safe, thread-friendly alternative to
70 backtracking regular expression engines like those used in PCRE, Perl and
71 Python.  It is a C++ library.")
72      (license license:bsd-3)))
74 (define-public tre
75   (package
76     (name "tre")
77     (version "0.8.0")
78     (source (origin
79               (method url-fetch)
80               (uri (string-append "http://laurikari.net/tre/"
81                                   name "-" version ".tar.bz2"))
82               (sha256
83                (base32
84                 "0n36cgqys59r2gmb7jzbqiwsy790v8nbxk82d2n2saz0rp145ild"))))
85     (build-system gnu-build-system)
86     (arguments
87      `(#:phases
88        (modify-phases %standard-phases
89          (add-before 'check 'install-locales
90            (lambda _
91              ;; The tests require the availability of the
92              ;; 'en_US.ISO-8859-1' locale.
93              (setenv "LOCPATH" (getcwd))
94              (invoke "localedef" "--no-archive"
95                      "--prefix" (getcwd) "-i" "en_US"
96                      "-f" "ISO-8859-1" "./en_US.ISO-8859-1"))))))
97     (synopsis "Approximate regex matching library and agrep utility")
98     (description "Superset of the POSIX regex API, enabling approximate
99 matching.  Also ships a version of the agrep utility which behaves similar to
100 grep but features inexact matching.")
101     (home-page "http://laurikari.net/tre")
102     (license license:bsd-2)))