gnu: emacs-consult: Fix grammar.
[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 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, 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 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30 (define-module (gnu packages curl)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix utils)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system go)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages golang)
42 #:use-module (gnu packages guile)
43 #:use-module (gnu packages kerberos)
44 #:use-module (gnu packages libidn)
45 #:use-module (gnu packages openldap)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages tls)
50 #:use-module (gnu packages web)
51 #:use-module (srfi srfi-1))
52
53 (define-public curl
54 (package
55 (name "curl")
56 (version "7.74.0")
57 (source (origin
58 (method url-fetch)
59 (uri (string-append "https://curl.haxx.se/download/curl-"
60 version ".tar.xz"))
61 (sha256
62 (base32
63 "12w7gskrglg6qrmp822j37fmbr0icrcxv7rib1fy5xiw80n5z7cr"))
64 (patches (search-patches "curl-use-ssl-cert-env.patch"))))
65 (replacement curl/fixed)
66 (build-system gnu-build-system)
67 (outputs '("out"
68 "doc")) ;1.2 MiB of man3 pages
69 (inputs `(("gnutls" ,gnutls)
70 ("libidn" ,libidn)
71 ("openldap" ,openldap)
72 ("mit-krb5" ,mit-krb5)
73 ("nghttp2" ,nghttp2 "lib")
74 ("zlib" ,zlib)))
75 (native-inputs
76 `(("perl" ,perl)
77 ("pkg-config" ,pkg-config)
78 ("python" ,python-wrapper)))
79 (native-search-paths
80 ;; These variables are introduced by curl-use-ssl-cert-env.patch.
81 (list (search-path-specification
82 (variable "SSL_CERT_DIR")
83 (separator #f) ;single entry
84 (files '("etc/ssl/certs")))
85 (search-path-specification
86 (variable "SSL_CERT_FILE")
87 (file-type 'regular)
88 (separator #f) ;single entry
89 (files '("etc/ssl/certs/ca-certificates.crt")))
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 #t))
113 (add-after
114 'install 'move-man3-pages
115 (lambda* (#:key outputs #:allow-other-keys)
116 ;; Move section 3 man pages to "doc".
117 (let ((out (assoc-ref outputs "out"))
118 (doc (assoc-ref outputs "doc")))
119 (mkdir-p (string-append doc "/share/man"))
120 (rename-file (string-append out "/share/man/man3")
121 (string-append doc "/share/man/man3"))
122 #t)))
123 (replace
124 'check
125 (lambda _
126 (substitute* "tests/runtests.pl"
127 (("/bin/sh") (which "sh")))
128
129 ;; The top-level "make check" does "make -C tests quiet-test", which
130 ;; is too quiet. Use the "test" target instead, which is more
131 ;; verbose.
132 (invoke "make" "-C" "tests" "test"))))))
133 (synopsis "Command line tool for transferring data with URL syntax")
134 (description
135 "curl is a command line tool for transferring data with URL syntax,
136 supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
137 LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.
138 curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
139 form based upload, proxies, cookies, file transfer resume, user+password
140 authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy
141 tunneling, and so on.")
142 (license (license:non-copyleft "file://COPYING"
143 "See COPYING in the distribution."))
144 (home-page "https://curl.haxx.se/")))
145
146 ;; This package exists mainly to bootstrap CMake. It must not depend on
147 ;; anything that uses cmake-build-system.
148 (define-public curl-minimal
149 (hidden-package
150 (package/inherit
151 curl
152 (name "curl-minimal")
153 (inputs (alist-delete "openldap" (package-inputs curl))))))
154
155 (define-public curl/fixed
156 (package
157 (inherit curl)
158 (version "7.76.0")
159 (source
160 (origin
161 (inherit (package-source curl))
162 (uri (string-append "https://curl.haxx.se/download/curl-"
163 version ".tar.xz"))
164 (patches (search-patches "curl-7.76-use-ssl-cert-env.patch"))
165 (sha256
166 (base32
167 "1j2g04m6als6hmqzvddv84c31m0x90bfgyz3bjrwdkarbkby40k3"))))))
168
169 (define-public kurly
170 (package
171 (name "kurly")
172 (version "1.2.2")
173 (source (origin
174 (method git-fetch)
175 (uri (git-reference
176 (url "https://gitlab.com/davidjpeacock/kurly.git")
177 (commit (string-append "v" version))))
178 (file-name (git-file-name name version))
179 (sha256
180 (base32
181 "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
182 (build-system go-build-system)
183 (arguments
184 `(#:import-path "gitlab.com/davidjpeacock/kurly"
185 #:install-source? #f
186 #:phases
187 (modify-phases %standard-phases
188 (add-after 'install 'install-documentation
189 (lambda* (#:key import-path outputs #:allow-other-keys)
190 (let* ((source (string-append "src/" import-path))
191 (out (assoc-ref outputs "out"))
192 (doc (string-append out "/share/doc/" ,name "-" ,version))
193 (man (string-append out "/share/man/man1")))
194 (with-directory-excursion source
195 (install-file "README.md" doc)
196 (mkdir-p man)
197 (copy-file "doc/kurly.man"
198 (string-append man "/kurly.1")))
199 #t))))))
200 (inputs
201 `(("go-github-com-alsm-ioprogress" ,go-github-com-alsm-ioprogress)
202 ("go-github-com-aki237-nscjar" ,go-github-com-aki237-nscjar)
203 ("go-github-com-urfave-cli" ,go-github-com-urfave-cli)))
204 (synopsis "Command-line HTTP client")
205 (description "kurly is an alternative to the @code{curl} program written in
206 Go. kurly is designed to operate in a similar manner to curl, with select
207 features. Notably, kurly is not aiming for feature parity, but common flags and
208 mechanisms particularly within the HTTP(S) realm are to be expected. kurly does
209 not offer a replacement for libcurl.")
210 (home-page "https://gitlab.com/davidjpeacock/kurly")
211 (license license:asl2.0)))
212
213 (define-public guile-curl
214 (package
215 (name "guile-curl")
216 (version "0.9")
217 (source (origin
218 (method url-fetch)
219 (uri (string-append "http://www.lonelycactus.com/tarball/"
220 "guile_curl-" version ".tar.gz"))
221 (sha256
222 (base32
223 "0y7wfhilfm6vzs0wyifrrc2pj9nsxfas905c7qa5cw4i6s74ypmi"))))
224 (build-system gnu-build-system)
225 (arguments
226 `(#:modules (((guix build guile-build-system)
227 #:select (target-guile-effective-version))
228 ,@%gnu-build-system-modules)
229 #:imported-modules ((guix build guile-build-system)
230 ,@%gnu-build-system-modules)
231 #:configure-flags (list (string-append
232 "--with-guilesitedir="
233 (assoc-ref %outputs "out")
234 "/share/guile/site/"
235 (target-guile-effective-version
236 (assoc-ref %build-inputs "guile")))
237 (string-append
238 "-with-guileextensiondir="
239 (assoc-ref %outputs "out")
240 "/lib/guile/"
241 (target-guile-effective-version
242 (assoc-ref %build-inputs "guile"))
243 "/extensions"))
244 #:phases
245 (modify-phases %standard-phases
246 (add-after 'unpack 'patch-undefined-references
247 (lambda* _
248 (substitute* "module/curl.scm"
249 ;; The following #defines are missing from our curl package
250 ;; and therefore result in the evaluation of undefined symbols.
251 ((",CURLOPT_HAPROXYPROTOCOL") "#f")
252 ((",CURLOPT_DISALLOW_USERNAME_IN_URL") "#f")
253 ((",CURLOPT_TIMEVALUE_LARGE") "#f")
254 ((",CURLOPT_DNS_SHUFFLE_ADDRESSES") "#f")
255 ((",CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS") "#f"))))
256 (add-after 'install 'patch-extension-path
257 (lambda* (#:key outputs #:allow-other-keys)
258 (let* ((out (assoc-ref outputs "out"))
259 (curl.scm (string-append
260 out "/share/guile/site/"
261 (target-guile-effective-version)
262 "/curl.scm"))
263 (curl.go (string-append
264 out "/lib/guile/"
265 (target-guile-effective-version)
266 "/site-ccache/curl.go"))
267 (ext (string-append out "/lib/guile/"
268 (target-guile-effective-version)
269 "/extensions/libguile-curl")))
270 (substitute* curl.scm (("libguile-curl") ext))
271 ;; The build system does not actually compile the Scheme module.
272 ;; So we can compile it and put it in the right place in one go.
273 (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
274 (native-inputs `(("pkg-config" ,pkg-config)))
275 (inputs
276 `(("curl" ,curl)
277 ("guile" ,guile-3.0)))
278 (home-page "http://www.lonelycactus.com/guile-curl.html")
279 (synopsis "Curl bindings for Guile")
280 (description "@code{guile-curl} is a project that has procedures that allow
281 Guile to do client-side URL transfers, like requesting documents from HTTP or
282 FTP servers. It is based on the curl library.")
283 (license license:gpl3+)))
284
285 (define-public guile2.2-curl
286 (package
287 (inherit guile-curl)
288 (name "guile2.2-curl")
289 (inputs
290 `(("curl" ,curl)
291 ("guile" ,guile-2.2)))))
292
293 (define-public curlpp
294 (package
295 (name "curlpp")
296 (version "0.8.1")
297 (source
298 (origin
299 (method git-fetch)
300 (uri (git-reference
301 (url "https://github.com/jpbarrette/curlpp")
302 (commit (string-append "v" version))))
303 (sha256
304 (base32 "1b0ylnnrhdax4kwjq64r1fk0i24n5ss6zfzf4hxwgslny01xiwrk"))
305 (file-name (git-file-name name version))))
306 (build-system cmake-build-system)
307 ;; There are no build tests to be had.
308 (arguments
309 '(#:tests? #f))
310 ;; The installed version needs the header files from the C library.
311 (propagated-inputs
312 `(("curl" ,curl)))
313 (synopsis "C++ wrapper around libcURL")
314 (description
315 "This package provides a free and easy-to-use client-side C++ URL
316 transfer library, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT,
317 FILE and LDAP; in particular it supports HTTPS certificates, HTTP POST, HTTP
318 PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies,
319 user+password authentication, file transfer resume, http proxy tunneling and
320 more!")
321 (home-page "http://www.curlpp.org")
322 (license license:expat)))