about summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorNicolas Benes <nbenes.gh@xandea.de>2022-12-11 18:32:11 +0100
committerNicolas Benes <nbenes.gh@xandea.de>2022-12-29 00:27:03 +0100
commitc20107f507e81d18f47f7b39e141f9939d600daa (patch)
treef73e76a88bdf8e7bb53766273cdd9697841bacda /pkgs/development/libraries
parenta61b8298e0cac7364003c208047835987c051c4b (diff)
minizip2 -> minzip-ng: 2.10.6 -> 3.0.7
* The repository has been moved. The old URL
  https://github.com/nmoinvaz/minizip redirects to
  https://github.com/zlib-ng/minizip-ng
* Enable unit tests
* Make lib findable as libminizip-ng even if compat is enabled
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/minizip-ng/default.nix77
-rw-r--r--pkgs/development/libraries/minizip2/default.nix30
2 files changed, 77 insertions, 30 deletions
diff --git a/pkgs/development/libraries/minizip-ng/default.nix b/pkgs/development/libraries/minizip-ng/default.nix
new file mode 100644
index 0000000000000..8f12dc29784e6
--- /dev/null
+++ b/pkgs/development/libraries/minizip-ng/default.nix
@@ -0,0 +1,77 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, gtest
+, pkg-config
+, zlib
+, bzip2
+, xz
+, zstd
+, openssl
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "minizip-ng";
+  version = "3.0.7";
+
+  src = fetchFromGitHub {
+    owner = "zlib-ng";
+    repo = finalAttrs.pname;
+    rev = finalAttrs.version;
+    sha256 = "sha256-m/zSVx8vYzLA23Cusd1p/ZSGd1mV3gM6UqDnmEXqpq4=";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "find-system-gtest.patch";
+      url = "https://github.com/zlib-ng/minizip-ng/commit/be23c8d3b7e2cb5ba619e60517cad277ee510fb7.patch";
+      sha256 = "sha256-azwrGj6kgTyTepGAmOlxDOFOwJKQE5J2bwUIn6sgKUY=";
+    })
+
+    # otherwise signing unit tests fail
+    (fetchpatch {
+      name = "disable-mz-signing-by-default.patch";
+      url = "https://github.com/zlib-ng/minizip-ng/commit/60649ada97581afc0bc2fffc50ce402ff1e6df5d.patch";
+      sha256 = "sha256-bHGM4H8RPYkfAjxcS1bPohR9IFOFT0Mx4Mg34UnnD+w=";
+    })
+  ];
+
+  nativeBuildInputs = [ cmake pkg-config ];
+  buildInputs = [ zlib bzip2 xz zstd openssl ];
+
+  cmakeFlags = [
+    "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
+    "-DMZ_OPENSSL=ON"
+    "-DMZ_BUILD_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
+    "-DMZ_BUILD_UNIT_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
+  ] ++ lib.optionals stdenv.isDarwin [
+    # missing header file
+    "-DMZ_LIBCOMP=OFF"
+  ];
+
+  postInstall = let
+    libext = if stdenv.hostPlatform.isStatic then ".a" else ".so";
+  in ''
+    # make lib findable as libminizip-ng even if compat is enabled
+    if [ ! -e $out/lib/libminizip-ng${libext} ]; then
+      ln -s $out/lib/libminizip${libext} $out/lib/libminizip-ng${libext}
+    fi
+    if [ ! -e $out/include/minizip-ng ]; then
+      ln -s $out/include $out/include/minizip-ng
+    fi
+  '';
+
+  doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
+  checkInputs = [ gtest ];
+  enableParallelChecking = false;
+
+  meta = with lib; {
+    description = "Fork of the popular zip manipulation library found in the zlib distribution";
+    homepage = "https://github.com/zlib-ng/minizip-ng";
+    license = licenses.zlib;
+    maintainers = with maintainers; [ gebner ris ];
+    platforms = platforms.unix;
+  };
+})
diff --git a/pkgs/development/libraries/minizip2/default.nix b/pkgs/development/libraries/minizip2/default.nix
deleted file mode 100644
index 591bb8c8dc3af..0000000000000
--- a/pkgs/development/libraries/minizip2/default.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, zlib, bzip2, xz, zstd, openssl }:
-
-stdenv.mkDerivation rec {
-  pname = "minizip";
-  version = "2.10.6";
-
-  src = fetchFromGitHub {
-    owner = "nmoinvaz";
-    repo = pname;
-    rev = version;
-    sha256 = "sha256-OAm4OZeQdP2Q/UKYI9bR7OV9RmLmYF/j2NpK5TPoE60=";
-  };
-
-  nativeBuildInputs = [ cmake pkg-config ];
-
-  cmakeFlags = [
-    "-DBUILD_SHARED_LIBS=YES"
-    "-DMZ_OPENSSL=ON"
-  ];
-
-  buildInputs = [ zlib bzip2 xz zstd openssl ];
-
-  meta = with lib; {
-    description = "Compression library implementing the deflate compression method found in gzip and PKZIP";
-    homepage = "https://github.com/nmoinvaz/minizip";
-    license = licenses.zlib;
-    maintainers = with maintainers; [ gebner ];
-    platforms = platforms.unix;
-  };
-}