gnu: r-gviz: Update to 1.24.0.
[jackhill/guix/guix.git] / gnu / packages / regex.scm
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/>.
21
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 build-system gnu)
27 #:use-module (guix utils))
28
29 (define-public re2
30 (package
31 (name "re2")
32 (version "2018-04-01")
33 (home-page "https://github.com/google/re2")
34 (source (origin
35 (method url-fetch)
36 (uri (string-append home-page "/archive/" version ".tar.gz"))
37 (file-name (string-append name "-" version ".tar.gz"))
38 (sha256
39 (base32
40 "04n9ngikvpikpshwcrl26sxgn8qbrymy3b5wlbsyfdhknx35951g"))))
41 (build-system gnu-build-system)
42 (arguments
43 `(#:modules ((guix build gnu-build-system)
44 (guix build utils)
45 (srfi srfi-1))
46 #:test-target "test"
47 ;; There is no configure step, but the Makefile respects a prefix.
48 ;; As ./configure does not know anything about the target CXX
49 ;; we need to specify TARGET-g++ explicitly.
50 #:make-flags (list (string-append "prefix=" %output)
51 (string-append
52 "CXX=" ,(string-append
53 (if (%current-target-system)
54 (string-append
55 (%current-target-system) "-")
56 "")
57 "g++")))
58 #:phases
59 (modify-phases %standard-phases
60 (delete 'configure)
61 (add-after 'install 'delete-static-library
62 (lambda* (#:key outputs #:allow-other-keys)
63 ;; No make target for shared-only; delete the static version.
64 (delete-file (string-append (assoc-ref outputs "out")
65 "/lib/libre2.a"))
66 #t)))))
67 (synopsis "Fast, safe, thread-friendly regular expression engine")
68 (description "RE2 is a fast, safe, thread-friendly alternative to
69 backtracking regular expression engines like those used in PCRE, Perl and
70 Python. It is a C++ library.")
71 (license license:bsd-3)))
72
73 (define-public tre
74 (package
75 (name "tre")
76 (version "0.8.0")
77 (source (origin
78 (method url-fetch)
79 (uri (string-append "http://laurikari.net/tre/"
80 name "-" version ".tar.bz2"))
81 (sha256
82 (base32
83 "0n36cgqys59r2gmb7jzbqiwsy790v8nbxk82d2n2saz0rp145ild"))))
84 (build-system gnu-build-system)
85 (arguments
86 `(#:phases
87 (modify-phases %standard-phases
88 (add-before 'check 'install-locales
89 (lambda _
90 ;; The tests require the availability of the
91 ;; 'en_US.ISO-8859-1' locale.
92 (setenv "LOCPATH" (getcwd))
93 (zero? (system* "localedef" "--no-archive"
94 "--prefix" (getcwd) "-i" "en_US"
95 "-f" "ISO-8859-1" "./en_US.ISO-8859-1")))))))
96 (synopsis "Approximate regex matching library and agrep utility")
97 (description "Superset of the POSIX regex API, enabling approximate
98 matching. Also ships a version of the agrep utility which behaves similar to
99 grep but features inexact matching.")
100 (home-page "http://laurikari.net/tre")
101 (license license:bsd-2)))