2023-01-11 07:51:40 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
|
|
|
, gtest
|
|
|
|
, pkg-config
|
|
|
|
, zlib
|
|
|
|
, bzip2
|
|
|
|
, xz
|
|
|
|
, zstd
|
|
|
|
, openssl
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "minizip-ng";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "4.0.3";
|
2023-01-11 07:51:40 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zlib-ng";
|
|
|
|
repo = finalAttrs.pname;
|
|
|
|
rev = finalAttrs.version;
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-rP3WficGQZ2sSYnU9Tj0lVl36ShwV76fn/1lv+TrK2c=";
|
2023-01-11 07:51:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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"
|
2024-01-02 11:29:13 +00:00
|
|
|
"-DMZ_BUILD_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
|
|
|
|
"-DMZ_BUILD_UNIT_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
|
2023-07-15 17:15:38 +00:00
|
|
|
"-DMZ_LIB_SUFFIX='-ng'"
|
2023-01-11 07:51:40 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# missing header file
|
|
|
|
"-DMZ_LIBCOMP=OFF"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# make lib findable as libminizip-ng even if compat is enabled
|
|
|
|
for ext in so dylib a ; do
|
|
|
|
if [ -e $out/lib/libminizip.$ext ] && [ ! -e $out/lib/libminizip-ng.$ext ]; then
|
|
|
|
ln -s $out/lib/libminizip.$ext $out/lib/libminizip-ng.$ext
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ ! -e $out/include/minizip-ng ]; then
|
|
|
|
ln -s $out/include $out/include/minizip-ng
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ gtest ];
|
2023-01-11 07:51:40 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
})
|