gnu: libconfig: Update to 1.7.2.
[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-03-01")
33 (source (origin
34 (method url-fetch)
35 (uri
36 (string-append
37 "https://github.com/google/re2/archive/"
38 version ".tar.gz"))
39 (file-name (string-append name "-" version ".tar.gz"))
40 (sha256
41 (base32
42 "0y21g321a802xmxdbkfz0rkcark7ypglpb3jjqhf13m6s7lpxp2i"))))
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 (home-page "https://github.com/google/re2")
70 (synopsis "Fast, safe, thread-friendly regular expression engine")
71 (description "RE2 is a fast, safe, thread-friendly alternative to
72 backtracking regular expression engines like those used in PCRE, Perl and
73 Python. It is a C++ library.")
74 (license license:bsd-3)))
75
76 (define-public tre
77 (package
78 (name "tre")
79 (version "0.8.0")
80 (source (origin
81 (method url-fetch)
82 (uri (string-append "http://laurikari.net/tre/"
83 name "-" version ".tar.bz2"))
84 (sha256
85 (base32
86 "0n36cgqys59r2gmb7jzbqiwsy790v8nbxk82d2n2saz0rp145ild"))))
87 (build-system gnu-build-system)
88 (arguments
89 `(#:phases
90 (modify-phases %standard-phases
91 (add-before 'check 'install-locales
92 (lambda _
93 ;; The tests require the availability of the
94 ;; 'en_US.ISO-8859-1' locale.
95 (setenv "LOCPATH" (getcwd))
96 (zero? (system* "localedef" "--no-archive"
97 "--prefix" (getcwd) "-i" "en_US"
98 "-f" "ISO-8859-1" "./en_US.ISO-8859-1")))))))
99 (synopsis "Approximate regex matching library and agrep utility")
100 (description "Superset of the POSIX regex API, enabling approximate
101 matching. Also ships a version of the agrep utility which behaves similar to
102 grep but features inexact matching.")
103 (home-page "http://laurikari.net/tre")
104 (license license:bsd-2)))