lol
1{ lib
2, stdenv
3, fetchFromGitLab
4 # build support
5, autoreconfHook
6, flex
7, gnulib
8, pkg-config
9, texinfo
10 # libraries
11, brotli
12, bzip2
13, darwin
14, gpgme
15, libhsts
16, libidn2
17, libpsl
18, lzip
19, nghttp2
20, openssl
21, pcre2
22, sslSupport ? true
23, xz
24, zlib
25, zstd
26}:
27
28stdenv.mkDerivation rec {
29 pname = "wget2";
30 version = "2.1.0";
31
32 outputs = [ "out" "lib" "dev" ];
33
34 src = fetchFromGitLab {
35 owner = "gnuwget";
36 repo = pname;
37 rev = "v${version}";
38 sha256 = "sha256-+xw1nQMBs0m9RlunyrAYaSDPnLY1yRX8zt8hKOMXQT8=";
39 };
40
41 # wget2_noinstall contains forbidden reference to /build/
42 postPatch = ''
43 substituteInPlace src/Makefile.am \
44 --replace "bin_PROGRAMS = wget2 wget2_noinstall" "bin_PROGRAMS = wget2"
45 '';
46
47 strictDeps = true;
48
49 nativeBuildInputs = [
50 autoreconfHook
51 flex
52 lzip
53 pkg-config
54 texinfo
55 ];
56
57 buildInputs = [
58 brotli
59 bzip2
60 gpgme
61 libhsts
62 libidn2
63 libpsl
64 nghttp2
65 pcre2
66 xz
67 zlib
68 zstd
69 ] ++ lib.optionals sslSupport [
70 openssl
71 ] ++ lib.optionals stdenv.isDarwin [
72 darwin.apple_sdk.frameworks.CoreServices
73 ];
74
75 # TODO: include translation files
76 autoreconfPhase = ''
77 # copy gnulib into build dir and make writable.
78 # Otherwise ./bootstrap copies the non-writable files from nix store and fails to modify them
79 rmdir gnulib
80 cp -r ${gnulib} gnulib
81 chmod -R u+w gnulib/{build-aux,lib}
82
83 ./bootstrap --no-git --gnulib-srcdir=gnulib --skip-po
84 '';
85
86 configureFlags = [
87 (lib.enableFeature false "shared")
88 # TODO: https://gitlab.com/gnuwget/wget2/-/issues/537
89 (lib.withFeatureAs sslSupport "ssl" "openssl")
90 ];
91
92 meta = with lib; {
93 description = "successor of GNU Wget, a file and recursive website downloader.";
94 longDescription = ''
95 Designed and written from scratch it wraps around libwget, that provides the basic
96 functions needed by a web client.
97 Wget2 works multi-threaded and uses many features to allow fast operation.
98 In many cases Wget2 downloads much faster than Wget1.x due to HTTP2, HTTP compression,
99 parallel connections and use of If-Modified-Since HTTP header.
100 '';
101 homepage = "https://gitlab.com/gnuwget/wget2";
102 # wget2 GPLv3+; libwget LGPLv3+
103 license = with licenses; [ gpl3Plus lgpl3Plus ];
104 maintainers = with maintainers; [ SuperSandro2000 ];
105 };
106}