zsync: fix build

This commit is contained in:
Ryan Omasta
2024-12-31 06:02:34 -07:00
parent 309e8a5e50
commit 4dc5494473
3 changed files with 60 additions and 10 deletions
+30 -10
View File
@@ -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";
@@ -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);
@@ -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