Skip to content

Commit

Permalink
zsync: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ryand56 committed Dec 31, 2024
1 parent a74b82f commit 628d263
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 10 deletions.
32 changes: 22 additions & 10 deletions pkgs/by-name/zs/zsync/package.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
{
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" ];

env = lib.optionalAttrs stdenv.cc.isGNU {
NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
};

nativeBuildInputs = [
autoreconfHook
];

meta = with lib; {
homepage = "http://zsync.moria.org.uk/";
description = "File distribution system using the rsync algorithm";
Expand Down
13 changes: 13 additions & 0 deletions pkgs/by-name/zs/zsync/read-blocksums-declaration-fix.patch
Original file line number Diff line number Diff line change
@@ -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);
17 changes: 17 additions & 0 deletions pkgs/by-name/zs/zsync/remove-inexisting-rsumtest.patch
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 628d263

Please sign in to comment.