curl.scm 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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, 2021, 2022 Ludovic Courtès <ludo@gnu.org>
  6. ;;; Copyright © 2016, 2017, 2019 Leo Famulari <leo@famulari.name>
  7. ;;; Copyright © 2017, 2019, 2020, 2022 Marius Bakke <marius@gnu.org>
  8. ;;; Copyright © 2017, 2023 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. ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  15. ;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
  16. ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
  17. ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
  18. ;;;
  19. ;;; This file is part of GNU Guix.
  20. ;;;
  21. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  22. ;;; under the terms of the GNU General Public License as published by
  23. ;;; the Free Software Foundation; either version 3 of the License, or (at
  24. ;;; your option) any later version.
  25. ;;;
  26. ;;; GNU Guix is distributed in the hope that it will be useful, but
  27. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  28. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. ;;; GNU General Public License for more details.
  30. ;;;
  31. ;;; You should have received a copy of the GNU General Public License
  32. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  33. (define-module (gnu packages curl)
  34. #:use-module ((guix licenses) #:prefix license:)
  35. #:use-module (guix packages)
  36. #:use-module (guix gexp)
  37. #:use-module (guix download)
  38. #:use-module (guix git-download)
  39. #:use-module (guix utils)
  40. #:use-module (guix build-system cmake)
  41. #:use-module (guix build-system copy)
  42. #:use-module (guix build-system gnu)
  43. #:use-module (guix build-system go)
  44. #:use-module (guix build-system meson)
  45. #:use-module ((guix search-paths) #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
  46. #:use-module (gnu packages)
  47. #:use-module (gnu packages check)
  48. #:use-module (gnu packages compression)
  49. #:use-module (gnu packages golang)
  50. #:use-module (gnu packages guile)
  51. #:use-module (gnu packages kerberos)
  52. #:use-module (gnu packages logging)
  53. #:use-module (gnu packages libevent)
  54. #:use-module (gnu packages libidn)
  55. #:use-module (gnu packages perl)
  56. #:use-module (gnu packages pkg-config)
  57. #:use-module (gnu packages python)
  58. #:use-module (gnu packages ssh)
  59. #:use-module (gnu packages tls)
  60. #:use-module (gnu packages web)
  61. #:use-module (srfi srfi-1))
  62. (define-public curl
  63. (package
  64. (name "curl")
  65. (version "7.85.0")
  66. (source (origin
  67. (method url-fetch)
  68. (uri (string-append "https://curl.se/download/curl-"
  69. version ".tar.xz"))
  70. (sha256
  71. (base32
  72. "1rjbn0h5rddclhvxb8p5gddxszcrpbf5cw1whx6wnj4s9dnlmdc8"))
  73. (patches (search-patches "curl-use-ssl-cert-env.patch"))))
  74. (build-system gnu-build-system)
  75. (outputs '("out"
  76. "doc")) ;1.2 MiB of man3 pages
  77. (inputs
  78. (list gnutls libidn mit-krb5 `(,nghttp2 "lib") zlib))
  79. (native-inputs
  80. (list nghttp2 perl pkg-config python-minimal-wrapper))
  81. (native-search-paths
  82. ;; These variables are introduced by curl-use-ssl-cert-env.patch.
  83. (list $SSL_CERT_DIR
  84. $SSL_CERT_FILE
  85. ;; Note: This search path is respected by the `curl` command-line
  86. ;; tool only. Patching libcurl to read it too would bring no
  87. ;; advantages and require maintaining a more complex patch.
  88. (search-path-specification
  89. (variable "CURL_CA_BUNDLE")
  90. (file-type 'regular)
  91. (separator #f) ;single entry
  92. (files '("etc/ssl/certs/ca-certificates.crt")))))
  93. (arguments
  94. (list
  95. #:disallowed-references '("doc")
  96. #:configure-flags
  97. #~(list "--with-gnutls"
  98. (string-append "--with-gssapi="
  99. (dirname (dirname
  100. (search-input-file
  101. %build-inputs "lib/libgssrpc.so"))))
  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. (add-after 'install 'move-man3-pages
  112. (lambda _
  113. ;; Move section 3 man pages to "doc".
  114. (mkdir-p (string-append #$output:doc "/share/man"))
  115. (rename-file (string-append #$output "/share/man/man3")
  116. (string-append #$output:doc "/share/man/man3"))))
  117. (replace 'check
  118. (lambda* (#:key tests? #:allow-other-keys)
  119. (substitute* "tests/runtests.pl"
  120. (("/bin/sh") (which "sh")))
  121. (when tests?
  122. ;; The top-level "make check" does "make -C tests quiet-test", which
  123. ;; is too quiet. Use the "test" target instead, which is more
  124. ;; verbose.
  125. (invoke "make" "-C" "tests" "test")))))))
  126. (synopsis "Command line tool for transferring data with URL syntax")
  127. (description
  128. "curl is a command line tool for transferring data with URL syntax,
  129. supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
  130. LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.
  131. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
  132. form based upload, proxies, cookies, file transfer resume, user+password
  133. authentication (Basic, Digest, NTLM, Negotiate, kerberos...), proxy
  134. tunneling, and so on.")
  135. (license (license:non-copyleft "file://COPYING"
  136. "See COPYING in the distribution."))
  137. (home-page "https://curl.haxx.se/")))
  138. (define-public curl-ssh
  139. (package/inherit curl
  140. (arguments
  141. (substitute-keyword-arguments (package-arguments curl)
  142. ((#:configure-flags flags)
  143. #~(cons "--with-libssh2" #$flags))))
  144. (inputs
  145. (modify-inputs (package-inputs curl)
  146. (prepend libssh2)))
  147. (properties `((hidden? . #t)))))
  148. (define-public kurly
  149. (package
  150. (name "kurly")
  151. (version "1.2.2")
  152. (source (origin
  153. (method git-fetch)
  154. (uri (git-reference
  155. (url "https://gitlab.com/davidjpeacock/kurly.git")
  156. (commit (string-append "v" version))))
  157. (file-name (git-file-name name version))
  158. (sha256
  159. (base32
  160. "003jv2k45hg2svhjpy5253ccd250vi2r17x2zhm51iw54kgwxipm"))))
  161. (build-system go-build-system)
  162. (arguments
  163. `(#:import-path "gitlab.com/davidjpeacock/kurly"
  164. #:install-source? #f
  165. #:phases
  166. (modify-phases %standard-phases
  167. (add-after 'install 'install-documentation
  168. (lambda* (#:key import-path outputs #:allow-other-keys)
  169. (let* ((source (string-append "src/" import-path))
  170. (out (assoc-ref outputs "out"))
  171. (doc (string-append out "/share/doc/" ,name "-" ,version))
  172. (man (string-append out "/share/man/man1")))
  173. (with-directory-excursion source
  174. (install-file "README.md" doc)
  175. (mkdir-p man)
  176. (copy-file "doc/kurly.man"
  177. (string-append man "/kurly.1")))
  178. #t))))))
  179. (inputs
  180. (list go-github-com-alsm-ioprogress go-github-com-aki237-nscjar
  181. go-github-com-urfave-cli))
  182. (synopsis "Command-line HTTP client")
  183. (description "kurly is an alternative to the @code{curl} program written in
  184. Go. kurly is designed to operate in a similar manner to curl, with select
  185. features. Notably, kurly is not aiming for feature parity, but common flags and
  186. mechanisms particularly within the HTTP(S) realm are to be expected. kurly does
  187. not offer a replacement for libcurl.")
  188. (home-page "https://gitlab.com/davidjpeacock/kurly")
  189. (license license:asl2.0)))
  190. (define-public guile-curl
  191. (package
  192. (name "guile-curl")
  193. (version "0.9")
  194. (source (origin
  195. (method url-fetch)
  196. (uri (string-append "http://www.lonelycactus.com/tarball/"
  197. "guile_curl-" version ".tar.gz"))
  198. (sha256
  199. (base32
  200. "0y7wfhilfm6vzs0wyifrrc2pj9nsxfas905c7qa5cw4i6s74ypmi"))))
  201. (build-system gnu-build-system)
  202. (arguments
  203. `(#:modules (((guix build guile-build-system)
  204. #:select (target-guile-effective-version))
  205. ,@%gnu-build-system-modules)
  206. #:imported-modules ((guix build guile-build-system)
  207. ,@%gnu-build-system-modules)
  208. #:configure-flags (list (string-append
  209. "--with-guilesitedir="
  210. (assoc-ref %outputs "out")
  211. "/share/guile/site/"
  212. (target-guile-effective-version
  213. (assoc-ref %build-inputs "guile")))
  214. (string-append
  215. "-with-guileextensiondir="
  216. (assoc-ref %outputs "out")
  217. "/lib/guile/"
  218. (target-guile-effective-version
  219. (assoc-ref %build-inputs "guile"))
  220. "/extensions"))
  221. #:phases
  222. (modify-phases %standard-phases
  223. (add-after 'unpack 'patch-undefined-references
  224. (lambda* _
  225. (substitute* "module/curl.scm"
  226. ;; The following #defines are missing from our curl package
  227. ;; and therefore result in the evaluation of undefined symbols.
  228. ((",CURLOPT_HAPROXYPROTOCOL") "#f")
  229. ((",CURLOPT_DISALLOW_USERNAME_IN_URL") "#f")
  230. ((",CURLOPT_TIMEVALUE_LARGE") "#f")
  231. ((",CURLOPT_DNS_SHUFFLE_ADDRESSES") "#f")
  232. ((",CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS") "#f"))))
  233. (add-after 'install 'patch-extension-path
  234. (lambda* (#:key outputs #:allow-other-keys)
  235. (let* ((out (assoc-ref outputs "out"))
  236. (curl.scm (string-append
  237. out "/share/guile/site/"
  238. (target-guile-effective-version)
  239. "/curl.scm"))
  240. (curl.go (string-append
  241. out "/lib/guile/"
  242. (target-guile-effective-version)
  243. "/site-ccache/curl.go"))
  244. (ext (string-append out "/lib/guile/"
  245. (target-guile-effective-version)
  246. "/extensions/libguile-curl")))
  247. (substitute* curl.scm (("libguile-curl") ext))
  248. ;; The build system does not actually compile the Scheme module.
  249. ;; So we can compile it and put it in the right place in one go.
  250. (invoke "guild" "compile" curl.scm "-o" curl.go)))))))
  251. (native-inputs (list pkg-config))
  252. (inputs
  253. (list curl guile-3.0))
  254. (home-page "http://www.lonelycactus.com/guile-curl.html")
  255. (synopsis "Curl bindings for Guile")
  256. (description "@code{guile-curl} is a project that has procedures that allow
  257. Guile to do client-side URL transfers, like requesting documents from HTTP or
  258. FTP servers. It is based on the curl library.")
  259. (license license:gpl3+)))
  260. (define-public guile2.2-curl
  261. (package
  262. (inherit guile-curl)
  263. (name "guile2.2-curl")
  264. (inputs
  265. (list curl guile-2.2))))
  266. (define-public curlpp
  267. (package
  268. (name "curlpp")
  269. (version "0.8.1")
  270. (source
  271. (origin
  272. (method git-fetch)
  273. (uri (git-reference
  274. (url "https://github.com/jpbarrette/curlpp")
  275. (commit (string-append "v" version))))
  276. (sha256
  277. (base32 "1b0ylnnrhdax4kwjq64r1fk0i24n5ss6zfzf4hxwgslny01xiwrk"))
  278. (file-name (git-file-name name version))))
  279. (build-system cmake-build-system)
  280. ;; There are no build tests to be had.
  281. (arguments
  282. '(#:tests? #f))
  283. ;; The installed version needs the header files from the C library.
  284. (propagated-inputs
  285. (list curl))
  286. (synopsis "C++ wrapper around libcURL")
  287. (description
  288. "This package provides a free and easy-to-use client-side C++ URL
  289. transfer library, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT,
  290. FILE and LDAP; in particular it supports HTTPS certificates, HTTP POST, HTTP
  291. PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies,
  292. user+password authentication, file transfer resume, http proxy tunneling and
  293. more!")
  294. (home-page "https://www.curlpp.org")
  295. (license license:expat)))
  296. (define-public h2c
  297. (package
  298. (name "h2c")
  299. (version "1.0")
  300. (source
  301. (origin
  302. (method git-fetch)
  303. (uri (git-reference
  304. (url "https://github.com/curl/h2c")
  305. (commit version)))
  306. (sha256
  307. (base32
  308. "1n8z6avzhg3yb330di2y9zymsps1qp1235p29kidcp4fkmn7fgb2"))
  309. (file-name (git-file-name name version))))
  310. (build-system copy-build-system)
  311. (arguments
  312. '(#:install-plan
  313. '(("./h2c" "bin/"))))
  314. (inputs
  315. (list perl))
  316. (home-page "https://curl.se/h2c/")
  317. (synopsis "Convert HTTP headers to a curl command line")
  318. (description
  319. "Provided a set of HTTP request headers, h2c outputs how to invoke
  320. curl to obtain exactly that HTTP request.")
  321. (license license:expat)))
  322. (define-public coeurl
  323. (package
  324. (name "coeurl")
  325. (version "0.3.0")
  326. (source
  327. (origin
  328. (method git-fetch)
  329. (uri (git-reference
  330. (url "https://nheko.im/nheko-reborn/coeurl")
  331. (commit (string-append "v" version))))
  332. (file-name (git-file-name name version))
  333. (sha256
  334. (base32 "1b435c2szwibm4i4r7mh22klyv9ncdkwkiy95p4xjfalsx4ripxh"))))
  335. (build-system meson-build-system)
  336. (native-inputs
  337. (list doctest pkg-config))
  338. (inputs
  339. (list curl libevent spdlog))
  340. (home-page "https://nheko.im/nheko-reborn/coeurl")
  341. (synopsis "Simple async wrapper around CURL for C++")
  342. (description "Coeurl is a simple library to do HTTP requests
  343. asynchronously via cURL in C++.")
  344. (license license:expat)))
  345. (define-public curlie
  346. (package
  347. (name "curlie")
  348. (version "1.6.9")
  349. (source
  350. (origin
  351. (method git-fetch)
  352. (uri (git-reference
  353. (url "https://github.com/rs/curlie")
  354. (commit (string-append "v" version))))
  355. (file-name (git-file-name name version))
  356. (sha256
  357. (base32
  358. "1b94wfliivfq06i5sf664nhmp3v1k0lpz33cv9lyk6s59awb2hnw"))))
  359. (build-system go-build-system)
  360. (arguments
  361. `(#:import-path "github.com/rs/curlie"))
  362. (inputs (list curl
  363. go-golang-org-x-crypto
  364. go-golang-org-x-sys
  365. go-golang-org-x-term))
  366. (home-page "https://curlie.io")
  367. (synopsis "The power of curl, the ease of use of httpie")
  368. (description "If you like the interface of HTTPie but miss the features of
  369. curl, curlie is what you are searching for. Curlie is a frontend to
  370. @code{curl} that adds the ease of use of @code{httpie}, without compromising
  371. on features and performance. All @code{curl} options are exposed with syntax
  372. sugar and output formatting inspired from @code{httpie}.")
  373. (license license:expat)))
  374. (define-public trurl
  375. (package
  376. (name "trurl")
  377. (version "0.5")
  378. (source
  379. (origin
  380. (method git-fetch)
  381. (uri (git-reference
  382. (url "https://github.com/curl/trurl")
  383. (commit (string-append name "-" version))))
  384. (file-name (git-file-name name version))
  385. (sha256
  386. (base32 "1mvkpjs6wnz5hzmp2iglik85zljrzglsa6fm839l78fhw89dg3w6"))))
  387. (build-system gnu-build-system)
  388. (arguments
  389. (list
  390. #:test-target "test"
  391. #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
  392. (string-append "PREFIX=" #$output))
  393. #:phases
  394. #~(modify-phases %standard-phases
  395. (delete 'configure))))
  396. (native-inputs (list python))
  397. (inputs (list curl))
  398. (home-page "https://curl.se/trurl/")
  399. (synopsis "Command line tool for URL parsing and manipulatio")
  400. (description "@code{trurl} is a tool in a similar spirit of @code{tr} but
  401. for URLs. Here, @code{tr} stands for translate or transpose.
  402. @code{trurl} is a command line tool that parses and manipulates URLs, designed
  403. to help shell script authors everywhere.")
  404. (license (license:non-copyleft "file://COPYING"
  405. "See COPYING in the distribution."))))