gnu: mgba: Update to 0.8.2.
[jackhill/guix/guix.git] / gnu / packages / regex.scm
CommitLineData
dc253bf0 1;;; GNU Guix --- Functional package management for GNU
ac8a6428
MB
2;;; Copyright © 2014 John Darrington
3;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
16fbbf6a 4;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
0c58139c 5;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
dc253bf0
MB
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)
56302fc1 26 #:use-module (guix git-download)
612af7ff
ST
27 #:use-module (guix build-system gnu)
28 #:use-module (guix utils))
dc253bf0
MB
29
30(define-public re2
31 (package
32 (name "re2")
0c58139c 33 (version "2020-06-01")
e3bb89a9 34 (home-page "https://github.com/google/re2")
dc253bf0 35 (source (origin
56302fc1
MB
36 (method git-fetch)
37 (uri (git-reference (url home-page) (commit version)))
38 (file-name (git-file-name name version))
dc253bf0
MB
39 (sha256
40 (base32
0c58139c 41 "10jdgnp5dvkj3ay7grmdy539vv1srglnfxaqc5kb9v53cbql5hm8"))
16fbbf6a
MB
42 (modules '((guix build utils)))
43 (snippet
44 '(begin
45 ;; Fix test failure on 32-bit platforms, see
46 ;; <https://github.com/google/re2/issues/256>.
47 (substitute* "re2/testing/compile_test.cc"
48 (("re->CompileToProg\\(920\\)")
49 "re->CompileToProg(850)"))
50 #t))))
dc253bf0
MB
51 (build-system gnu-build-system)
52 (arguments
7a4a64e9
ST
53 `(#:modules ((guix build gnu-build-system)
54 (guix build utils)
55 (srfi srfi-1))
56 #:test-target "test"
dc253bf0 57 ;; There is no configure step, but the Makefile respects a prefix.
612af7ff
ST
58 ;; As ./configure does not know anything about the target CXX
59 ;; we need to specify TARGET-g++ explicitly.
60 #:make-flags (list (string-append "prefix=" %output)
61 (string-append
62 "CXX=" ,(string-append
63 (if (%current-target-system)
64 (string-append
65 (%current-target-system) "-")
66 "")
67 "g++")))
dc253bf0
MB
68 #:phases
69 (modify-phases %standard-phases
70 (delete 'configure)
71 (add-after 'install 'delete-static-library
72 (lambda* (#:key outputs #:allow-other-keys)
73 ;; No make target for shared-only; delete the static version.
74 (delete-file (string-append (assoc-ref outputs "out")
4a9c4a55
MB
75 "/lib/libre2.a"))
76 #t)))))
dc253bf0
MB
77 (synopsis "Fast, safe, thread-friendly regular expression engine")
78 (description "RE2 is a fast, safe, thread-friendly alternative to
79backtracking regular expression engines like those used in PCRE, Perl and
80Python. It is a C++ library.")
81 (license license:bsd-3)))
ac8a6428
MB
82
83(define-public tre
84 (package
85 (name "tre")
86 (version "0.8.0")
87 (source (origin
88 (method url-fetch)
89 (uri (string-append "http://laurikari.net/tre/"
90 name "-" version ".tar.bz2"))
91 (sha256
92 (base32
93 "0n36cgqys59r2gmb7jzbqiwsy790v8nbxk82d2n2saz0rp145ild"))))
94 (build-system gnu-build-system)
95 (arguments
dc1d3cde
KK
96 `(#:phases
97 (modify-phases %standard-phases
98 (add-before 'check 'install-locales
99 (lambda _
100 ;; The tests require the availability of the
101 ;; 'en_US.ISO-8859-1' locale.
102 (setenv "LOCPATH" (getcwd))
ed590089
RW
103 (invoke "localedef" "--no-archive"
104 "--prefix" (getcwd) "-i" "en_US"
105 "-f" "ISO-8859-1" "./en_US.ISO-8859-1"))))))
ac8a6428
MB
106 (synopsis "Approximate regex matching library and agrep utility")
107 (description "Superset of the POSIX regex API, enabling approximate
108matching. Also ships a version of the agrep utility which behaves similar to
109grep but features inexact matching.")
110 (home-page "http://laurikari.net/tre")
111 (license license:bsd-2)))