nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv
2, cmake
3, fetchurl
4, perl
5, zlib
6, groff
7, withBzip2 ? false
8, bzip2
9, withLZMA ? false
10, xz
11, withOpenssl ? false
12, openssl
13, withZstd ? false
14, zstd
15, testers
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "libzip";
20 version = "1.9.2";
21
22 src = fetchurl {
23 url = "https://libzip.org/download/${finalAttrs.pname}-${finalAttrs.version}.tar.gz";
24 sha256 = "sha256-/Wp/dF3j1pz1YD7cnLM9KJDwGY5BUlXQmHoM8Q2CTG8=";
25 };
26
27 outputs = [ "out" "dev" "man" ];
28
29 nativeBuildInputs = [ cmake perl groff ];
30 propagatedBuildInputs = [ zlib ];
31 buildInputs = lib.optionals withLZMA [ xz ]
32 ++ lib.optionals withBzip2 [ bzip2 ]
33 ++ lib.optionals withOpenssl [ openssl ]
34 ++ lib.optionals withZstd [ zstd ];
35
36 # Don't build the regression tests because they don't build with
37 # pkgsStatic and are not executed anyway.
38 cmakeFlags = [ "-DBUILD_REGRESS=0" ];
39
40 preCheck = ''
41 # regress/runtest is a generated file
42 patchShebangs regress
43 '';
44
45 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
46
47 meta = with lib; {
48 homepage = "https://libzip.org/";
49 description = "A C library for reading, creating and modifying zip archives";
50 license = licenses.bsd3;
51 pkgConfigModules = [ "libzip" ];
52 platforms = platforms.unix;
53 changelog = "https://github.com/nih-at/libzip/blob/v${version}/NEWS.md";
54 };
55})