gnu: guile-curl: Update to 0.9.
[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 (build-system gnu-build-system)
66 (outputs '("out"
67 "doc")) ;1.2 MiB of man3 pages
68 (inputs `(("gnutls" ,gnutls)
69 ("libidn" ,libidn)
70 ("openldap" ,openldap)
71 ("mit-krb5" ,mit-krb5)
72 ("nghttp2" ,nghttp2 "lib")
73 ("zlib" ,zlib)))
74 (native-inputs
75 `(("perl" ,perl)
76 ("pkg-config" ,pkg-config)
77 ("python" ,python-wrapper)))
78 (native-search-paths
79 ;; These variables are introduced by curl-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 `(#:disallowed-references ("doc")
99 #:configure-flags (list "--with-gnutls"
100 (string-append "--with-gssapi="
101 (assoc-ref %build-inputs "mit-krb5"))
102 "--disable-static")
103 #:phases
104 (modify-phases %standard-phases
105 (add-after 'unpack 'do-not-record-configure-flags
106 (lambda _
107 ;; Do not save the configure options to avoid unnecessary references.
108 (substitute* "curl-config.in"
109 (("@CONFIGURE_OPTIONS@")
110 "\"not available\""))
111 #t))
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 #t)))
122 (replace
123 'check
124 (lambda _
125 (substitute* "tests/runtests.pl"
126 (("/bin/sh") (which "sh")))
127
128 ;; The top-level "make check" does "make -C tests quiet-test", which
129 ;; is too quiet. Use the "test" target instead, which is more
130 ;; verbose.
131 (invoke "make" "-C" "tests" "test"))))))
132 (synopsis "Command line tool for transferring data with URL syntax")
133 (description
134 "curl is a command line tool for transferring data with URL syntax,
135 supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
136 LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.
137 curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
138 form based upload, proxies, cookies, file transfer resume, user+password
139 authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy
140 tunneling, and so on.")
141 (license (license:non-copyleft "file://COPYING"
142 "See COPYING in the distribution."))
143 (home-page "https://curl.haxx.se/")))
144
145 ;; This package exists mainly to bootstrap CMake. It must not depend on
146 ;; anything that uses cmake-build-system.
147 (define-public curl-minimal
148 (hidden-package
149 (package/inherit
150 curl
151 (name "curl-minimal")
152 (inputs (alist-delete "openldap" (package-inputs curl))))))
153
154 (define-public kurly
155 (package
156 (name "kurly")
157 (version "1.2.2")
158 (source (origin
159 (method git-fetch)
160 (uri (git-reference
161 (url "https://gitlab.com/davidjpeacock/kurly.git")
162 (commit (string-append "v" version))))
163 (file-name (git-file-name name version))
164 (sha256
165 (base32
166 "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
167 (build-system go-build-system)
168 (arguments
169 `(#:import-path "gitlab.com/davidjpeacock/kurly"
170 #:install-source? #f
171 #:phases
172 (modify-phases %standard-phases
173 (add-after 'install 'install-documentation
174 (lambda* (#:key import-path outputs #:allow-other-keys)
175 (let* ((source (string-append "src/" import-path))
176 (out (assoc-ref outputs "out"))
177 (doc (string-append out "/share/doc/" ,name "-" ,version))
178 (man (string-append out "/share/man/man1")))
179 (with-directory-excursion source
180 (install-file "README.md" doc)
181 (mkdir-p man)
182 (copy-file "doc/kurly.man"
183 (string-append man "/kurly.1")))
184 #t))))))
185 (inputs
186 `(("go-github-com-alsm-ioprogress" ,go-github-com-alsm-ioprogress)
187 ("go-github-com-aki237-nscjar" ,go-github-com-aki237-nscjar)
188 ("go-github-com-urfave-cli" ,go-github-com-urfave-cli)))
189 (synopsis "Command-line HTTP client")
190 (description "kurly is an alternative to the @code{curl} program written in
191 Go. kurly is designed to operate in a similar manner to curl, with select
192 features. Notably, kurly is not aiming for feature parity, but common flags and
193 mechanisms particularly within the HTTP(S) realm are to be expected. kurly does
194 not offer a replacement for libcurl.")
195 (home-page "https://gitlab.com/davidjpeacock/kurly")
196 (license license:asl2.0)))
197
198 (define-public guile-curl
199 (package
200 (name "guile-curl")
201 (version "0.9")
202 (source (origin
203 (method url-fetch)
204 (uri (string-append "http://www.lonelycactus.com/tarball/"
205 "guile_curl-" version ".tar.gz"))
206 (sha256
207 (base32
208 "0y7wfhilfm6vzs0wyifrrc2pj9nsxfas905c7qa5cw4i6s74ypmi"))))
209 (build-system gnu-build-system)
210 (arguments
211 `(#:modules (((guix build guile-build-system)
212 #:select (target-guile-effective-version))
213 ,@%gnu-build-system-modules)
214 #:imported-modules ((guix build guile-build-system)
215 ,@%gnu-build-system-modules)
216 #:configure-flags (list (string-append
217 "--with-guilesitedir="
218 (assoc-ref %outputs "out")
219 "/share/guile/site/"
220 (target-guile-effective-version
221 (assoc-ref %build-inputs "guile")))
222 (string-append
223 "-with-guileextensiondir="
224 (assoc-ref %outputs "out")
225 "/lib/guile/"
226 (target-guile-effective-version
227 (assoc-ref %build-inputs "guile"))
228 "/extensions"))
229 #:phases
230 (modify-phases %standard-phases
231 (add-after 'unpack 'patch-undefined-references
232 (lambda* _
233 (substitute* "module/curl.scm"
234 ;; The following #defines are missing from our curl package
235 ;; and therefore result in the evaluation of undefined symbols.
236 ((",CURLOPT_HAPROXYPROTOCOL") "#f")
237 ((",CURLOPT_DISALLOW_USERNAME_IN_URL") "#f")
238 ((",CURLOPT_TIMEVALUE_LARGE") "#f")
239 ((",CURLOPT_DNS_SHUFFLE_ADDRESSES") "#f")
240 ((",CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS") "#f"))))
241 (add-after 'install 'patch-extension-path
242 (lambda* (#:key outputs #:allow-other-keys)
243 (let* ((out (assoc-ref outputs "out"))
244 (curl.scm (string-append
245 out "/share/guile/site/"
246 (target-guile-effective-version)
247 "/curl.scm"))
248 (curl.go (string-append
249 out "/lib/guile/"
250 (target-guile-effective-version)
251 "/site-ccache/curl.go"))
252 (ext (string-append out "/lib/guile/"
253 (target-guile-effective-version)
254 "/extensions/libguile-curl")))
255 (substitute* curl.scm (("libguile-curl") ext))
256 ;; The build system does not actually compile the Scheme module.
257 ;; So we can compile it and put it in the right place in one go.
258 (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
259 (native-inputs `(("pkg-config" ,pkg-config)))
260 (inputs
261 `(("curl" ,curl)
262 ("guile" ,guile-3.0)))
263 (home-page "http://www.lonelycactus.com/guile-curl.html")
264 (synopsis "Curl bindings for Guile")
265 (description "@code{guile-curl} is a project that has procedures that allow
266 Guile to do client-side URL transfers, like requesting documents from HTTP or
267 FTP servers. It is based on the curl library.")
268 (license license:gpl3+)))
269
270 (define-public guile2.2-curl
271 (package
272 (inherit guile-curl)
273 (name "guile2.2-curl")
274 (inputs
275 `(("curl" ,curl)
276 ("guile" ,guile-2.2)))))
277
278 (define-public curlpp
279 (package
280 (name "curlpp")
281 (version "0.8.1")
282 (source
283 (origin
284 (method git-fetch)
285 (uri (git-reference
286 (url "https://github.com/jpbarrette/curlpp")
287 (commit (string-append "v" version))))
288 (sha256
289 (base32 "1b0ylnnrhdax4kwjq64r1fk0i24n5ss6zfzf4hxwgslny01xiwrk"))
290 (file-name (git-file-name name version))))
291 (build-system cmake-build-system)
292 ;; There are no build tests to be had.
293 (arguments
294 '(#:tests? #f))
295 ;; The installed version needs the header files from the C library.
296 (propagated-inputs
297 `(("curl" ,curl)))
298 (synopsis "C++ wrapper around libcURL")
299 (description
300 "This package provides a free and easy-to-use client-side C++ URL
301 transfer library, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT,
302 FILE and LDAP; in particular it supports HTTPS certificates, HTTP POST, HTTP
303 PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies,
304 user+password authentication, file transfer resume, http proxy tunneling and
305 more!")
306 (home-page "http://www.curlpp.org")
307 (license license:expat)))