Merge branch 'staging' 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 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 groff)
41 #:use-module (gnu packages guile)
42 #:use-module (gnu packages kerberos)
43 #:use-module (gnu packages libidn)
44 #:use-module (gnu packages openldap)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages tls)
49 #:use-module (gnu packages web))
50
51 (define-public curl
52 (package
53 (name "curl")
54 (version "7.68.0")
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 "0nh3j90w6b97wqcgxjfq55qhkz9s38955fbhwzv2fsi7483j895p"))
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 ;; to enable the --manual option and make test 1026 pass
75 ("groff" ,groff)
76 ("pkg-config" ,pkg-config)
77 ("python" ,python-wrapper)))
78 (native-search-paths
79 ;; These variables are introduced by libcurl-use-ssl-cert-env.patch.
80 (list (search-path-specification
81 (variable "SSL_CERT_DIR")
82 (separator #f) ;single entry
83 (files '("etc/ssl/certs")))
84 (search-path-specification
85 (variable "SSL_CERT_FILE")
86 (file-type 'regular)
87 (separator #f) ;single entry
88 (files '("etc/ssl/certs/ca-certificates.crt")))
89 ;; Note: This search path is respected by the `curl` command-line
90 ;; tool only. Patching libcurl to read it too would bring no
91 ;; advantages and require maintaining a more complex patch.
92 (search-path-specification
93 (variable "CURL_CA_BUNDLE")
94 (file-type 'regular)
95 (separator #f) ;single entry
96 (files '("etc/ssl/certs/ca-certificates.crt")))))
97 (arguments
98 `(#:configure-flags (list "--with-gnutls"
99 (string-append "--with-gssapi="
100 (assoc-ref %build-inputs "mit-krb5"))
101 "--disable-static")
102 ;; Add a phase to patch '/bin/sh' occurances in tests/runtests.pl
103 #:phases
104 (modify-phases %standard-phases
105 (add-after
106 'install 'move-man3-pages
107 (lambda* (#:key outputs #:allow-other-keys)
108 ;; Move section 3 man pages to "doc".
109 (let ((out (assoc-ref outputs "out"))
110 (doc (assoc-ref outputs "doc")))
111 (mkdir-p (string-append doc "/share/man"))
112 (rename-file (string-append out "/share/man/man3")
113 (string-append doc "/share/man/man3"))
114 #t)))
115 (replace
116 'check
117 (lambda _
118 (substitute* "tests/runtests.pl"
119 (("/bin/sh") (which "sh")))
120
121 ;; XXX FIXME: Test #1510 seems to work on some machines and not
122 ;; others, possibly based on the kernel version. It works on Guix System
123 ;; on x86_64 with linux-libre-4.1, but fails on Hydra for both i686
124 ;; and x86_64 with the following error:
125 ;;
126 ;; test 1510...[HTTP GET connection cache limit (CURLOPT_MAXCONNECTS)]
127 ;;
128 ;; 1510: output (log/stderr1510) FAILED:
129 ;; --- log/check-expected 2015-06-27 07:45:53.166720834 +0000
130 ;; +++ log/check-generated 2015-06-27 07:45:53.166720834 +0000
131 ;; @@ -1,5 +1,5 @@
132 ;; * Connection #0 to host server1.example.com left intact[LF]
133 ;; * Connection #1 to host server2.example.com left intact[LF]
134 ;; * Connection #2 to host server3.example.com left intact[LF]
135 ;; -* Closing connection 0[LF]
136 ;; +* Closing connection 1[LF]
137 ;; * Connection #3 to host server4.example.com left intact[LF]
138 (delete-file "tests/data/test1510")
139
140 ;; The top-level "make check" does "make -C tests quiet-test", which
141 ;; is too quiet. Use the "test" target instead, which is more
142 ;; verbose.
143 (invoke "make" "-C" "tests" "test"))))))
144 (synopsis "Command line tool for transferring data with URL syntax")
145 (description
146 "curl is a command line tool for transferring data with URL syntax,
147 supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
148 LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.
149 curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
150 form based upload, proxies, cookies, file transfer resume, user+password
151 authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy
152 tunneling, and so on.")
153 (license (license:non-copyleft "file://COPYING"
154 "See COPYING in the distribution."))
155 (home-page "https://curl.haxx.se/")))
156
157 (define-public kurly
158 (package
159 (name "kurly")
160 (version "1.2.2")
161 (source (origin
162 (method git-fetch)
163 (uri (git-reference
164 (url "https://gitlab.com/davidjpeacock/kurly.git")
165 (commit (string-append "v" version))))
166 (file-name (git-file-name name version))
167 (sha256
168 (base32
169 "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
170 (build-system go-build-system)
171 (arguments
172 `(#:import-path "gitlab.com/davidjpeacock/kurly"
173 #:install-source? #f
174 #:phases
175 (modify-phases %standard-phases
176 (add-after 'install 'install-documentation
177 (lambda* (#:key import-path outputs #:allow-other-keys)
178 (let* ((source (string-append "src/" import-path))
179 (out (assoc-ref outputs "out"))
180 (doc (string-append out "/share/doc/" ,name "-" ,version))
181 (man (string-append out "/share/man/man1")))
182 (with-directory-excursion source
183 (install-file "README.md" doc)
184 (mkdir-p man)
185 (copy-file "doc/kurly.man"
186 (string-append man "/kurly.1")))
187 #t))))))
188 (inputs
189 `(("go-github-com-alsm-ioprogress" ,go-github-com-alsm-ioprogress)
190 ("go-github-com-aki237-nscjar" ,go-github-com-aki237-nscjar)
191 ("go-github-com-urfave-cli" ,go-github-com-urfave-cli)))
192 (synopsis "Command-line HTTP client")
193 (description "kurly is an alternative to the @code{curl} program written in
194 Go. kurly is designed to operate in a similar manner to curl, with select
195 features. Notably, kurly is not aiming for feature parity, but common flags and
196 mechanisms particularly within the HTTP(S) realm are to be expected. kurly does
197 not offer a replacement for libcurl.")
198 (home-page "https://gitlab.com/davidjpeacock/kurly")
199 (license license:asl2.0)))
200
201 (define-public guile-curl
202 (package
203 (name "guile-curl")
204 (version "0.6")
205 (source (origin
206 (method url-fetch)
207 (uri (string-append "http://www.lonelycactus.com/tarball/"
208 "guile_curl-" version ".tar.gz"))
209 (sha256
210 (base32
211 "1pxdhnk288ky6gkpad8i60m0p6404rdvls43lr1b5d3csrklyc70"))))
212 (build-system gnu-build-system)
213 (arguments
214 `(#:configure-flags (list (string-append
215 "--with-guilesitedir="
216 (assoc-ref %outputs "out")
217 "/share/guile/site/2.2")
218 (string-append
219 "-with-guileextensiondir="
220 (assoc-ref %outputs "out")
221 "/lib/guile/2.2/extensions"))
222 #:phases
223 (modify-phases %standard-phases
224 (add-after 'install 'patch-extension-path
225 (lambda* (#:key outputs #:allow-other-keys)
226 (let* ((out (assoc-ref outputs "out"))
227 (curl.scm (string-append
228 out "/share/guile/site/2.2/curl.scm"))
229 (curl.go (string-append
230 out "/lib/guile/2.2/site-ccache/curl.go"))
231 (ext (string-append out "/lib/guile/2.2/"
232 "extensions/libguile-curl")))
233 (substitute* curl.scm (("libguile-curl") ext))
234 ;; The build system does not actually compile the Scheme module.
235 ;; So we can compile it and put it in the right place in one go.
236 (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
237 (native-inputs `(("pkg-config" ,pkg-config)))
238 (inputs
239 `(("curl" ,curl)
240 ("guile" ,guile-2.2)))
241 (home-page "http://www.lonelycactus.com/guile-curl.html")
242 (synopsis "Curl bindings for Guile")
243 (description "@code{guile-curl} is a project that has procedures that allow
244 Guile to do client-side URL transfers, like requesting documents from HTTP or
245 FTP servers. It is based on the curl library.")
246 (license license:gpl3+)))