summaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorGravatar klea2025-12-30 23:34:13 +0000
committerGravatar klea2025-12-30 23:36:01 +0000
commitaef05ad8343d9c0d6072905fa3623e9adfc597c6 (patch)
tree2607c4d3872529a7686ee1d6bec1df12684ece61 /pkgs
parentpkgs: inherit default (diff)
signature
pkgs(warcPackages.wget-lua): init
Imported from https://gist.github.com/OrIdow6/d864d870ac7aef42bbea92af4debbc81 under GPL-3.0-or-later
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/default.nix1
-rw-r--r--pkgs/warcPackages/wget-lua/default.nix214
2 files changed, 215 insertions, 0 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 3231cc0..4c55947 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -13,6 +13,7 @@ lib.makeScope newScope (self: {
};
wikibot = self.callPackage ./wikibot { };
wikiteam = self.callPackage ./wikiteam { };
+ warcPackages = self.callPackage ./warcPackages { };
little-things = self.callPackage ./little-things { };
diff --git a/pkgs/warcPackages/wget-lua/default.nix b/pkgs/warcPackages/wget-lua/default.nix
new file mode 100644
index 0000000..fc2b24a
--- /dev/null
+++ b/pkgs/warcPackages/wget-lua/default.nix
@@ -0,0 +1,214 @@
+# SPDX-FileCopyrightText: 2025 OrIdow6
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+{
+ basex,
+ autoconf-archive,
+ autoreconfHook,
+ c-ares,
+ coreutils,
+ fetchFromGitHub,
+ fetchurl,
+ flex,
+ gettext,
+ gnulib,
+ gnutls,
+ gperf,
+ lib,
+ libiconv,
+ libidn2,
+ libintl,
+ libpsl,
+ libuuid,
+ lua51Packages,
+ lzip,
+ makeBinaryWrapper,
+ nukeReferences,
+ pcre2,
+ perlPackages,
+ pkg-config,
+ stdenv,
+ texinfo,
+ writeText,
+ zlib,
+ zstd,
+}:
+
+let
+ luaEnv = lua51Packages.lua.withPackages (
+ ps: with ps; [
+ luasocket
+ luafilesystem
+ luasec
+ luazip
+ #crc32
+ #md5
+ #base64
+ cjson
+ # luautf8 is a newer version of utf8;
+ # the canonical DF uses the latter
+ # so I assemble it manually here,
+ # but I import the former anyway
+ # -- OrIdow6
+ (buildLuarocksPackage {
+ pname = "utf8";
+ version = "0.2.0-1";
+ knownRockspec =
+ (fetchurl {
+ url = "mirror://luarocks/utf8-1.3-0.rockspec";
+ sha256 = "sha256-V4otUR+uDIHTIBgfdgmdgMG4Y3knZ+w5ztv7EhbP+us=";
+ }).outPath;
+ src = fetchFromGitHub {
+ owner = "dannote";
+ repo = "luautf8";
+ rev = "f36cc914ae9015cd3045987abadd83bbcfae98f0";
+ sha256 = "sha256-xLWqglAzqcxY+R8GOC+D3uzL2+9ZriEx8Kj41LkI5vU=";
+ };
+
+ disabled = luaOlder "5.1";
+
+ meta = {
+ homepage = "https://github.com/dannote/luautf8";
+ description = "A UTF-8 support module for Lua";
+ license = lib.licenses.mit;
+ };
+ })
+ luautf8
+ luabitop
+ bit32
+ luaossl
+ zlib
+ basex
+ ]
+ );
+in
+stdenv.mkDerivation {
+ pname = "wget-at";
+ version = "1.21.3-at";
+
+ src = fetchFromGitHub {
+ owner = "archiveteam";
+ repo = "wget-lua";
+ rev = "ac45a2f1a7d19a01032822e438f549262e77eca0";
+ hash = "sha256-/04FxG2EHNAzORCupl1XN3kSxNQMS2UW0L8LGWRcM98=";
+ };
+
+ preConfigure = ''
+ patchShebangs doc
+ '';
+
+ nativeBuildInputs = [
+ gettext
+ pkg-config
+ perlPackages.perl
+ lzip
+ nukeReferences
+ autoreconfHook
+ autoconf-archive
+ flex
+ gperf
+ texinfo
+ makeBinaryWrapper
+ ];
+ buildInputs = [
+ libidn2
+ zlib
+ pcre2
+ libuuid
+ libiconv
+ libintl
+ luaEnv
+ c-ares
+ zstd
+ gnutls
+ libpsl
+ gnulib
+ ];
+
+ # Taken from the wget2.nix in nixpkgs
+ autoreconfPhase = ''
+ # copy gnulib into build dir and make writable.
+ # Otherwise ./bootstrap copies the non-writable files from nix store and fails to modify them
+ rmdir gnulib
+ cp -r ${gnulib} gnulib
+ chmod -R u+w gnulib/{build-aux,lib}
+
+ ./bootstrap --no-git --gnulib-srcdir=gnulib --skip-po
+ '';
+
+ strictDeps = true;
+
+ configureFlags = [
+ "--with-cares"
+ ];
+
+ preBuild = ''
+ # avoid runtime references to build-only depends
+ make -C src version.c
+ nuke-refs src/version.c
+ '';
+
+ patches = [
+ (writeText "lua-search-for-cmake-package.patch" ''
+ diff --git a/configure.ac b/configure.ac
+ index 8e0a8a9b..63dd1d22 100644
+ --- a/configure.ac
+ +++ b/configure.ac
+ @@ -1053,6 +1053,11 @@ AS_IF(
+
+ AS_IF(
+ [test "X$enable_luajit" != "Xyes"],
+ + [PKG_CHECK_MODULES([LUA], lua5.1, [
+ + CFLAGS="$LUA_CFLAGS $CFLAGS"
+ + LIBS="$LUA_LIBS $LIBS"
+ + AC_DEFINE([ENABLE_LUA], 1, [Define if Lua is available.])
+ + ],
+ [
+ AC_CHECK_HEADER(
+ lua5.1/lua.h,
+ @@ -1072,6 +1077,8 @@ AS_IF(
+ AC_MSG_ERROR([lua not found])
+ )
+ ]
+ + )
+ + ]
+ )
+
+ AS_IF(
+ '')
+ # I cannot figure out why it tries to "make" something in this directory *after* the main wget binary is built, which then crashes for reasons I also don't understand. So just ignoring it for now. This also happens if I try to run the vanilla wget build here from Git instead of from the release tarball.
+ (writeText "do-not-make-gnulib-po.patch" ''
+ diff --git a/Makefile.am b/Makefile.am
+ index 5e3f1d18..d9f64bd4 100644
+ --- a/Makefile.am
+ +++ b/Makefile.am
+ @@ -40,7 +40,7 @@ distuninstallcheck_listfiles = find . -type f | \
+ ACLOCAL_AMFLAGS = -I m4
+
+ # subdirectories in the distribution
+ -SUBDIRS = lib src doc po gnulib_po util fuzz tests testenv
+ +SUBDIRS = lib src doc po util fuzz tests testenv
+
+ EXTRA_DIST = MAILING-LIST \
+ msdos/config.h msdos/Makefile.DJ \
+
+ '')
+ ];
+
+ postInstall = ''
+ wrapProgram $out/bin/wget \
+ --prefix LUA_CPATH ';' "${luaEnv}/lib/lua/${luaEnv.luaversion}/?.so" \
+ --prefix LUA_PATH ';' "${luaEnv}/share/lua/${luaEnv.luaversion}/?.lua" \
+ --prefix PATH ':' ${lib.makeBinPath [ coreutils ]} # For sleep, but bring in the other programs too in case something uses them
+ '';
+
+ enableParallelBuilding = true;
+
+ meta = {
+ description = "Tool for retrieving files using HTTP, HTTPS, and FTP AT version";
+ homepage = "https://www.gnu.org/software/wget/";
+ license = lib.licenses.gpl3Plus;
+ mainProgram = "wget";
+ platforms = lib.platforms.all;
+ };
+}