1{ lib, stdenv, fetchFromGitHub, fetchzip
2, meson, ninja, pkg-config
3, python3
4, icu
5, libuuid
6, xapian
7, xz
8, zstd
9, gtest
10}:
11
12stdenv.mkDerivation rec {
13 pname = "zimlib";
14 version = "9.1.0";
15
16 src = fetchFromGitHub {
17 owner = "openzim";
18 repo = "libzim";
19 rev = version;
20 hash = "sha256-yWnW/+CaQwbemrNLzvQpXw5yvW2Q6LtwDgvA58+fVUs=";
21 };
22
23 testData = fetchzip rec {
24 passthru.version = "0.5";
25 url = "https://github.com/openzim/zim-testing-suite/releases/download/v${passthru.version}/zim-testing-suite-${passthru.version}.tar.gz";
26 hash = "sha256-hCIFT1WPDjhoZMlsR2cFbt4NhmIJ4DX1H/tDCIv4NjQ=";
27 };
28
29 nativeBuildInputs = [
30 meson
31 pkg-config
32 ninja
33 python3
34 ];
35
36 propagatedBuildInputs = [
37 icu
38 libuuid
39 xapian
40 xz
41 zstd
42 ];
43
44 postPatch = ''
45 patchShebangs scripts
46 '';
47
48 mesonFlags = [ "-Dtest_data_dir=${testData}" ];
49
50 env.NIX_CFLAGS_COMPILE = toString (
51 lib.optionals (stdenv.cc.isGNU) [
52 "-Wno-error=mismatched-new-delete"
53 ]
54 );
55
56 nativeCheckInputs = [
57 gtest
58 ];
59
60 doCheck = true;
61
62 meta = with lib; {
63 description = "Library for reading and writing ZIM files";
64 homepage = "https://www.openzim.org/wiki/Zimlib";
65 license = licenses.gpl2;
66 maintainers = with maintainers; [ greg ];
67 platforms = platforms.unix;
68 };
69}