Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / curl.scm
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, 2019, 2020 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 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages curl)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix utils)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system go)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages golang)
40 #:use-module (gnu packages guile)
41 #:use-module (gnu packages kerberos)
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 tls)
48 #:use-module (gnu packages web)
49 #:use-module (srfi srfi-1))
50
51 (define-public curl
52 (package
53 (name "curl")
54 (version "7.69.1")
55 (source (origin
56 (method url-fetch)
57 (uri (string-append "https://curl.haxx.se/download/curl-"
58 version ".tar.xz"))
59 (sha256
60 (base32
61 "0kwxh76iq9fblk7iyv4f75bmcmasarp2bcm1mm07wyvzd7kdbiq3"))
62 (patches (search-patches "curl-use-ssl-cert-env.patch"))))
63 (build-system gnu-build-system)
64 (outputs '("out"
65 "doc")) ;1.2 MiB of man3 pages
66 (inputs `(("gnutls" ,gnutls)
67 ("libidn" ,libidn)
68 ("openldap" ,openldap)
69 ("mit-krb5" ,mit-krb5)
70 ("nghttp2" ,nghttp2 "lib")
71 ("zlib" ,zlib)))
72 (native-inputs
73 `(("perl" ,perl)
74 ("pkg-config" ,pkg-config)
75 ("python" ,python-wrapper)))
76 (native-search-paths
77 ;; These variables are introduced by curl-use-ssl-cert-env.patch.
78 (list (search-path-specification
79 (variable "SSL_CERT_DIR")
80 (separator #f) ;single entry
81 (files '("etc/ssl/certs")))
82 (search-path-specification
83 (variable "SSL_CERT_FILE")
84 (file-type 'regular)
85 (separator #f) ;single entry
86 (files '("etc/ssl/certs/ca-certificates.crt")))
87 ;; Note: This search path is respected by the `curl` command-line
88 ;; tool only. Patching libcurl to read it too would bring no
89 ;; advantages and require maintaining a more complex patch.
90 (search-path-specification
91 (variable "CURL_CA_BUNDLE")
92 (file-type 'regular)
93 (separator #f) ;single entry
94 (files '("etc/ssl/certs/ca-certificates.crt")))))
95 (arguments
96 `(#:disallowed-references ("doc")
97 #:configure-flags (list "--with-gnutls"
98 (string-append "--with-gssapi="
99 (assoc-ref %build-inputs "mit-krb5"))
100 "--disable-static")
101 #:phases
102 (modify-phases %standard-phases
103 (add-after 'unpack 'do-not-record-configure-flags
104 (lambda _
105 ;; Do not save the configure options to avoid unnecessary references.
106 (substitute* "curl-config.in"
107 (("@CONFIGURE_OPTIONS@")
108 "\"not available\""))
109 #t))
110 (add-after
111 'install 'move-man3-pages
112 (lambda* (#:key outputs #:allow-other-keys)
113 ;; Move section 3 man pages to "doc".
114 (let ((out (assoc-ref outputs "out"))
115 (doc (assoc-ref outputs "doc")))
116 (mkdir-p (string-append doc "/share/man"))
117 (rename-file (string-append out "/share/man/man3")
118 (string-append doc "/share/man/man3"))
119 #t)))
120 (replace
121 'check
122 (lambda _
123 (substitute* "tests/runtests.pl"
124 (("/bin/sh") (which "sh")))
125
126 ;; XXX FIXME: Test #1510 seems to work on some machines and not
127 ;; others, possibly based on the kernel version. It works on Guix System
128 ;; on x86_64 with linux-libre-4.1, but fails on Hydra for both i686
129 ;; and x86_64 with the following error:
130 ;;
131 ;; test 1510...[HTTP GET connection cache limit (CURLOPT_MAXCONNECTS)]
132 ;;
133 ;; 1510: output (log/stderr1510) FAILED:
134 ;; --- log/check-expected 2015-06-27 07:45:53.166720834 +0000
135 ;; +++ log/check-generated 2015-06-27 07:45:53.166720834 +0000
136 ;; @@ -1,5 +1,5 @@
137 ;; * Connection #0 to host server1.example.com left intact[LF]
138 ;; * Connection #1 to host server2.example.com left intact[LF]
139 ;; * Connection #2 to host server3.example.com left intact[LF]
140 ;; -* Closing connection 0[LF]
141 ;; +* Closing connection 1[LF]
142 ;; * Connection #3 to host server4.example.com left intact[LF]
143 (delete-file "tests/data/test1510")
144
145 ;; The top-level "make check" does "make -C tests quiet-test", which
146 ;; is too quiet. Use the "test" target instead, which is more
147 ;; verbose.
148 (invoke "make" "-C" "tests" "test"))))))
149 (synopsis "Command line tool for transferring data with URL syntax")
150 (description
151 "curl is a command line tool for transferring data with URL syntax,
152 supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
153 LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.
154 curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
155 form based upload, proxies, cookies, file transfer resume, user+password
156 authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy
157 tunneling, and so on.")
158 (license (license:non-copyleft "file://COPYING"
159 "See COPYING in the distribution."))
160 (home-page "https://curl.haxx.se/")))
161
162 ;; This package exists mainly to bootstrap CMake. It must not depend on
163 ;; anything that uses cmake-build-system.
164 (define-public curl-minimal
165 (hidden-package
166 (package/inherit
167 curl
168 (name "curl-minimal")
169 (inputs (alist-delete "openldap" (package-inputs curl))))))
170
171 (define-public kurly
172 (package
173 (name "kurly")
174 (version "1.2.2")
175 (source (origin
176 (method git-fetch)
177 (uri (git-reference
178 (url "https://gitlab.com/davidjpeacock/kurly.git")
179 (commit (string-append "v" version))))
180 (file-name (git-file-name name version))
181 (sha256
182 (base32
183 "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
184 (build-system go-build-system)
185 (arguments
186 `(#:import-path "gitlab.com/davidjpeacock/kurly"
187 #:install-source? #f
188 #:phases
189 (modify-phases %standard-phases
190 (add-after 'install 'install-documentation
191 (lambda* (#:key import-path outputs #:allow-other-keys)
192 (let* ((source (string-append "src/" import-path))
193 (out (assoc-ref outputs "out"))
194 (doc (string-append out "/share/doc/" ,name "-" ,version))
195 (man (string-append out "/share/man/man1")))
196 (with-directory-excursion source
197 (install-file "README.md" doc)
198 (mkdir-p man)
199 (copy-file "doc/kurly.man"
200 (string-append man "/kurly.1")))
201 #t))))))
202 (inputs
203 `(("go-github-com-alsm-ioprogress" ,go-github-com-alsm-ioprogress)
204 ("go-github-com-aki237-nscjar" ,go-github-com-aki237-nscjar)
205 ("go-github-com-urfave-cli" ,go-github-com-urfave-cli)))
206 (synopsis "Command-line HTTP client")
207 (description "kurly is an alternative to the @code{curl} program written in
208 Go. kurly is designed to operate in a similar manner to curl, with select
209 features. Notably, kurly is not aiming for feature parity, but common flags and
210 mechanisms particularly within the HTTP(S) realm are to be expected. kurly does
211 not offer a replacement for libcurl.")
212 (home-page "https://gitlab.com/davidjpeacock/kurly")
213 (license license:asl2.0)))
214
215 (define-public guile-curl
216 (package
217 (name "guile-curl")
218 (version "0.6")
219 (source (origin
220 (method url-fetch)
221 (uri (string-append "http://www.lonelycactus.com/tarball/"
222 "guile_curl-" version ".tar.gz"))
223 (sha256
224 (base32
225 "1pxdhnk288ky6gkpad8i60m0p6404rdvls43lr1b5d3csrklyc70"))))
226 (build-system gnu-build-system)
227 (arguments
228 `(#:configure-flags (list (string-append
229 "--with-guilesitedir="
230 (assoc-ref %outputs "out")
231 "/share/guile/site/2.2")
232 (string-append
233 "-with-guileextensiondir="
234 (assoc-ref %outputs "out")
235 "/lib/guile/2.2/extensions"))
236 #:phases
237 (modify-phases %standard-phases
238 (add-after 'install 'patch-extension-path
239 (lambda* (#:key outputs #:allow-other-keys)
240 (let* ((out (assoc-ref outputs "out"))
241 (curl.scm (string-append
242 out "/share/guile/site/2.2/curl.scm"))
243 (curl.go (string-append
244 out "/lib/guile/2.2/site-ccache/curl.go"))
245 (ext (string-append out "/lib/guile/2.2/"
246 "extensions/libguile-curl")))
247 (substitute* curl.scm (("libguile-curl") ext))
248 ;; The build system does not actually compile the Scheme module.
249 ;; So we can compile it and put it in the right place in one go.
250 (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
251 (native-inputs `(("pkg-config" ,pkg-config)))
252 (inputs
253 `(("curl" ,curl)
254 ("guile" ,guile-2.2)))
255 (home-page "http://www.lonelycactus.com/guile-curl.html")
256 (synopsis "Curl bindings for Guile")
257 (description "@code{guile-curl} is a project that has procedures that allow
258 Guile to do client-side URL transfers, like requesting documents from HTTP or
259 FTP servers. It is based on the curl library.")
260 (license license:gpl3+)))