gnu: gf2x: Update to 1.3.0.
[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, 2020, 2021, 2022 Ludovic Courtès <ludo@gnu.org>
6 ;;; Copyright © 2016, 2017, 2019 Leo Famulari <leo@famulari.name>
7 ;;; Copyright © 2017, 2019, 2020, 2022 Marius Bakke <marius@gnu.org>
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, 2021 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
13 ;;; Copyright © 2020 Dale Mellor <guix-devel-0brg6b@rdmp.org>
14 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
15 ;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
16 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
17 ;;;
18 ;;; This file is part of GNU Guix.
19 ;;;
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
24 ;;;
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
29 ;;;
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33 (define-module (gnu packages curl)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages)
36 #:use-module (guix gexp)
37 #:use-module (guix download)
38 #:use-module (guix git-download)
39 #:use-module (guix utils)
40 #:use-module (guix build-system cmake)
41 #:use-module (guix build-system copy)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system go)
44 #:use-module (guix build-system meson)
45 #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
46 #:use-module (gnu packages)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages golang)
50 #:use-module (gnu packages guile)
51 #:use-module (gnu packages kerberos)
52 #:use-module (gnu packages logging)
53 #:use-module (gnu packages libevent)
54 #:use-module (gnu packages libidn)
55 #:use-module (gnu packages perl)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages ssh)
59 #:use-module (gnu packages tls)
60 #:use-module (gnu packages web)
61 #:use-module (srfi srfi-1))
62
63 (define-public curl
64 (package
65 (name "curl")
66 (version "7.79.1")
67 (replacement curl-7.84.0)
68 (source (origin
69 (method url-fetch)
70 (uri (string-append "https://curl.se/download/curl-"
71 version ".tar.xz"))
72 (sha256
73 (base32
74 "129n9hi7rbg3s112chyadhp4y27ppb5i65n12wm77aw2255zf1h6"))
75 (patches (search-patches "curl-use-ssl-cert-env.patch"))))
76 (build-system gnu-build-system)
77 (outputs '("out"
78 "doc")) ;1.2 MiB of man3 pages
79 (inputs (list gnutls libidn mit-krb5
80 `(,nghttp2 "lib") zlib))
81 (native-inputs
82 `(("nghttp2" ,nghttp2)
83 ("perl" ,perl)
84 ("pkg-config" ,pkg-config)
85 ("python" ,python-minimal-wrapper)))
86 (native-search-paths
87 ;; These variables are introduced by curl-use-ssl-cert-env.patch.
88 (list $SSL_CERT_DIR
89 $SSL_CERT_FILE
90 ;; Note: This search path is respected by the `curl` command-line
91 ;; tool only. Patching libcurl to read it too would bring no
92 ;; advantages and require maintaining a more complex patch.
93 (search-path-specification
94 (variable "CURL_CA_BUNDLE")
95 (file-type 'regular)
96 (separator #f) ;single entry
97 (files '("etc/ssl/certs/ca-certificates.crt")))))
98 (arguments
99 `(#:disallowed-references ("doc")
100 #:configure-flags (list "--with-gnutls"
101 (string-append "--with-gssapi="
102 (assoc-ref %build-inputs "mit-krb5"))
103 "--disable-static")
104 #:phases
105 (modify-phases %standard-phases
106 (add-after 'unpack 'do-not-record-configure-flags
107 (lambda _
108 ;; Do not save the configure options to avoid unnecessary references.
109 (substitute* "curl-config.in"
110 (("@CONFIGURE_OPTIONS@")
111 "\"not available\""))))
112 (add-after
113 'install 'move-man3-pages
114 (lambda* (#:key outputs #:allow-other-keys)
115 ;; Move section 3 man pages to "doc".
116 (let ((out (assoc-ref outputs "out"))
117 (doc (assoc-ref outputs "doc")))
118 (mkdir-p (string-append doc "/share/man"))
119 (rename-file (string-append out "/share/man/man3")
120 (string-append doc "/share/man/man3")))))
121 (replace 'check
122 (lambda* (#:key tests? #:allow-other-keys)
123 (substitute* "tests/runtests.pl"
124 (("/bin/sh") (which "sh")))
125
126 (when tests?
127 ;; The top-level "make check" does "make -C tests quiet-test", which
128 ;; is too quiet. Use the "test" target instead, which is more
129 ;; verbose.
130 (invoke "make" "-C" "tests" "test")))))))
131 (synopsis "Command line tool for transferring data with URL syntax")
132 (description
133 "curl is a command line tool for transferring data with URL syntax,
134 supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
135 LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.
136 curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
137 form based upload, proxies, cookies, file transfer resume, user+password
138 authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy
139 tunneling, and so on.")
140 (license (license:non-copyleft "file://COPYING"
141 "See COPYING in the distribution."))
142 (home-page "https://curl.haxx.se/")))
143
144 ;; Replacement package with fixes for multiple vulnerabilities.
145 ;; See <https://curl.se/docs/security.html>.
146 (define curl-7.84.0
147 (package
148 (inherit curl)
149 (version "7.84.0")
150 (source (origin
151 (inherit (package-source curl))
152 (uri (string-append "https://curl.se/download/curl-"
153 version ".tar.xz"))
154 (sha256
155 (base32
156 "1f2xgj0wvys9xw50h7vcbaraavjr9rxx9n06x2xfbgs7ym1qn49d"))
157 (patches (append (origin-patches (package-source curl))
158 (search-patches "curl-easy-lock.patch")))))
159 (arguments (substitute-keyword-arguments (package-arguments curl)
160 ((#:phases phases)
161 (cond
162 ((not (target-64bit?))
163 #~(modify-phases #$phases
164 (add-after 'unpack 'tweak-lib3026-test
165 (lambda _
166 ;; Have that test create a hundred threads, not a
167 ;; thousand.
168 (substitute* "tests/libtest/lib3026.c"
169 (("NUM_THREADS .*$")
170 "NUM_THREADS 100\n"))))))
171 (else phases)))))))
172
173 (define-public curl-minimal
174 (deprecated-package "curl-minimal" curl))
175
176 (define-public curl-ssh
177 (package/inherit curl
178 (arguments
179 (substitute-keyword-arguments (package-arguments curl)
180 ((#:configure-flags flags)
181 `(cons "--with-libssh2" ,flags))))
182 (inputs
183 `(("libssh2" ,libssh2)
184 ,@(package-inputs curl)))
185 (properties `((hidden? . #t)))))
186
187 (define-public kurly
188 (package
189 (name "kurly")
190 (version "1.2.2")
191 (source (origin
192 (method git-fetch)
193 (uri (git-reference
194 (url "https://gitlab.com/davidjpeacock/kurly.git")
195 (commit (string-append "v" version))))
196 (file-name (git-file-name name version))
197 (sha256
198 (base32
199 "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
200 (build-system go-build-system)
201 (arguments
202 `(#:import-path "gitlab.com/davidjpeacock/kurly"
203 #:install-source? #f
204 #:phases
205 (modify-phases %standard-phases
206 (add-after 'install 'install-documentation
207 (lambda* (#:key import-path outputs #:allow-other-keys)
208 (let* ((source (string-append "src/" import-path))
209 (out (assoc-ref outputs "out"))
210 (doc (string-append out "/share/doc/" ,name "-" ,version))
211 (man (string-append out "/share/man/man1")))
212 (with-directory-excursion source
213 (install-file "README.md" doc)
214 (mkdir-p man)
215 (copy-file "doc/kurly.man"
216 (string-append man "/kurly.1")))
217 #t))))))
218 (inputs
219 (list go-github-com-alsm-ioprogress go-github-com-aki237-nscjar
220 go-github-com-urfave-cli))
221 (synopsis "Command-line HTTP client")
222 (description "kurly is an alternative to the @code{curl} program written in
223 Go. kurly is designed to operate in a similar manner to curl, with select
224 features. Notably, kurly is not aiming for feature parity, but common flags and
225 mechanisms particularly within the HTTP(S) realm are to be expected. kurly does
226 not offer a replacement for libcurl.")
227 (home-page "https://gitlab.com/davidjpeacock/kurly")
228 (license license:asl2.0)))
229
230 (define-public guile-curl
231 (package
232 (name "guile-curl")
233 (version "0.9")
234 (source (origin
235 (method url-fetch)
236 (uri (string-append "http://www.lonelycactus.com/tarball/"
237 "guile_curl-" version ".tar.gz"))
238 (sha256
239 (base32
240 "0y7wfhilfm6vzs0wyifrrc2pj9nsxfas905c7qa5cw4i6s74ypmi"))))
241 (build-system gnu-build-system)
242 (arguments
243 `(#:modules (((guix build guile-build-system)
244 #:select (target-guile-effective-version))
245 ,@%gnu-build-system-modules)
246 #:imported-modules ((guix build guile-build-system)
247 ,@%gnu-build-system-modules)
248 #:configure-flags (list (string-append
249 "--with-guilesitedir="
250 (assoc-ref %outputs "out")
251 "/share/guile/site/"
252 (target-guile-effective-version
253 (assoc-ref %build-inputs "guile")))
254 (string-append
255 "-with-guileextensiondir="
256 (assoc-ref %outputs "out")
257 "/lib/guile/"
258 (target-guile-effective-version
259 (assoc-ref %build-inputs "guile"))
260 "/extensions"))
261 #:phases
262 (modify-phases %standard-phases
263 (add-after 'unpack 'patch-undefined-references
264 (lambda* _
265 (substitute* "module/curl.scm"
266 ;; The following #defines are missing from our curl package
267 ;; and therefore result in the evaluation of undefined symbols.
268 ((",CURLOPT_HAPROXYPROTOCOL") "#f")
269 ((",CURLOPT_DISALLOW_USERNAME_IN_URL") "#f")
270 ((",CURLOPT_TIMEVALUE_LARGE") "#f")
271 ((",CURLOPT_DNS_SHUFFLE_ADDRESSES") "#f")
272 ((",CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS") "#f"))))
273 (add-after 'install 'patch-extension-path
274 (lambda* (#:key outputs #:allow-other-keys)
275 (let* ((out (assoc-ref outputs "out"))
276 (curl.scm (string-append
277 out "/share/guile/site/"
278 (target-guile-effective-version)
279 "/curl.scm"))
280 (curl.go (string-append
281 out "/lib/guile/"
282 (target-guile-effective-version)
283 "/site-ccache/curl.go"))
284 (ext (string-append out "/lib/guile/"
285 (target-guile-effective-version)
286 "/extensions/libguile-curl")))
287 (substitute* curl.scm (("libguile-curl") ext))
288 ;; The build system does not actually compile the Scheme module.
289 ;; So we can compile it and put it in the right place in one go.
290 (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
291 (native-inputs (list pkg-config))
292 (inputs
293 (list curl guile-3.0))
294 (home-page "http://www.lonelycactus.com/guile-curl.html")
295 (synopsis "Curl bindings for Guile")
296 (description "@code{guile-curl} is a project that has procedures that allow
297 Guile to do client-side URL transfers, like requesting documents from HTTP or
298 FTP servers. It is based on the curl library.")
299 (license license:gpl3+)))
300
301 (define-public guile2.2-curl
302 (package
303 (inherit guile-curl)
304 (name "guile2.2-curl")
305 (inputs
306 (list curl guile-2.2))))
307
308 (define-public curlpp
309 (package
310 (name "curlpp")
311 (version "0.8.1")
312 (source
313 (origin
314 (method git-fetch)
315 (uri (git-reference
316 (url "https://github.com/jpbarrette/curlpp")
317 (commit (string-append "v" version))))
318 (sha256
319 (base32 "1b0ylnnrhdax4kwjq64r1fk0i24n5ss6zfzf4hxwgslny01xiwrk"))
320 (file-name (git-file-name name version))))
321 (build-system cmake-build-system)
322 ;; There are no build tests to be had.
323 (arguments
324 '(#:tests? #f))
325 ;; The installed version needs the header files from the C library.
326 (propagated-inputs
327 (list curl))
328 (synopsis "C++ wrapper around libcURL")
329 (description
330 "This package provides a free and easy-to-use client-side C++ URL
331 transfer library, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT,
332 FILE and LDAP; in particular it supports HTTPS certificates, HTTP POST, HTTP
333 PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies,
334 user+password authentication, file transfer resume, http proxy tunneling and
335 more!")
336 (home-page "http://www.curlpp.org")
337 (license license:expat)))
338
339 (define-public h2c
340 (package
341 (name "h2c")
342 (version "1.0")
343 (source
344 (origin
345 (method git-fetch)
346 (uri (git-reference
347 (url "https://github.com/curl/h2c")
348 (commit version)))
349 (sha256
350 (base32
351 "1n8z6avzhg3yb330di2y9zymsps1qp1235p29kidcp4fkmn7fgb2"))
352 (file-name (git-file-name name version))))
353 (build-system copy-build-system)
354 (arguments
355 '(#:install-plan
356 '(("./h2c" "bin/"))))
357 (inputs
358 (list perl))
359 (home-page "https://curl.se/h2c/")
360 (synopsis "Convert HTTP headers to a curl command line")
361 (description
362 "Provided a set of HTTP request headers, h2c outputs how to invoke
363 curl to obtain exactly that HTTP request.")
364 (license license:expat)))
365
366 (define-public coeurl
367 (package
368 (name "coeurl")
369 (version "0.2.0")
370 (source
371 (origin
372 (method git-fetch)
373 (uri (git-reference
374 (url "https://nheko.im/nheko-reborn/coeurl")
375 (commit (string-append "v" version))))
376 (file-name (git-file-name name version))
377 (sha256
378 (base32
379 "0kbazvrb4hzc9jr7yywd36ack1yy7bh8sh1kc4jzv6jfzvxjb0i0"))))
380 (build-system meson-build-system)
381 (native-inputs
382 (list doctest pkg-config))
383 (inputs
384 (list curl libevent spdlog))
385 (home-page "https://nheko.im/nheko-reborn/coeurl")
386 (synopsis "Simple async wrapper around CURL for C++")
387 (description "Coeurl is a simple library to do HTTP requests
388 asynchronously via cURL in C++.")
389 (license license:expat)))
390
391 (define-public curlie
392 (package
393 (name "curlie")
394 (version "1.6.9")
395 (source
396 (origin
397 (method git-fetch)
398 (uri (git-reference
399 (url "https://github.com/rs/curlie")
400 (commit (string-append "v" version))))
401 (file-name (git-file-name name version))
402 (sha256
403 (base32
404 "1b94wfliivfq06i5sf664nhmp3v1k0lpz33cv9lyk6s59awb2hnw"))))
405 (build-system go-build-system)
406 (arguments
407 `(#:import-path "github.com/rs/curlie"))
408 (inputs
409 (list curl go-golang-org-x-crypto go-golang-org-x-sys))
410 (home-page "https://curlie.io")
411 (synopsis "The power of curl, the ease of use of httpie")
412 (description "If you like the interface of HTTPie but miss the features of
413 curl, curlie is what you are searching for. Curlie is a frontend to
414 @code{curl} that adds the ease of use of @code{httpie}, without compromising
415 on features and performance. All @code{curl} options are exposed with syntax
416 sugar and output formatting inspired from @code{httpie}.")
417 (license license:expat)))