pcre.scm 5.6 KB

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