gnu: wgetpaste: Remove dead paste site.
[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 python)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages web)
37 #:use-module (gnu packages pcre)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages tls)
40 #:use-module (guix packages)
41 #:use-module (guix download)
42 #:use-module (guix git-download)
43 #:use-module (guix build-system gnu))
44
45 (define-public wget
46 (package
47 (name "wget")
48 (version "1.20.1")
49 (source
50 (origin
51 (method url-fetch)
52 (uri (string-append "mirror://gnu/wget/wget-"
53 version ".tar.lz"))
54 (sha256
55 (base32
56 "0a29qsqxkk8145vkyy35q5a1wc7qzwx3qj3gmfrkmi9xs96yhqqg"))))
57 (build-system gnu-build-system)
58 (inputs
59 `(("gnutls" ,gnutls)
60 ("libidn2" ,libidn2)
61 ("libpsl" ,libpsl)
62 ("lzip" ,lzip)))
63 (native-inputs
64 `(("pkg-config" ,pkg-config)
65 ("perl" ,perl)
66 ("python" ,python) ;for testenv suite
67 ("perl-http-daemon" ,perl-http-daemon)
68 ("perl-io-socket-ssl" ,perl-io-socket-ssl)))
69 (home-page "https://www.gnu.org/software/wget/")
70 (synopsis "Non-interactive command-line utility for downloading files")
71 (description
72 "GNU Wget is a non-interactive tool for fetching files using the HTTP,
73 HTTPS and FTP protocols. It can resume interrupted downloads, use file name
74 wild cards, supports proxies and cookies, and it can convert absolute links
75 in downloaded documents to relative links.")
76 (license gpl3+))) ; some files are under GPLv2+
77
78 (define-public wgetpaste
79 (package
80 (name "wgetpaste")
81 (version "2.28")
82 (source
83 (origin
84 (method url-fetch)
85 (uri (string-append "http://wgetpaste.zlin.dk/wgetpaste-"
86 version ".tar.bz2"))
87 (sha256
88 (base32
89 "1hh9svyypqcvdg5mjxyyfzpdzhylhf7s7xq5dzglnm4injx3i3ak"))))
90 (build-system gnu-build-system)
91 (arguments
92 '(#:modules ((guix build gnu-build-system)
93 (guix build utils)
94 (srfi srfi-1))
95 #:phases
96 (modify-phases %standard-phases
97 (delete 'configure)
98 (delete 'build)
99 (add-after 'unpack 'remove-dead-paste-site
100 ;; This phase is adaped from the following patch:
101 ;; https://gitweb.gentoo.org/repo/gentoo.git/tree/app-text/wgetpaste/files/wgetpaste-remove-dead.patch
102 (lambda _
103 (substitute* "wgetpaste"
104 ((" poundpython\"") "\"")
105 (("-poundpython") "-dpaste"))
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 (install-file "wgetpaste" bin)
113 (install-file "_wgetpaste" zsh)
114 #t)))
115 (add-after 'install 'wrap-program
116 ;; /bin/wgetpaste prides itself on relying only on the following
117 ;; inputs, and doesn't need to execute arbitrary commands, so
118 ;; override PATH completely to detect any new dependencies early.
119 (lambda* (#:key outputs #:allow-other-keys)
120 (let ((out (assoc-ref outputs "out")))
121 (wrap-program (string-append out "/bin/wgetpaste")
122 `("PATH" ":" =
123 ,(delete-duplicates
124 (map (lambda (command) (dirname (which command)))
125 (list "bash" "mktemp" "sed" "sort" "tee" "tr"
126 "wget")))))
127 #t))))
128 #:tests? #f)) ; no test target
129 (inputs
130 `(("wget" ,wget)))
131 (home-page "http://wgetpaste.zlin.dk/")
132 (synopsis "Script that automates pasting to a number of pastebin services")
133 (description
134 "@code{wgetpaste} is an extremely simple command-line interface to various
135 online pastebin services.")
136 (license public-domain)))
137
138 (define-public wget2
139 (package
140 (name "wget2")
141 (version "1.99.1")
142 (source
143 (origin
144 (method git-fetch)
145 (uri (git-reference
146 (url "https://gitlab.com/gnuwget/wget2.git")
147 (commit (string-append name "-" version))
148 (recursive? #t))) ;; Needed for 'gnulib' git submodule.
149 (file-name (string-append name "-" version "-checkout"))
150 (sha256
151 (base32
152 "15wxsnjhc6bzk7f60i1djmsarh1w31gwi5h2gh9k19ncwypfj5dm"))))
153 (build-system gnu-build-system)
154 (arguments
155 `(#:phases
156 (modify-phases %standard-phases
157 (add-after 'unpack 'skip-network-test
158 (lambda _
159 (substitute* "tests/Makefile.am"
160 (("test-auth-digest\\$\\(EXEEXT)") ""))
161 #t))
162 (replace 'bootstrap
163 (lambda _
164 ;; Make sure all the files are writable so that ./bootstrap
165 ;; can proceed.
166 (for-each (lambda (file)
167 (chmod file #o755))
168 (find-files "."))
169 (patch-shebang "./gnulib/gnulib-tool.py")
170 ;; Remove unnecessary inputs from bootstrap.conf
171 (substitute* "bootstrap.conf"
172 (("flex.*") "")
173 (("makeinfo.*") "")
174 (("lzip.*") "")
175 (("rsync.*") ""))
176 (invoke "sh" "./bootstrap"
177 "--gnulib-srcdir=gnulib"
178 "--no-git"))))))
179 (inputs
180 `(("gnutls" ,gnutls/dane)
181 ("libiconv" ,libiconv)
182 ("libidn2" ,libidn2)
183 ("libmicrohttpd" ,libmicrohttpd)
184 ("libpsl" ,libpsl)
185 ("pcre2" ,pcre2)))
186 ;; TODO: Add libbrotlidec, libnghttp2.
187 (native-inputs
188 `(("autoconf" ,autoconf)
189 ("automake" ,automake)
190 ("flex" ,flex)
191 ("gettext" ,gettext-minimal)
192 ("libtool" ,libtool)
193 ("pkg-config" ,pkg-config)
194 ("python" ,python-2)))
195 (home-page "https://gitlab.com/gnuwget/wget2")
196 (synopsis "Successor of GNU Wget")
197 (description "GNU Wget2 is the successor of GNU Wget, a file and recursive
198 website downloader. Designed and written from scratch it wraps around libwget,
199 that provides the basic functions needed by a web client.")
200 (license (list gpl3+ lgpl3+))))