curl.scm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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 Leo Famulari <leo@famulari.name>
  7. ;;; Copyright © 2017 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. (define-module (gnu packages curl)
  28. #:use-module ((guix licenses) #:prefix license:)
  29. #:use-module (guix packages)
  30. #:use-module (guix download)
  31. #:use-module (guix git-download)
  32. #:use-module (guix utils)
  33. #:use-module (guix build-system gnu)
  34. #:use-module (guix build-system go)
  35. #:use-module (gnu packages)
  36. #:use-module (gnu packages compression)
  37. #:use-module (gnu packages golang)
  38. #:use-module (gnu packages groff)
  39. #:use-module (gnu packages gsasl)
  40. #:use-module (gnu packages guile)
  41. #:use-module (gnu packages libidn)
  42. #:use-module (gnu packages openldap)
  43. #:use-module (gnu packages perl)
  44. #:use-module (gnu packages pkg-config)
  45. #:use-module (gnu packages python)
  46. #:use-module (gnu packages ssh)
  47. #:use-module (gnu packages tls)
  48. #:use-module (gnu packages web))
  49. (define-public curl
  50. (package
  51. (name "curl")
  52. (replacement curl-7.64.0)
  53. (version "7.63.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. "1i38v49233jirzlfqd8fy6jyf80assa953hk7w6qmysbg562604n"))))
  61. (build-system gnu-build-system)
  62. (outputs '("out"
  63. "doc")) ;1.2 MiB of man3 pages
  64. (inputs `(("gnutls" ,gnutls)
  65. ("gss" ,gss)
  66. ("libidn" ,libidn)
  67. ("libssh2" ,libssh2)
  68. ("openldap" ,openldap)
  69. ("nghttp2" ,nghttp2 "lib")
  70. ("zlib" ,zlib)))
  71. (native-inputs
  72. `(("perl" ,perl)
  73. ;; to enable the --manual option and make test 1026 pass
  74. ("groff" ,groff)
  75. ("pkg-config" ,pkg-config)
  76. ("python" ,python-2)))
  77. (native-search-paths
  78. ;; Note: This search path is respected by the `curl` command-line tool only.
  79. ;; Ideally we would bake this into libcurl itself so other users can benefit,
  80. ;; but it's not supported upstream due to thread safety concerns.
  81. (list (search-path-specification
  82. (variable "CURL_CA_BUNDLE")
  83. (file-type 'regular)
  84. (separator #f) ;single entry
  85. (files '("etc/ssl/certs/ca-certificates.crt")))))
  86. (arguments
  87. `(#:configure-flags '("--with-gnutls" "--with-gssapi"
  88. "--disable-static")
  89. ;; Add a phase to patch '/bin/sh' occurances in tests/runtests.pl
  90. #:phases
  91. (modify-phases %standard-phases
  92. (add-after
  93. 'install 'move-man3-pages
  94. (lambda* (#:key outputs #:allow-other-keys)
  95. ;; Move section 3 man pages to "doc".
  96. (let ((out (assoc-ref outputs "out"))
  97. (doc (assoc-ref outputs "doc")))
  98. (mkdir-p (string-append doc "/share/man"))
  99. (rename-file (string-append out "/share/man/man3")
  100. (string-append doc "/share/man/man3"))
  101. #t)))
  102. (replace
  103. 'check
  104. (lambda _
  105. (substitute* "tests/runtests.pl"
  106. (("/bin/sh") (which "sh")))
  107. ;; XXX FIXME: Test #1510 seems to work on some machines and not
  108. ;; others, possibly based on the kernel version. It works on GuixSD
  109. ;; on x86_64 with linux-libre-4.1, but fails on Hydra for both i686
  110. ;; and x86_64 with the following error:
  111. ;;
  112. ;; test 1510...[HTTP GET connection cache limit (CURLOPT_MAXCONNECTS)]
  113. ;;
  114. ;; 1510: output (log/stderr1510) FAILED:
  115. ;; --- log/check-expected 2015-06-27 07:45:53.166720834 +0000
  116. ;; +++ log/check-generated 2015-06-27 07:45:53.166720834 +0000
  117. ;; @@ -1,5 +1,5 @@
  118. ;; * Connection #0 to host server1.example.com left intact[LF]
  119. ;; * Connection #1 to host server2.example.com left intact[LF]
  120. ;; * Connection #2 to host server3.example.com left intact[LF]
  121. ;; -* Closing connection 0[LF]
  122. ;; +* Closing connection 1[LF]
  123. ;; * Connection #3 to host server4.example.com left intact[LF]
  124. (delete-file "tests/data/test1510")
  125. ;; The top-level "make check" does "make -C tests quiet-test", which
  126. ;; is too quiet. Use the "test" target instead, which is more
  127. ;; verbose.
  128. (invoke "make" "-C" "tests" "test"))))))
  129. (synopsis "Command line tool for transferring data with URL syntax")
  130. (description
  131. "curl is a command line tool for transferring data with URL syntax,
  132. supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
  133. LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.
  134. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
  135. form based upload, proxies, cookies, file transfer resume, user+password
  136. authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy
  137. tunneling, and so on.")
  138. (license (license:non-copyleft "file://COPYING"
  139. "See COPYING in the distribution."))
  140. (home-page "https://curl.haxx.se/")))
  141. (define-public curl-7.64.0
  142. (package
  143. (inherit curl)
  144. (version "7.64.0")
  145. (source
  146. (origin
  147. (method url-fetch)
  148. (uri (string-append "https://curl.haxx.se/download/curl-"
  149. version ".tar.xz"))
  150. (sha256
  151. (base32
  152. "00b0mw4fc1pbmbh55maab24x3ijdvkbpl1s4njfa4jnl6kx16brg"))))))
  153. (define-public kurly
  154. (package
  155. (name "kurly")
  156. (version "1.2.2")
  157. (source (origin
  158. (method git-fetch)
  159. (uri (git-reference
  160. (url "https://gitlab.com/davidjpeacock/kurly.git")
  161. (commit (string-append "v" version))))
  162. (file-name (git-file-name name version))
  163. (sha256
  164. (base32
  165. "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
  166. (build-system go-build-system)
  167. (arguments
  168. `(#:import-path "gitlab.com/davidjpeacock/kurly"
  169. #:install-source? #f
  170. #:phases
  171. (modify-phases %standard-phases
  172. (add-after 'install 'install-documentation
  173. (lambda* (#:key import-path outputs #:allow-other-keys)
  174. (let* ((source (string-append "src/" import-path))
  175. (out (assoc-ref outputs "out"))
  176. (doc (string-append out "/share/doc/" ,name "-" ,version))
  177. (man (string-append out "/share/man/man1")))
  178. (with-directory-excursion source
  179. (install-file "README.md" doc)
  180. (mkdir-p man)
  181. (copy-file "doc/kurly.man"
  182. (string-append man "/kurly.1")))
  183. #t))))))
  184. (inputs
  185. `(("go-github-com-alsm-ioprogress" ,go-github-com-alsm-ioprogress)
  186. ("go-github-com-aki237-nscjar" ,go-github-com-aki237-nscjar)
  187. ("go-github-com-urfave-cli" ,go-github-com-urfave-cli)))
  188. (synopsis "Command-line HTTP client")
  189. (description "kurly is an alternative to the @code{curl} program written in
  190. Go. kurly is designed to operate in a similar manner to curl, with select
  191. features. Notably, kurly is not aiming for feature parity, but common flags and
  192. mechanisms particularly within the HTTP(S) realm are to be expected. kurly does
  193. not offer a replacement for libcurl.")
  194. (home-page "https://gitlab.com/davidjpeacock/kurly")
  195. (license license:asl2.0)))
  196. (define-public guile-curl
  197. (package
  198. (name "guile-curl")
  199. (version "0.6")
  200. (source (origin
  201. (method url-fetch)
  202. (uri (string-append "http://www.lonelycactus.com/tarball/"
  203. "guile_curl-" version ".tar.gz"))
  204. (sha256
  205. (base32
  206. "1pxdhnk288ky6gkpad8i60m0p6404rdvls43lr1b5d3csrklyc70"))))
  207. (build-system gnu-build-system)
  208. (arguments
  209. `(#:configure-flags (list (string-append
  210. "--with-guilesitedir="
  211. (assoc-ref %outputs "out")
  212. "/share/guile/site/2.2")
  213. (string-append
  214. "-with-guileextensiondir="
  215. (assoc-ref %outputs "out")
  216. "/lib/guile/2.2/extensions"))
  217. #:phases
  218. (modify-phases %standard-phases
  219. (add-after 'install 'patch-extension-path
  220. (lambda* (#:key outputs #:allow-other-keys)
  221. (let* ((out (assoc-ref outputs "out"))
  222. (curl.scm (string-append
  223. out "/share/guile/site/2.2/curl.scm"))
  224. (curl.go (string-append
  225. out "/lib/guile/2.2/site-ccache/curl.go"))
  226. (ext (string-append out "/lib/guile/2.2/"
  227. "extensions/libguile-curl")))
  228. (substitute* curl.scm (("libguile-curl") ext))
  229. ;; The build system does not actually compile the Scheme module.
  230. ;; So we can compile it and put it in the right place in one go.
  231. (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
  232. (native-inputs `(("pkg-config" ,pkg-config)))
  233. (inputs
  234. `(("curl" ,curl)
  235. ("guile" ,guile-2.2)))
  236. (home-page "http://www.lonelycactus.com/guile-curl.html")
  237. (synopsis "Curl bindings for Guile")
  238. (description "@code{guile-curl} is a project that has procedures that allow
  239. Guile to do client-side URL transfers, like requesting documents from HTTP or
  240. FTP servers. It is based on the curl library.")
  241. (license license:gpl3+)))