Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / wget.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
6 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages wget)
24 #:use-module (guix licenses)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages autotools)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages documentation)
30 #:use-module (gnu packages flex)
31 #:use-module (gnu packages gettext)
32 #:use-module (gnu packages gnunet)
33 #:use-module (gnu packages libidn)
34 #:use-module (gnu packages pcre)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages tls)
39 #:use-module (gnu packages web)
40 #:use-module (gnu packages xdisorg)
41 #:use-module (guix packages)
42 #:use-module (guix download)
43 #:use-module (guix git-download)
44 #:use-module (guix build-system gnu))
45
46 (define-public wget
47 (package
48 (name "wget")
49 (version "1.20.3")
50 (source
51 (origin
52 (method url-fetch)
53 (uri (string-append "mirror://gnu/wget/wget-"
54 version ".tar.lz"))
55 (sha256
56 (base32
57 "1frajd86ds8vz2hprq30wq8ya89z9dcxnwm8nwk12bbc47l7qq39"))))
58 (build-system gnu-build-system)
59 (inputs
60 `(("gnutls" ,gnutls)
61 ("libidn2" ,libidn2)
62 ("libpsl" ,libpsl)
63 ("lzip" ,lzip)))
64 (native-inputs
65 `(("pkg-config" ,pkg-config)
66 ("perl" ,perl)
67 ("python" ,python) ;for testenv suite
68 ("perl-http-daemon" ,perl-http-daemon)
69 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
70 (home-page "https://www.gnu.org/software/wget/")
71 (synopsis "Non-interactive command-line utility for downloading files")
72 (description
73 "GNU Wget is a non-interactive tool for fetching files using the HTTP,
74 HTTPS and FTP protocols. It can resume interrupted downloads, use file name
75 wild cards, supports proxies and cookies, and it can convert absolute links
76 in downloaded documents to relative links.")
77 (license gpl3+))) ; some files are under GPLv2+
78
79 (define-public wgetpaste
80 (package
81 (name "wgetpaste")
82 (version "2.28")
83 (source
84 (origin
85 (method url-fetch)
86 (uri (string-append "http://wgetpaste.zlin.dk/wgetpaste-"
87 version ".tar.bz2"))
88 (sha256
89 (base32
90 "1hh9svyypqcvdg5mjxyyfzpdzhylhf7s7xq5dzglnm4injx3i3ak"))))
91 (build-system gnu-build-system)
92 (arguments
93 '(#:modules ((guix build gnu-build-system)
94 (guix build utils)
95 (srfi srfi-1))
96 #:phases
97 (modify-phases %standard-phases
98 (delete 'configure)
99 (delete 'build)
100 (add-after 'unpack 'remove-dead-paste-site
101 ;; This phase is adaped from the following patch:
102 ;; https://gitweb.gentoo.org/repo/gentoo.git/tree/app-text/wgetpaste/files/wgetpaste-remove-dead.patch
103 (lambda _
104 (substitute* "wgetpaste"
105 ((" poundpython\"") "\"")
106 (("-poundpython") "-bpaste")) ; dpaste blocks tor users
107 #t))
108 (replace 'install
109 (lambda* (#:key outputs #:allow-other-keys)
110 (let* ((out (assoc-ref outputs "out"))
111 (bin (string-append out "/bin"))
112 (zsh (string-append out "/share/zsh/site-functions")))
113 (install-file "wgetpaste" bin)
114 (install-file "_wgetpaste" zsh)
115 #t)))
116 (add-after 'install 'wrap-program
117 ;; /bin/wgetpaste prides itself on relying only on the following
118 ;; inputs, and doesn't need to execute arbitrary commands, so
119 ;; override PATH completely to detect any new dependencies early.
120 (lambda* (#:key outputs #:allow-other-keys)
121 (let ((out (assoc-ref outputs "out")))
122 (wrap-program (string-append out "/bin/wgetpaste")
123 `("PATH" ":" =
124 ,(delete-duplicates
125 (map (lambda (command) (dirname (which command)))
126 (list "bash" "mktemp" "sed" "sort" "tee" "tr"
127 "wget" "xclip")))))
128 #t))))
129 #:tests? #f)) ; no test target
130 (inputs
131 `(("wget" ,wget)
132 ("xclip" ,xclip)))
133 (home-page "http://wgetpaste.zlin.dk/")
134 (synopsis "Script that automates pasting to a number of pastebin services")
135 (description
136 "@code{wgetpaste} is an extremely simple command-line interface to various
137 online pastebin services.")
138 (license public-domain)))
139
140 (define-public wget2
141 (package
142 (name "wget2")
143 (version "1.99.1")
144 (source
145 (origin
146 (method git-fetch)
147 (uri (git-reference
148 (url "https://gitlab.com/gnuwget/wget2.git")
149 (commit (string-append name "-" version))
150 (recursive? #t))) ;; Needed for 'gnulib' git submodule.
151 (file-name (string-append name "-" version "-checkout"))
152 (sha256
153 (base32
154 "15wxsnjhc6bzk7f60i1djmsarh1w31gwi5h2gh9k19ncwypfj5dm"))))
155 (build-system gnu-build-system)
156 (arguments
157 `(#:phases
158 (modify-phases %standard-phases
159 (add-after 'unpack 'skip-network-test
160 (lambda _
161 (substitute* "tests/Makefile.am"
162 (("test-auth-digest\\$\\(EXEEXT)") ""))
163 #t))
164 (replace 'bootstrap
165 (lambda _
166 ;; Make sure all the files are writable so that ./bootstrap
167 ;; can proceed.
168 (for-each (lambda (file)
169 (chmod file #o755))
170 (find-files "."))
171 (patch-shebang "./gnulib/gnulib-tool.py")
172 ;; Remove unnecessary inputs from bootstrap.conf
173 (substitute* "bootstrap.conf"
174 (("flex.*") "")
175 (("makeinfo.*") "")
176 (("lzip.*") "")
177 (("rsync.*") ""))
178 (invoke "sh" "./bootstrap"
179 "--gnulib-srcdir=gnulib"
180 "--no-git"))))))
181 (inputs
182 `(("gnutls" ,gnutls/dane)
183 ("libiconv" ,libiconv)
184 ("libidn2" ,libidn2)
185 ("libmicrohttpd" ,libmicrohttpd)
186 ("libpsl" ,libpsl)
187 ("pcre2" ,pcre2)))
188 ;; TODO: Add libbrotlidec, libnghttp2.
189 (native-inputs
190 `(("autoconf" ,autoconf)
191 ("automake" ,automake)
192 ("flex" ,flex)
193 ("gettext" ,gettext-minimal)
194 ("libtool" ,libtool)
195 ("pkg-config" ,pkg-config)
196 ("python" ,python-2)))
197 (home-page "https://gitlab.com/gnuwget/wget2")
198 (synopsis "Successor of GNU Wget")
199 (description "GNU Wget2 is the successor of GNU Wget, a file and recursive
200 website downloader. Designed and written from scratch it wraps around libwget,
201 that provides the basic functions needed by a web client.")
202 (license (list gpl3+ lgpl3+))))