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