regex.scm 4.3 KB

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