1 { lib, stdenv, fetchurl, fetchpatch, gettext, pkg-config, perlPackages
2 , libidn2, zlib, pcre, libuuid, libiconv, libintl
3 , python3, lzip, darwin
4 , withLibpsl ? false, libpsl
5 , withOpenssl ? true, openssl
8 stdenv.mkDerivation rec {
13 url = "mirror://gnu/wget/wget-${version}.tar.lz";
14 hash = "sha256-V6EHFR5O+U/flK/+z6xZiWPzcvEyk+2cdAMhBTkLNu4=";
18 ./remove-runtime-dep-on-openssl-headers.patch
20 name = "CVE-2024-38428.patch";
21 url = "https://git.savannah.gnu.org/cgit/wget.git/patch/?id=ed0c7c7e0e8f7298352646b2fd6e06a11e242ace";
22 hash = "sha256-4ZVPufgG/h0UkxF9hQBAtF6QAG4GEz9hHeqEsD47q4U=";
30 nativeBuildInputs = [ gettext pkg-config perlPackages.perl lzip libiconv libintl ];
31 buildInputs = [ libidn2 zlib pcre libuuid ]
32 ++ lib.optional withOpenssl openssl
33 ++ lib.optional withLibpsl libpsl
34 ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.CoreServices perlPackages.perl ];
37 (lib.withFeatureAs withOpenssl "ssl" "openssl")
38 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
39 # https://lists.gnu.org/archive/html/bug-wget/2021-01/msg00076.html
40 "--without-included-regex"
43 __darwinAllowLocalNetworking = true;
46 patchShebangs tests fuzz
48 # Work around lack of DNS resolution in chroots.
49 for i in "tests/"*.pm "tests/"*.px
51 sed -i "$i" -e's/localhost/127.0.0.1/g'
53 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
54 # depending on the underlying filesystem, some tests
55 # creating exotic file names fail
56 for f in tests/Test-ftp-iri.px \
57 tests/Test-ftp-iri-fallback.px \
58 tests/Test-ftp-iri-recursive.px \
59 tests/Test-ftp-iri-disabled.px \
60 tests/Test-iri-disabled.px \
61 tests/Test-iri-list.px ;
63 # just return magic "skip" exit code 77
64 sed -i 's/^exit/exit 77 #/' $f
68 perlPackages.HTTPDaemon
70 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
71 perlPackages.IOSocketSSL
75 description = "Tool for retrieving files using HTTP, HTTPS, and FTP";
76 homepage = "https://www.gnu.org/software/wget/";
77 license = licenses.gpl3Plus;
79 '' GNU Wget is a free software package for retrieving files using HTTP,
80 HTTPS and FTP, the most widely-used Internet protocols. It is a
81 non-interactive commandline tool, so it may easily be called from
82 scripts, cron jobs, terminals without X-Windows support, etc.
85 maintainers = with maintainers; [ fpletz ];
86 platforms = platforms.all;