gnu: curl: Update replacement to 7.65.0 [fixes CVE-2019-5435, CVE-2019-5436]
[guix.git] / gnu / packages / curl.scm
blob5682a4a1076a80f64d40e59c6d4617e19a2ec00a
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Tomáš Čech <sleep_walker@suse.cz>
5 ;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2016, 2017, 2019 Leo Famulari <leo@famulari.name>
7 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
8 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2018 Roel Janssen <roel@gnu.org>
11 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
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/>.
28 (define-module (gnu packages curl)
29   #:use-module ((guix licenses) #:prefix license:)
30   #:use-module (guix packages)
31   #:use-module (guix download)
32   #:use-module (guix git-download)
33   #:use-module (guix utils)
34   #:use-module (guix build-system gnu)
35   #:use-module (guix build-system go)
36   #:use-module (gnu packages)
37   #:use-module (gnu packages compression)
38   #:use-module (gnu packages golang)
39   #:use-module (gnu packages groff)
40   #:use-module (gnu packages gsasl)
41   #:use-module (gnu packages guile)
42   #:use-module (gnu packages libidn)
43   #:use-module (gnu packages openldap)
44   #:use-module (gnu packages perl)
45   #:use-module (gnu packages pkg-config)
46   #:use-module (gnu packages python)
47   #:use-module (gnu packages ssh)
48   #:use-module (gnu packages tls)
49   #:use-module (gnu packages web))
51 (define-public curl
52   (package
53    (name "curl")
54    (replacement curl-7.65.0)
55    (version "7.63.0")
56    (source (origin
57             (method url-fetch)
58             (uri (string-append "https://curl.haxx.se/download/curl-"
59                                 version ".tar.xz"))
60             (sha256
61              (base32
62               "1i38v49233jirzlfqd8fy6jyf80assa953hk7w6qmysbg562604n"))))
63    (build-system gnu-build-system)
64    (outputs '("out"
65               "doc"))                             ;1.2 MiB of man3 pages
66    (inputs `(("gnutls" ,gnutls)
67              ("gss" ,gss)
68              ("libidn" ,libidn)
69              ;; TODO XXX <https://bugs.gnu.org/34927>
70              ;; Curl doesn't actually use or refer to libssh2 because the build
71              ;; is not configured with '--with-libssh2'.  Remove this input when
72              ;; a mass rebuild is appropriate (e.g. core-updates).
73              ("libssh2" ,libssh2-1.8.0)
74              ("openldap" ,openldap)
75              ("nghttp2" ,nghttp2 "lib")
76              ("zlib" ,zlib)))
77    (native-inputs
78      `(("perl" ,perl)
79        ;; to enable the --manual option and make test 1026 pass
80        ("groff" ,groff)
81        ("pkg-config" ,pkg-config)
82        ("python" ,python-2)))
83    (native-search-paths
84     ;; Note: This search path is respected by the `curl` command-line tool only.
85     ;; Ideally we would bake this into libcurl itself so other users can benefit,
86     ;; but it's not supported upstream due to thread safety concerns.
87     (list (search-path-specification
88            (variable "CURL_CA_BUNDLE")
89            (file-type 'regular)
90            (separator #f)                         ;single entry
91            (files '("etc/ssl/certs/ca-certificates.crt")))))
92    (arguments
93     `(#:configure-flags '("--with-gnutls" "--with-gssapi"
94                           "--disable-static")
95       ;; Add a phase to patch '/bin/sh' occurances in tests/runtests.pl
96       #:phases
97       (modify-phases %standard-phases
98         (add-after
99          'install 'move-man3-pages
100          (lambda* (#:key outputs #:allow-other-keys)
101            ;; Move section 3 man pages to "doc".
102            (let ((out (assoc-ref outputs "out"))
103                  (doc (assoc-ref outputs "doc")))
104              (mkdir-p (string-append doc "/share/man"))
105              (rename-file (string-append out "/share/man/man3")
106                           (string-append doc "/share/man/man3"))
107              #t)))
108         (replace
109          'check
110          (lambda _
111            (substitute* "tests/runtests.pl"
112              (("/bin/sh") (which "sh")))
114            ;; XXX FIXME: Test #1510 seems to work on some machines and not
115            ;; others, possibly based on the kernel version.  It works on Guix System
116            ;; on x86_64 with linux-libre-4.1, but fails on Hydra for both i686
117            ;; and x86_64 with the following error:
118            ;;
119            ;; test 1510...[HTTP GET connection cache limit (CURLOPT_MAXCONNECTS)]
120            ;;
121            ;;  1510: output (log/stderr1510) FAILED:
122            ;; --- log/check-expected    2015-06-27 07:45:53.166720834 +0000
123            ;; +++ log/check-generated   2015-06-27 07:45:53.166720834 +0000
124            ;; @@ -1,5 +1,5 @@
125            ;;  * Connection #0 to host server1.example.com left intact[LF]
126            ;;  * Connection #1 to host server2.example.com left intact[LF]
127            ;;  * Connection #2 to host server3.example.com left intact[LF]
128            ;; -* Closing connection 0[LF]
129            ;; +* Closing connection 1[LF]
130            ;;  * Connection #3 to host server4.example.com left intact[LF]
131            (delete-file "tests/data/test1510")
133            ;; The top-level "make check" does "make -C tests quiet-test", which
134            ;; is too quiet.  Use the "test" target instead, which is more
135            ;; verbose.
136            (invoke "make" "-C" "tests" "test"))))))
137    (synopsis "Command line tool for transferring data with URL syntax")
138    (description
139     "curl is a command line tool for transferring data with URL syntax,
140 supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
141 LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.
142 curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
143 form based upload, proxies, cookies, file transfer resume, user+password
144 authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy
145 tunneling, and so on.")
146    (license (license:non-copyleft "file://COPYING"
147                                   "See COPYING in the distribution."))
148    (home-page "https://curl.haxx.se/")))
150 (define-public curl-7.65.0
151   (package
152     (inherit curl)
153     (version "7.65.0")
154     (source
155       (origin
156         (method url-fetch)
157         (uri (string-append "https://curl.haxx.se/download/curl-"
158                             version ".tar.xz"))
159         (sha256
160          (base32
161           "1kb6p510m0n0y1c8fjxbcs6dyaqgm8i54pjvj29zc14lj9ix4rkp"))))))
163 (define-public kurly
164   (package
165     (name "kurly")
166     (version "1.2.2")
167     (source (origin
168               (method git-fetch)
169               (uri (git-reference
170                      (url "https://gitlab.com/davidjpeacock/kurly.git")
171                      (commit (string-append "v" version))))
172               (file-name (git-file-name name version))
173               (sha256
174                (base32
175                 "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
176     (build-system go-build-system)
177     (arguments
178      `(#:import-path "gitlab.com/davidjpeacock/kurly"
179        #:install-source? #f
180        #:phases
181        (modify-phases %standard-phases
182          (add-after 'install 'install-documentation
183            (lambda* (#:key import-path outputs #:allow-other-keys)
184              (let* ((source (string-append "src/" import-path))
185                     (out (assoc-ref outputs "out"))
186                     (doc (string-append out "/share/doc/" ,name "-" ,version))
187                     (man (string-append out "/share/man/man1")))
188                (with-directory-excursion source
189                  (install-file "README.md" doc)
190                  (mkdir-p man)
191                  (copy-file "doc/kurly.man"
192                             (string-append man "/kurly.1")))
193                #t))))))
194     (inputs
195      `(("go-github-com-alsm-ioprogress" ,go-github-com-alsm-ioprogress)
196        ("go-github-com-aki237-nscjar" ,go-github-com-aki237-nscjar)
197        ("go-github-com-urfave-cli" ,go-github-com-urfave-cli)))
198     (synopsis "Command-line HTTP client")
199     (description "kurly is an alternative to the @code{curl} program written in
200 Go.  kurly is designed to operate in a similar manner to curl, with select
201 features.  Notably, kurly is not aiming for feature parity, but common flags and
202 mechanisms particularly within the HTTP(S) realm are to be expected.  kurly does
203 not offer a replacement for libcurl.")
204     (home-page "https://gitlab.com/davidjpeacock/kurly")
205     (license license:asl2.0)))
207 (define-public guile-curl
208   (package
209    (name "guile-curl")
210    (version "0.6")
211    (source (origin
212             (method url-fetch)
213             (uri (string-append "http://www.lonelycactus.com/tarball/"
214                                 "guile_curl-" version ".tar.gz"))
215             (sha256
216              (base32
217               "1pxdhnk288ky6gkpad8i60m0p6404rdvls43lr1b5d3csrklyc70"))))
218    (build-system gnu-build-system)
219    (arguments
220     `(#:configure-flags (list (string-append
221                                "--with-guilesitedir="
222                                (assoc-ref %outputs "out")
223                                "/share/guile/site/2.2")
224                               (string-append
225                                "-with-guileextensiondir="
226                                (assoc-ref %outputs "out")
227                                "/lib/guile/2.2/extensions"))
228       #:phases
229       (modify-phases %standard-phases
230         (add-after 'install 'patch-extension-path
231           (lambda* (#:key outputs #:allow-other-keys)
232              (let* ((out      (assoc-ref outputs "out"))
233                     (curl.scm (string-append
234                                out "/share/guile/site/2.2/curl.scm"))
235                     (curl.go  (string-append
236                                out "/lib/guile/2.2/site-ccache/curl.go"))
237                     (ext      (string-append out "/lib/guile/2.2/"
238                                              "extensions/libguile-curl")))
239                (substitute* curl.scm (("libguile-curl") ext))
240                ;; The build system does not actually compile the Scheme module.
241                ;; So we can compile it and put it in the right place in one go.
242                (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
243    (native-inputs `(("pkg-config" ,pkg-config)))
244    (inputs
245     `(("curl" ,curl)
246       ("guile" ,guile-2.2)))
247    (home-page "http://www.lonelycactus.com/guile-curl.html")
248    (synopsis "Curl bindings for Guile")
249    (description "@code{guile-curl} is a project that has procedures that allow
250 Guile to do client-side URL transfers, like requesting documents from HTTP or
251 FTP servers.  It is based on the curl library.")
252    (license license:gpl3+)))