;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2014, 2015 Mark H Weaver ;;; Copyright © 2014 Ian Denhardt ;;; Copyright © 2013, 2015 Andreas Enge ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (g
aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
;;; Copyright © 2017, 2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2021, 2022 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages pcre)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages readline)
  #:use-module (gnu packages)
  #:use-module (guix utils)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix utils)
  #:use-module (guix build-system gnu))

(define-public pcre
  (package
    (name "pcre")
    (version "8.45")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://sourceforge/pcre/pcre/"
                                  version "/pcre-" version ".tar.bz2"))
              (sha256
               (base32
                "1f7zichy6iimmkfrqdl575sdlm795cyc75szgg1vc2xvsbf6zbjd"))))
    (build-system gnu-build-system)
    (outputs '("out"          ;library & headers
               "bin"          ;depends on Readline (adds 20MiB to the closure)
               "doc"          ;1.8 MiB of HTML
               "static"))     ;1.8 MiB static libraries
    (inputs (list bzip2 readline zlib))
    (arguments
     (list
      #:disallowed-references '("doc")
      #:configure-flags #~'("--enable-utf"
                            "--enable-pcregrep-libz"
                            "--enable-pcregrep-libbz2"
                            "--enable-pcretest-libreadline"
                            "--enable-unicode-properties"
                            "--enable-pcre16"
                            "--enable-pcre32"
                            ;; riscv64-linux is an unsupported architecture.
                            #$@(if (target-riscv64?)
                                   #~()
                                   #~("--enable-jit")))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'install 'move-static-libs
            (lambda _
              (let ((source (string-append #$output "/lib"))
                    (static (string-append #$output:static "/lib")))
                (mkdir-p static)
                (for-each (lambda (lib)
                            (link lib (string-append static "/"
                                                     (basename lib)))
                            (delete-file lib))
                          (find-files source "\\.a$"))))))))
    (synopsis "Perl Compatible Regular Expressions")
    (description
     "The PCRE library is a set of functions that implement regular expression
pattern matching using the same syntax and semantics as Perl 5.  PCRE has its
own native API, as well as a set of wrapper functions that correspond to the
POSIX regular expression API.")
    (license license:bsd-3)
    (home-page "https://www.pcre.org/")))

(define-public pcre2
  (package
    (name "pcre2")
    (version "10.42")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://github.com/PCRE2Project/pcre2"
                                  "/releases/download/pcre2-" version
                                  "/pcre2-" version ".tar.bz2"))
              (sha256
               (base32
                "0h78np8h3dxlmvqvpnj558x67267n08n9zsqncmlqapans6csdld"))))
    (build-system gnu-build-system)
    (outputs '("out" "static"))
    (inputs (list bzip2 readline zlib))
    (arguments
     (list #:configure-flags
           #~'("--enable-unicode"
               "--enable-pcre2grep-libz"
               "--enable-pcre2grep-libbz2"
               "--enable-pcre2test-libreadline"
               "--enable-pcre2-16"
               "--enable-pcre2-32"
               ;; riscv64-linux is an unsupported architecture.
               #$@(if (target-riscv64?)
                      #~()
                      #~("--enable-jit")))
           #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'patch-paths
                 (lambda _
                   (substitute* "RunGrepTest"
                     (("/bin/echo") (which "echo")))))
               (add-after 'install 'move-static-libs
                 (lambda _
                   (let ((source (string-append #$output "/lib"))
                         (static (string-append #$output:static "/lib")))
                     (mkdir-p static)
                     (for-each (lambda (lib)
                                 (link lib (string-append static "/"
                                                          (basename lib)))
                                 (delete-file lib))
                               (find-files source "\\.a$"))))))))
    (synopsis "Perl Compatible Regular Expressions")
    (description
     "The PCRE library is a set of functions that implement regular expression
pattern matching using the same syntax and semantics as Perl 5.  PCRE has its
own native API, as well as a set of wrapper functions that correspond to the
POSIX regular expression API.")
    (license license:bsd-3)
    (home-page "https://www.pcre.org/")))
;; PREFIX/ssl. Change that to something more ;; conventional. (string-append "--openssldir=" out "/share/openssl-" ,version) (string-append "--prefix=" out) ;; XXX FIXME: Work around a code generation bug in GCC ;; 4.9.3 on ARM when compiled with -mfpu=neon. See: ;; ,@(if (and (not (%current-target-system)) (string-prefix? "armhf" (%current-system))) '("-mfpu=vfpv3") '())))))) (add-after 'install 'make-libraries-writable (lambda* (#:key outputs #:allow-other-keys) ;; Make libraries writable so that 'strip' does its job. (let ((out (assoc-ref outputs "out"))) (for-each (lambda (file) (chmod file #o644)) (find-files (string-append out "/lib") "\\.so")) #t))) (add-before 'patch-source-shebangs 'patch-tests (lambda* (#:key inputs native-inputs #:allow-other-keys) (let ((bash (assoc-ref (or native-inputs inputs) "bash"))) (substitute* (find-files "test" ".*") (("/bin/sh") (string-append bash "/bin/bash")) (("/bin/rm") "rm"))))) (add-after 'install 'remove-miscellany (lambda* (#:key outputs #:allow-other-keys) ;; The 'misc' directory contains random undocumented shell and Perl ;; scripts. Remove them to avoid retaining a reference on Perl. (let ((out (assoc-ref outputs "out"))) (delete-file-recursively (string-append out "/share/openssl-" ,version "/misc")) #t)))))) (native-search-paths ;; FIXME: These two variables must designate a single file or directory ;; and are not actually "search paths." In practice it works OK in user ;; profiles because there's always just one item that matches the ;; specification. (list (search-path-specification (variable "SSL_CERT_DIR") (files '("etc/ssl/certs"))) (search-path-specification (variable "SSL_CERT_FILE") (files '("etc/ssl/certs/ca-certificates.crt"))))) (synopsis "SSL/TLS implementation") (description "OpenSSL is an implementation of SSL/TLS.") (license license:openssl) (home-page "http://www.openssl.org/"))) (define-public libressl (package (name "libressl") (version "2.2.0") (source (origin (method url-fetch) (uri (string-append "http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-" version ".tar.gz")) (sha256 (base32 "0h1haqb4y39p1zihwvnr1ib0zfq5bcqfnbj5jm9l4j2xibrxi44n")))) (build-system gnu-build-system) (native-search-paths ;; FIXME: These two variables must designate a single file or directory ;; and are not actually "search paths." In practice it works OK in ;; user profiles because there's always just one item that matches the ;; specification. (list (search-path-specification (variable "SSL_CERT_DIR") (files '("etc/ssl/certs"))) (search-path-specification (variable "SSL_CERT_FILE") (files '("etc/ssl/certs/ca-certificates.crt"))))) (home-page "http://www.libressl.org/") (synopsis "SSL/TLS implementation") (description "LibreSSL is a version of the TLS/crypto stack forked from OpenSSL in 2014, with the goals of modernizing the codebase, improving security, and applying best practice development processes.") ;; Files taken from OpenSSL keep their license, others are under various ;; non-copyleft licenses. (license (list license:openssl (license:non-copyleft "file://COPYING" "See COPYING in the distribution."))))) (define-public perl-net-ssleay (package (name "perl-net-ssleay") (version "1.68") (source (origin (method url-fetch) (uri (string-append "mirror://cpan/authors/id/M/MI/MIKEM/" "Net-SSLeay-" version ".tar.gz")) (sha256 (base32 "1m2wwzhjwsg0drlhp9w12fl6bsgj69v8gdz72jqrqll3qr7f408p")))) (build-system perl-build-system) (native-inputs `(("patch" ,patch) ("patch/disable-ede-test" ,(search-patch "perl-net-ssleay-disable-ede-test.patch")))) (inputs `(("openssl" ,openssl))) (arguments `(#:phases (modify-phases %standard-phases (add-after 'unpack 'apply-patch (lambda* (#:key inputs #:allow-other-keys) ;; XXX We apply this patch here instead of in the 'origin' because ;; this package's build system fails badly when the source file ;; times are zeroed. ;; XXX Try removing this patch for perl-net-ssleay > 1.68 (zero? (system* "patch" "--force" "-p1" "-i" (assoc-ref inputs "patch/disable-ede-test"))))) (add-before 'configure 'set-ssl-prefix (lambda* (#:key inputs #:allow-other-keys) (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl")) #t))))) (synopsis "Perl extension for using OpenSSL") (description "This module offers some high level convenience functions for accessing web pages on SSL servers (for symmetry, the same API is offered for accessing http servers, too), an sslcat() function for writing your own clients, and finally access to the SSL api of the SSLeay/OpenSSL package so you can write servers or clients for more complicated applications.") (license (package-license perl)) (home-page "http://search.cpan.org/~mikem/Net-SSLeay-1.66/")))