nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
5, cmake
6, gtest
7, pkg-config
8, zlib
9, bzip2
10, xz
11, zstd
12, openssl
13}:
14
15stdenv.mkDerivation (finalAttrs: {
16 pname = "minizip-ng";
17 version = "3.0.10";
18
19 src = fetchFromGitHub {
20 owner = "zlib-ng";
21 repo = finalAttrs.pname;
22 rev = finalAttrs.version;
23 sha256 = "sha256-ynYAWF570S6MpD1WXbUC3cu+chL3+AhsMHr15l+LYVg=";
24 };
25
26 nativeBuildInputs = [ cmake pkg-config ];
27 buildInputs = [ zlib bzip2 xz zstd openssl ];
28
29 cmakeFlags = [
30 "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
31 "-DMZ_OPENSSL=ON"
32 "-DMZ_BUILD_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
33 "-DMZ_BUILD_UNIT_TESTS=${if finalAttrs.doCheck then "ON" else "OFF"}"
34 ] ++ lib.optionals stdenv.isDarwin [
35 # missing header file
36 "-DMZ_LIBCOMP=OFF"
37 ];
38
39 postInstall = ''
40 # make lib findable as libminizip-ng even if compat is enabled
41 for ext in so dylib a ; do
42 if [ -e $out/lib/libminizip.$ext ] && [ ! -e $out/lib/libminizip-ng.$ext ]; then
43 ln -s $out/lib/libminizip.$ext $out/lib/libminizip-ng.$ext
44 fi
45 done
46 if [ ! -e $out/include/minizip-ng ]; then
47 ln -s $out/include $out/include/minizip-ng
48 fi
49 '';
50
51 doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
52 nativeCheckInputs = [ gtest ];
53 enableParallelChecking = false;
54
55 meta = with lib; {
56 description = "Fork of the popular zip manipulation library found in the zlib distribution";
57 homepage = "https://github.com/zlib-ng/minizip-ng";
58 license = licenses.zlib;
59 maintainers = with maintainers; [ gebner ris ];
60 platforms = platforms.unix;
61 };
62})