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