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.29")
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 "1rp0wxr3zy7y2xp3azaadfghrx7g0m138f9qg6icjxkkz4vj9r22"))))
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 (("-bpaste") "-dpaste")) ; dpaste blocks tor users
106 #t))
107 (replace 'install
108 (lambda* (#:key outputs #:allow-other-keys)
109 (let* ((out (assoc-ref outputs "out"))
110 (bin (string-append out "/bin"))
111 (zsh (string-append out "/share/zsh/site-functions"))
112 (doc (string-append out "/share/doc/" ,name "-" ,version)))
113 (install-file "wgetpaste" bin)
114 (install-file "_wgetpaste" zsh)
115 (install-file "LICENSE" doc)
116 #t)))
117 (add-after 'install 'wrap-program
118 ;; /bin/wgetpaste prides itself on relying only on the following
119 ;; inputs, and doesn't need to execute arbitrary commands, so
120 ;; override PATH completely to detect any new dependencies early.
121 (lambda* (#:key outputs #:allow-other-keys)
122 (let ((out (assoc-ref outputs "out")))
123 (wrap-program (string-append out "/bin/wgetpaste")
124 `("PATH" ":" =
125 ,(delete-duplicates
126 (map (lambda (command) (dirname (which command)))
127 (list "bash" "mktemp" "sed" "sort" "tee" "tr"
128 "wget" "xclip")))))
129 #t))))
130 #:tests? #f)) ; no test target
131 (inputs
132 `(("wget" ,wget)
133 ("xclip" ,xclip)))
134 (home-page "http://wgetpaste.zlin.dk/")
135 (synopsis "Script that automates pasting to a number of pastebin services")
136 (description
137 "@code{wgetpaste} is an extremely simple command-line interface to various
138 online pastebin services.")
139 (license public-domain)))
140
141 (define-public wget2
142 (package
143 (name "wget2")
144 (version "1.99.1")
145 (source
146 (origin
147 (method git-fetch)
148 (uri (git-reference
149 (url "https://gitlab.com/gnuwget/wget2.git")
150 (commit (string-append name "-" version))
151 (recursive? #t))) ;; Needed for 'gnulib' git submodule.
152 (file-name (string-append name "-" version "-checkout"))
153 (sha256
154 (base32
155 "15wxsnjhc6bzk7f60i1djmsarh1w31gwi5h2gh9k19ncwypfj5dm"))))
156 (build-system gnu-build-system)
157 (arguments
158 `(#:phases
159 (modify-phases %standard-phases
160 (add-after 'unpack 'skip-network-test
161 (lambda _
162 (substitute* "tests/Makefile.am"
163 (("test-auth-digest\\$\\(EXEEXT)") ""))
164 #t))
165 (replace 'bootstrap
166 (lambda _
167 ;; Make sure all the files are writable so that ./bootstrap
168 ;; can proceed.
169 (for-each (lambda (file)
170 (chmod file #o755))
171 (find-files "."))
172 (patch-shebang "./gnulib/gnulib-tool.py")
173 ;; Remove unnecessary inputs from bootstrap.conf
174 (substitute* "bootstrap.conf"
175 (("flex.*") "")
176 (("makeinfo.*") "")
177 (("lzip.*") "")
178 (("rsync.*") ""))
179 (invoke "sh" "./bootstrap"
180 "--gnulib-srcdir=gnulib"
181 "--no-git"))))))
182 (inputs
183 `(("gnutls" ,gnutls/dane)
184 ("libiconv" ,libiconv)
185 ("libidn2" ,libidn2)
186 ("libmicrohttpd" ,libmicrohttpd)
187 ("libpsl" ,libpsl)
188 ("pcre2" ,pcre2)))
189 ;; TODO: Add libbrotlidec, libnghttp2.
190 (native-inputs
191 `(("autoconf" ,autoconf)
192 ("automake" ,automake)
193 ("flex" ,flex)
194 ("gettext" ,gettext-minimal)
195 ("libtool" ,libtool)
196 ("pkg-config" ,pkg-config)
197 ("python" ,python-2)))
198 (home-page "https://gitlab.com/gnuwget/wget2")
199 (synopsis "Successor of GNU Wget")
200 (description "GNU Wget2 is the successor of GNU Wget, a file and recursive
201 website downloader. Designed and written from scratch it wraps around libwget,
202 that provides the basic functions needed by a web client.")
203 (license (list gpl3+ lgpl3+))))