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 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 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
19 ;;;
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28 (define-module (gnu packages curl)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix utils)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system go)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages golang)
39 #:use-module (gnu packages groff)
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
50 (define-public curl
51 (package
52 (name "curl")
53 (version "7.68.0")
54 (source (origin
55 (method url-fetch)
56 (uri (string-append "https://curl.haxx.se/download/curl-"
57 version ".tar.xz"))
58 (sha256
59 (base32
60 "0nh3j90w6b97wqcgxjfq55qhkz9s38955fbhwzv2fsi7483j895p"))))
61 (build-system gnu-build-system)
62 (outputs '("out"
63 "doc")) ;1.2 MiB of man3 pages
64 (inputs `(("gnutls" ,gnutls)
65 ("libidn" ,libidn)
66 ("openldap" ,openldap)
67 ("mit-krb5" ,mit-krb5)
68 ("nghttp2" ,nghttp2 "lib")
69 ("zlib" ,zlib)))
70 (native-inputs
71 `(("perl" ,perl)
72 ;; to enable the --manual option and make test 1026 pass
73 ("groff" ,groff)
74 ("pkg-config" ,pkg-config)
75 ("python" ,python-wrapper)))
76 (native-search-paths
77 ;; Note: This search path is respected by the `curl` command-line tool only.
78 ;; Ideally we would bake this into libcurl itself so other users can benefit,
79 ;; but it's not supported upstream due to thread safety concerns.
80 (list (search-path-specification
81 (variable "CURL_CA_BUNDLE")
82 (file-type 'regular)
83 (separator #f) ;single entry
84 (files '("etc/ssl/certs/ca-certificates.crt")))))
85 (arguments
86 `(#:configure-flags (list "--with-gnutls"
87 (string-append "--with-gssapi="
88 (assoc-ref %build-inputs "mit-krb5"))
89 "--disable-static")
90 ;; Add a phase to patch '/bin/sh' occurances in tests/runtests.pl
91 #:phases
92 (modify-phases %standard-phases
93 (add-after
94 'install 'move-man3-pages
95 (lambda* (#:key outputs #:allow-other-keys)
96 ;; Move section 3 man pages to "doc".
97 (let ((out (assoc-ref outputs "out"))
98 (doc (assoc-ref outputs "doc")))
99 (mkdir-p (string-append doc "/share/man"))
100 (rename-file (string-append out "/share/man/man3")
101 (string-append doc "/share/man/man3"))
102 #t)))
103 (replace
104 'check
105 (lambda _
106 (substitute* "tests/runtests.pl"
107 (("/bin/sh") (which "sh")))
108
109 ;; XXX FIXME: Test #1510 seems to work on some machines and not
110 ;; others, possibly based on the kernel version. It works on Guix System
111 ;; on x86_64 with linux-libre-4.1, but fails on Hydra for both i686
112 ;; and x86_64 with the following error:
113 ;;
114 ;; test 1510...[HTTP GET connection cache limit (CURLOPT_MAXCONNECTS)]
115 ;;
116 ;; 1510: output (log/stderr1510) FAILED:
117 ;; --- log/check-expected 2015-06-27 07:45:53.166720834 +0000
118 ;; +++ log/check-generated 2015-06-27 07:45:53.166720834 +0000
119 ;; @@ -1,5 +1,5 @@
120 ;; * Connection #0 to host server1.example.com left intact[LF]
121 ;; * Connection #1 to host server2.example.com left intact[LF]
122 ;; * Connection #2 to host server3.example.com left intact[LF]
123 ;; -* Closing connection 0[LF]
124 ;; +* Closing connection 1[LF]
125 ;; * Connection #3 to host server4.example.com left intact[LF]
126 (delete-file "tests/data/test1510")
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 (define-public kurly
146 (package
147 (name "kurly")
148 (version "1.2.2")
149 (source (origin
150 (method git-fetch)
151 (uri (git-reference
152 (url "https://gitlab.com/davidjpeacock/kurly.git")
153 (commit (string-append "v" version))))
154 (file-name (git-file-name name version))
155 (sha256
156 (base32
157 "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
158 (build-system go-build-system)
159 (arguments
160 `(#:import-path "gitlab.com/davidjpeacock/kurly"
161 #:install-source? #f
162 #:phases
163 (modify-phases %standard-phases
164 (add-after 'install 'install-documentation
165 (lambda* (#:key import-path outputs #:allow-other-keys)
166 (let* ((source (string-append "src/" import-path))
167 (out (assoc-ref outputs "out"))
168 (doc (string-append out "/share/doc/" ,name "-" ,version))
169 (man (string-append out "/share/man/man1")))
170 (with-directory-excursion source
171 (install-file "README.md" doc)
172 (mkdir-p man)
173 (copy-file "doc/kurly.man"
174 (string-append man "/kurly.1")))
175 #t))))))
176 (inputs
177 `(("go-github-com-alsm-ioprogress" ,go-github-com-alsm-ioprogress)
178 ("go-github-com-aki237-nscjar" ,go-github-com-aki237-nscjar)
179 ("go-github-com-urfave-cli" ,go-github-com-urfave-cli)))
180 (synopsis "Command-line HTTP client")
181 (description "kurly is an alternative to the @code{curl} program written in
182 Go. kurly is designed to operate in a similar manner to curl, with select
183 features. Notably, kurly is not aiming for feature parity, but common flags and
184 mechanisms particularly within the HTTP(S) realm are to be expected. kurly does
185 not offer a replacement for libcurl.")
186 (home-page "https://gitlab.com/davidjpeacock/kurly")
187 (license license:asl2.0)))
188
189 (define-public guile-curl
190 (package
191 (name "guile-curl")
192 (version "0.6")
193 (source (origin
194 (method url-fetch)
195 (uri (string-append "http://www.lonelycactus.com/tarball/"
196 "guile_curl-" version ".tar.gz"))
197 (sha256
198 (base32
199 "1pxdhnk288ky6gkpad8i60m0p6404rdvls43lr1b5d3csrklyc70"))))
200 (build-system gnu-build-system)
201 (arguments
202 `(#:configure-flags (list (string-append
203 "--with-guilesitedir="
204 (assoc-ref %outputs "out")
205 "/share/guile/site/2.2")
206 (string-append
207 "-with-guileextensiondir="
208 (assoc-ref %outputs "out")
209 "/lib/guile/2.2/extensions"))
210 #:phases
211 (modify-phases %standard-phases
212 (add-after 'install 'patch-extension-path
213 (lambda* (#:key outputs #:allow-other-keys)
214 (let* ((out (assoc-ref outputs "out"))
215 (curl.scm (string-append
216 out "/share/guile/site/2.2/curl.scm"))
217 (curl.go (string-append
218 out "/lib/guile/2.2/site-ccache/curl.go"))
219 (ext (string-append out "/lib/guile/2.2/"
220 "extensions/libguile-curl")))
221 (substitute* curl.scm (("libguile-curl") ext))
222 ;; The build system does not actually compile the Scheme module.
223 ;; So we can compile it and put it in the right place in one go.
224 (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
225 (native-inputs `(("pkg-config" ,pkg-config)))
226 (inputs
227 `(("curl" ,curl)
228 ("guile" ,guile-2.2)))
229 (home-page "http://www.lonelycactus.com/guile-curl.html")
230 (synopsis "Curl bindings for Guile")
231 (description "@code{guile-curl} is a project that has procedures that allow
232 Guile to do client-side URL transfers, like requesting documents from HTTP or
233 FTP servers. It is based on the curl library.")
234 (license license:gpl3+)))