1{ lib, stdenv, fetchFromGitLab, ocaml, findlib, bzip2, autoreconfHook }:
2
3if lib.versionOlder ocaml.version "4.02"
4|| lib.versionAtLeast ocaml.version "5.0"
5then throw "bz2 is not available for OCaml ${ocaml.version}"
6else
7
8stdenv.mkDerivation rec {
9 pname = "ocaml${ocaml.version}-bz2";
10 version = "0.7.0";
11
12 src = fetchFromGitLab {
13 owner = "irill";
14 repo = "camlbz2";
15 rev = version;
16 sha256 = "sha256-jBFEkLN2fbC3LxTu7C0iuhvNg64duuckBHWZoBxrV/U=";
17 };
18
19 autoreconfFlags = [ "-I" "." ];
20
21 nativeBuildInputs = [
22 autoreconfHook
23 ocaml
24 findlib
25 ];
26
27 propagatedBuildInputs = [
28 bzip2
29 ];
30
31 strictDeps = true;
32
33 preInstall = "mkdir -p $OCAMLFIND_DESTDIR/stublibs";
34
35 meta = with lib; {
36 description = "OCaml bindings for the libbz2 (AKA, bzip2) (de)compression library";
37 downloadPage = "https://gitlab.com/irill/camlbz2";
38 license = licenses.lgpl21;
39 maintainers = with maintainers; [ ];
40 };
41}