From 4dc54944730bb719cae22668d587ebfa104b2661 Mon Sep 17 00:00:00 2001 From: Ryan Omasta Date: Mon, 30 Dec 2024 14:54:02 -0700 Subject: [PATCH] zsync: fix build --- pkgs/by-name/zs/zsync/package.nix | 40 ++++++++++++++----- .../read-blocksums-declaration-fix.patch | 13 ++++++ .../zs/zsync/remove-inexisting-rsumtest.patch | 17 ++++++++ 3 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 pkgs/by-name/zs/zsync/read-blocksums-declaration-fix.patch create mode 100644 pkgs/by-name/zs/zsync/remove-inexisting-rsumtest.patch diff --git a/pkgs/by-name/zs/zsync/package.nix b/pkgs/by-name/zs/zsync/package.nix index d4f57f0a750c..d0ea03519de4 100644 --- a/pkgs/by-name/zs/zsync/package.nix +++ b/pkgs/by-name/zs/zsync/package.nix @@ -1,26 +1,46 @@ { lib, stdenv, - fetchurl, + fetchFromGitHub, + autoreconfHook, }: stdenv.mkDerivation rec { pname = "zsync"; - version = "0.6.2"; + version = "0.6.2-unstable-2017-04-25"; - src = fetchurl { - url = "http://zsync.moria.org.uk/download/zsync-${version}.tar.bz2"; - hash = "sha256-C51TQzOHqk8EY0psY6XvqCAwcPIpivcqcF+b492mWvI="; + src = fetchFromGitHub { + owner = "cph6"; + repo = "zsync"; + rev = "6cfe374f8f2310cbd624664ca98e5bb28244ba7a"; + hash = "sha256-SnCzNDMyhMx+2JmgsrjtYDa31Ki1EWix9iBfaduDnro="; }; - env = lib.optionalAttrs stdenv.cc.isClang { - # Suppress error "call to undeclared library function 'strcasecmp'" during compilation. - # The function is found by the linker correctly, so this doesn't introduce any issues. - NIX_CFLAGS_COMPILE = " -Wno-implicit-function-declaration"; - }; + sourceRoot = "${src.name}/c"; + + patches = [ + ./remove-inexisting-rsumtest.patch + ./read-blocksums-declaration-fix.patch + ]; makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ]; + # Suppress error "call to undeclared library function 'strcasecmp'" during compilation. + # The function is found by the linker correctly, so this doesn't introduce any issues. + # Also supress errors that come from incompatible pointer types due to GCC 14 changes. + env.NIX_CFLAGS_COMPILE = toString ( + lib.optionals stdenv.cc.isClang [ + "-Wno-implicit-function-declaration" + ] + ++ lib.optionals stdenv.cc.isGNU [ + "-Wno-error=incompatible-pointer-types" + ] + ); + + nativeBuildInputs = [ + autoreconfHook + ]; + meta = with lib; { homepage = "http://zsync.moria.org.uk/"; description = "File distribution system using the rsync algorithm"; diff --git a/pkgs/by-name/zs/zsync/read-blocksums-declaration-fix.patch b/pkgs/by-name/zs/zsync/read-blocksums-declaration-fix.patch new file mode 100644 index 000000000000..d4e8e638af49 --- /dev/null +++ b/pkgs/by-name/zs/zsync/read-blocksums-declaration-fix.patch @@ -0,0 +1,13 @@ +diff --git a/libzsync/zsync.c b/libzsync/zsync.c +index 793a426..783c349 100644 +--- a/libzsync/zsync.c ++++ b/libzsync/zsync.c +@@ -116,7 +116,7 @@ struct zsync_state { + }; + + static int zsync_read_blocksums(struct zsync_state *zs, FILE * f, +- int rsum_bytes, int checksum_bytes, ++ int rsum_bytes, unsigned int checksum_bytes, + int seq_matches); + static int zsync_sha1(struct zsync_state *zs, int fh); + static int zsync_recompress(struct zsync_state *zs); diff --git a/pkgs/by-name/zs/zsync/remove-inexisting-rsumtest.patch b/pkgs/by-name/zs/zsync/remove-inexisting-rsumtest.patch new file mode 100644 index 000000000000..2e16b58d1f8a --- /dev/null +++ b/pkgs/by-name/zs/zsync/remove-inexisting-rsumtest.patch @@ -0,0 +1,17 @@ +diff --git a/c/librcksum/Makefile.am b/c/librcksum/Makefile.am +index 0216e49..f4fce72 100644 +--- a/librcksum/Makefile.am ++++ b/librcksum/Makefile.am +@@ -2,9 +2,8 @@ + + noinst_LIBRARIES = librcksum.a + +-TESTS = md4test rsumtest +-noinst_PROGRAMS = md4test rsumtest ++TESTS = md4test ++noinst_PROGRAMS = md4test + + md4test_SOURCES = md4test.c md4.h md4.c +-rsumtest_SOURCES = rsum.c rsumtest.c hash.c range.c state.c md4.c ../progress.c + librcksum_a_SOURCES = internal.h rcksum.h md4.h rsum.c hash.c state.c range.c md4.c +