pcre.scm 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
  3. ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
  5. ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
  6. ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
  7. ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
  8. ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
  9. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  10. ;;;
  11. ;;; This file is part of GNU Guix.
  12. ;;;
  13. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  14. ;;; under the terms of the GNU General Public License as published by
  15. ;;; the Free Software Foundation; either version 3 of the License, or (at
  16. ;;; your option) any later version.
  17. ;;;
  18. ;;; GNU Guix is distributed in the hope that it will be useful, but
  19. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. ;;; GNU General Public License for more details.
  22. ;;;
  23. ;;; You should have received a copy of the GNU General Public License
  24. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  25. (define-module (gnu packages pcre)
  26. #:use-module ((guix licenses) #:prefix license:)
  27. #:use-module (gnu packages compression)
  28. #:use-module (gnu packages readline)
  29. #:use-module (gnu packages)
  30. #:use-module (guix packages)
  31. #:use-module (guix download)
  32. #:use-module (guix build-system gnu))
  33. (define-public pcre
  34. (package
  35. (name "pcre")
  36. (version "8.42")
  37. (source (origin
  38. (method url-fetch)
  39. (uri (list
  40. (string-append "ftp://ftp.csx.cam.ac.uk"
  41. "/pub/software/programming/pcre/"
  42. "pcre-" version ".tar.bz2")
  43. (string-append "mirror://sourceforge/pcre/pcre/"
  44. version "/pcre-" version ".tar.bz2")))
  45. (sha256
  46. (base32
  47. "00ckpzlgyr16bnqx8fawa3afjgqxw5yxgs2l081vw23qi1y4pl1c"))))
  48. (build-system gnu-build-system)
  49. (outputs '("out" ;library & headers
  50. "bin" ;depends on Readline (adds 20MiB to the closure)
  51. "doc" ;1.8 MiB of HTML
  52. "static")) ;1.8 MiB static libraries
  53. (inputs `(("bzip2" ,bzip2)
  54. ("readline" ,readline)
  55. ("zlib" ,zlib)))
  56. (arguments
  57. '(#:disallowed-references ("doc")
  58. #:configure-flags '("--enable-utf"
  59. "--enable-pcregrep-libz"
  60. "--enable-pcregrep-libbz2"
  61. "--enable-pcretest-libreadline"
  62. "--enable-unicode-properties"
  63. "--enable-pcre16"
  64. "--enable-pcre32"
  65. "--enable-jit")
  66. #:phases (modify-phases %standard-phases
  67. (add-after 'install 'move-static-libs
  68. (lambda* (#:key outputs #:allow-other-keys)
  69. (let ((source (string-append (assoc-ref outputs "out") "/lib"))
  70. (static (string-append (assoc-ref outputs "static") "/lib")))
  71. (mkdir-p static)
  72. (for-each (lambda (lib)
  73. (link lib (string-append static "/"
  74. (basename lib)))
  75. (delete-file lib))
  76. (find-files source "\\.a$"))
  77. #t))))))
  78. (synopsis "Perl Compatible Regular Expressions")
  79. (description
  80. "The PCRE library is a set of functions that implement regular expression
  81. pattern matching using the same syntax and semantics as Perl 5. PCRE has its
  82. own native API, as well as a set of wrapper functions that correspond to the
  83. POSIX regular expression API.")
  84. (license license:bsd-3)
  85. (home-page "https://www.pcre.org/")))
  86. (define-public pcre2
  87. (package
  88. (name "pcre2")
  89. (version "10.31")
  90. (source (origin
  91. (method url-fetch)
  92. (uri (string-append "mirror://sourceforge/pcre/pcre2/"
  93. version "/pcre2-" version ".tar.bz2"))
  94. (sha256
  95. (base32
  96. "1b389pzw91k1hzydsh4smdsxyppwz4pv74m3nrvy8rda0j3m6zg0"))))
  97. (build-system gnu-build-system)
  98. (inputs `(("bzip2" ,bzip2)
  99. ("readline" ,readline)
  100. ("zlib" ,zlib)))
  101. (arguments
  102. `(#:configure-flags '("--enable-unicode"
  103. "--enable-pcre2grep-libz"
  104. "--enable-pcre2grep-libbz2"
  105. "--enable-pcre2test-libreadline"
  106. "--enable-pcre2-16"
  107. "--enable-pcre2-32"
  108. "--enable-jit")
  109. #:phases
  110. (modify-phases %standard-phases
  111. (add-after 'unpack 'patch-paths
  112. (lambda _
  113. (substitute* "RunGrepTest"
  114. (("/bin/echo") (which "echo")))
  115. #t)))))
  116. (synopsis "Perl Compatible Regular Expressions")
  117. (description
  118. "The PCRE library is a set of functions that implement regular expression
  119. pattern matching using the same syntax and semantics as Perl 5. PCRE has its
  120. own native API, as well as a set of wrapper functions that correspond to the
  121. POSIX regular expression API.")
  122. (license license:bsd-3)
  123. (home-page "https://www.pcre.org/")))