| 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, 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 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.69.1") |
| 57 | (replacement curl-7.71.0) |
| 58 | (source (origin |
| 59 | (method url-fetch) |
| 60 | (uri (string-append "https://curl.haxx.se/download/curl-" |
| 61 | version ".tar.xz")) |
| 62 | (sha256 |
| 63 | (base32 |
| 64 | "0kwxh76iq9fblk7iyv4f75bmcmasarp2bcm1mm07wyvzd7kdbiq3")) |
| 65 | (patches (search-patches "curl-use-ssl-cert-env.patch")))) |
| 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 | ;; XXX FIXME: Test #1510 seems to work on some machines and not |
| 130 | ;; others, possibly based on the kernel version. It works on Guix System |
| 131 | ;; on x86_64 with linux-libre-4.1, but fails on Hydra for both i686 |
| 132 | ;; and x86_64 with the following error: |
| 133 | ;; |
| 134 | ;; test 1510...[HTTP GET connection cache limit (CURLOPT_MAXCONNECTS)] |
| 135 | ;; |
| 136 | ;; 1510: output (log/stderr1510) FAILED: |
| 137 | ;; --- log/check-expected 2015-06-27 07:45:53.166720834 +0000 |
| 138 | ;; +++ log/check-generated 2015-06-27 07:45:53.166720834 +0000 |
| 139 | ;; @@ -1,5 +1,5 @@ |
| 140 | ;; * Connection #0 to host server1.example.com left intact[LF] |
| 141 | ;; * Connection #1 to host server2.example.com left intact[LF] |
| 142 | ;; * Connection #2 to host server3.example.com left intact[LF] |
| 143 | ;; -* Closing connection 0[LF] |
| 144 | ;; +* Closing connection 1[LF] |
| 145 | ;; * Connection #3 to host server4.example.com left intact[LF] |
| 146 | (delete-file "tests/data/test1510") |
| 147 | |
| 148 | ;; The top-level "make check" does "make -C tests quiet-test", which |
| 149 | ;; is too quiet. Use the "test" target instead, which is more |
| 150 | ;; verbose. |
| 151 | (invoke "make" "-C" "tests" "test")))))) |
| 152 | (synopsis "Command line tool for transferring data with URL syntax") |
| 153 | (description |
| 154 | "curl is a command line tool for transferring data with URL syntax, |
| 155 | supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, |
| 156 | LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. |
| 157 | curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP |
| 158 | form based upload, proxies, cookies, file transfer resume, user+password |
| 159 | authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy |
| 160 | tunneling, and so on.") |
| 161 | (license (license:non-copyleft "file://COPYING" |
| 162 | "See COPYING in the distribution.")) |
| 163 | (home-page "https://curl.haxx.se/"))) |
| 164 | |
| 165 | ;; This package exists mainly to bootstrap CMake. It must not depend on |
| 166 | ;; anything that uses cmake-build-system. |
| 167 | (define-public curl-minimal |
| 168 | (hidden-package |
| 169 | (package/inherit |
| 170 | curl |
| 171 | (name "curl-minimal") |
| 172 | (inputs (alist-delete "openldap" (package-inputs curl)))))) |
| 173 | |
| 174 | ;; Replacement package to fix CVE-2020-8169 and CVE-2020-8177. |
| 175 | (define curl-7.71.0 |
| 176 | (package |
| 177 | (inherit curl) |
| 178 | (version "7.71.0") |
| 179 | (source (origin |
| 180 | (inherit (package-source curl)) |
| 181 | (uri (string-append "https://curl.haxx.se/download/curl-" |
| 182 | version ".tar.xz")) |
| 183 | (sha256 |
| 184 | (base32 |
| 185 | "0wlppmx9iry8slh4pqcxj7lwc6fqwnlhh9ri2pcym2rx76a8gwfd")))) |
| 186 | (arguments |
| 187 | (substitute-keyword-arguments (package-arguments curl) |
| 188 | ((#:phases phases) |
| 189 | `(modify-phases ,phases |
| 190 | (replace 'check |
| 191 | (lambda _ |
| 192 | ;; Test 1510 is now disabled upstream, and the test runner |
| 193 | ;; complains that it can not disable a non-existing test. |
| 194 | ;; Thus, override the phase to not delete the test. |
| 195 | (substitute* "tests/runtests.pl" |
| 196 | (("/bin/sh") (which "sh"))) |
| 197 | (invoke "make" "-C" "tests" "test"))))))))) |
| 198 | |
| 199 | (define-public kurly |
| 200 | (package |
| 201 | (name "kurly") |
| 202 | (version "1.2.2") |
| 203 | (source (origin |
| 204 | (method git-fetch) |
| 205 | (uri (git-reference |
| 206 | (url "https://gitlab.com/davidjpeacock/kurly.git") |
| 207 | (commit (string-append "v" version)))) |
| 208 | (file-name (git-file-name name version)) |
| 209 | (sha256 |
| 210 | (base32 |
| 211 | "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm")))) |
| 212 | (build-system go-build-system) |
| 213 | (arguments |
| 214 | `(#:import-path "gitlab.com/davidjpeacock/kurly" |
| 215 | #:install-source? #f |
| 216 | #:phases |
| 217 | (modify-phases %standard-phases |
| 218 | (add-after 'install 'install-documentation |
| 219 | (lambda* (#:key import-path outputs #:allow-other-keys) |
| 220 | (let* ((source (string-append "src/" import-path)) |
| 221 | (out (assoc-ref outputs "out")) |
| 222 | (doc (string-append out "/share/doc/" ,name "-" ,version)) |
| 223 | (man (string-append out "/share/man/man1"))) |
| 224 | (with-directory-excursion source |
| 225 | (install-file "README.md" doc) |
| 226 | (mkdir-p man) |
| 227 | (copy-file "doc/kurly.man" |
| 228 | (string-append man "/kurly.1"))) |
| 229 | #t)))))) |
| 230 | (inputs |
| 231 | `(("go-github-com-alsm-ioprogress" ,go-github-com-alsm-ioprogress) |
| 232 | ("go-github-com-aki237-nscjar" ,go-github-com-aki237-nscjar) |
| 233 | ("go-github-com-urfave-cli" ,go-github-com-urfave-cli))) |
| 234 | (synopsis "Command-line HTTP client") |
| 235 | (description "kurly is an alternative to the @code{curl} program written in |
| 236 | Go. kurly is designed to operate in a similar manner to curl, with select |
| 237 | features. Notably, kurly is not aiming for feature parity, but common flags and |
| 238 | mechanisms particularly within the HTTP(S) realm are to be expected. kurly does |
| 239 | not offer a replacement for libcurl.") |
| 240 | (home-page "https://gitlab.com/davidjpeacock/kurly") |
| 241 | (license license:asl2.0))) |
| 242 | |
| 243 | (define-public guile-curl |
| 244 | (package |
| 245 | (name "guile-curl") |
| 246 | (version "0.6") |
| 247 | (source (origin |
| 248 | (method url-fetch) |
| 249 | (uri (string-append "http://www.lonelycactus.com/tarball/" |
| 250 | "guile_curl-" version ".tar.gz")) |
| 251 | (sha256 |
| 252 | (base32 |
| 253 | "1pxdhnk288ky6gkpad8i60m0p6404rdvls43lr1b5d3csrklyc70")))) |
| 254 | (build-system gnu-build-system) |
| 255 | (arguments |
| 256 | `(#:configure-flags (list (string-append |
| 257 | "--with-guilesitedir=" |
| 258 | (assoc-ref %outputs "out") |
| 259 | "/share/guile/site/2.2") |
| 260 | (string-append |
| 261 | "-with-guileextensiondir=" |
| 262 | (assoc-ref %outputs "out") |
| 263 | "/lib/guile/2.2/extensions")) |
| 264 | #:phases |
| 265 | (modify-phases %standard-phases |
| 266 | (add-after 'install 'patch-extension-path |
| 267 | (lambda* (#:key outputs #:allow-other-keys) |
| 268 | (let* ((out (assoc-ref outputs "out")) |
| 269 | (curl.scm (string-append |
| 270 | out "/share/guile/site/2.2/curl.scm")) |
| 271 | (curl.go (string-append |
| 272 | out "/lib/guile/2.2/site-ccache/curl.go")) |
| 273 | (ext (string-append out "/lib/guile/2.2/" |
| 274 | "extensions/libguile-curl"))) |
| 275 | (substitute* curl.scm (("libguile-curl") ext)) |
| 276 | ;; The build system does not actually compile the Scheme module. |
| 277 | ;; So we can compile it and put it in the right place in one go. |
| 278 | (invoke "guild" "compile" curl.scm "-o" curl.go))))))) |
| 279 | (native-inputs `(("pkg-config" ,pkg-config))) |
| 280 | (inputs |
| 281 | `(("curl" ,curl) |
| 282 | ("guile" ,guile-2.2))) |
| 283 | (home-page "http://www.lonelycactus.com/guile-curl.html") |
| 284 | (synopsis "Curl bindings for Guile") |
| 285 | (description "@code{guile-curl} is a project that has procedures that allow |
| 286 | Guile to do client-side URL transfers, like requesting documents from HTTP or |
| 287 | FTP servers. It is based on the curl library.") |
| 288 | (license license:gpl3+))) |
| 289 | |
| 290 | (define-public curlpp |
| 291 | (package |
| 292 | (name "curlpp") |
| 293 | (version "0.8.1") |
| 294 | (source |
| 295 | (origin |
| 296 | (method git-fetch) |
| 297 | (uri (git-reference |
| 298 | (url "https://github.com/jpbarrette/curlpp") |
| 299 | (commit (string-append "v" version)))) |
| 300 | (sha256 |
| 301 | (base32 "1b0ylnnrhdax4kwjq64r1fk0i24n5ss6zfzf4hxwgslny01xiwrk")) |
| 302 | (file-name (git-file-name name version)))) |
| 303 | (build-system cmake-build-system) |
| 304 | ;; There are no build tests to be had. |
| 305 | (arguments |
| 306 | '(#:tests? #f)) |
| 307 | ;; The installed version needs the header files from the C library. |
| 308 | (propagated-inputs |
| 309 | `(("curl" ,curl))) |
| 310 | (synopsis "C++ wrapper around libcURL") |
| 311 | (description |
| 312 | "This package provides a free and easy-to-use client-side C++ URL |
| 313 | transfer library, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, |
| 314 | FILE and LDAP; in particular it supports HTTPS certificates, HTTP POST, HTTP |
| 315 | PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies, |
| 316 | user+password authentication, file transfer resume, http proxy tunneling and |
| 317 | more!") |
| 318 | (home-page "http://www.curlpp.org") |
| 319 | (license license:expat))) |