1{ stdenv, lib, fetchFromGitHub, expat, ocaml, findlib, ounit }:
2
3lib.throwIfNot (lib.versionAtLeast ocaml.version "4.02")
4 "ocaml_expat is not available for OCaml ${ocaml.version}"
5
6stdenv.mkDerivation rec {
7 pname = "ocaml${ocaml.version}-expat";
8 version = "1.3.0";
9
10 src = fetchFromGitHub {
11 owner = "whitequark";
12 repo = "ocaml-expat";
13 rev = "v${version}";
14 hash = "sha256-eDA6MUcztaI+fpunWBdanNnPo9Y5gvbj/ViVcxYYEBg=";
15 };
16
17 prePatch = ''
18 substituteInPlace Makefile --replace "gcc" "\$(CC)"
19 '';
20
21 nativeBuildInputs = [ ocaml findlib ];
22 buildInputs = [ expat ];
23
24 strictDeps = true;
25
26 doCheck = lib.versionAtLeast ocaml.version "4.08";
27 checkTarget = "testall";
28 checkInputs = [ ounit ];
29
30 createFindlibDestdir = true;
31
32 meta = {
33 description = "OCaml wrapper for the Expat XML parsing library";
34 license = lib.licenses.mit;
35 maintainers = [ lib.maintainers.vbgl ];
36 inherit (src.meta) homepage;
37 inherit (ocaml.meta) platforms;
38 };
39}