1 { lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, ounit }:
4 # ounit is only available for OCaml >= 4.08
5 doCheck = lib.versionAtLeast ocaml.version "4.08";
8 lib.throwIf (lib.versionAtLeast ocaml.version "5.0")
9 "ocamlmod is not available for OCaml ≥ 5.0"
16 url = "https://forge.ocamlcore.org/frs/download.php/1702/ocamlmod-0.0.9.tar.gz";
17 sha256 = "0cgp9qqrq7ayyhddrmqmq1affvfqcn722qiakjq4dkywvp67h4aa";
20 strictDeps = !doCheck;
22 nativeBuildInputs = [ ocaml findlib ocamlbuild ];
24 configurePhase = "ocaml setup.ml -configure --prefix $out"
25 + lib.optionalString doCheck " --enable-tests";
26 buildPhase = "ocaml setup.ml -build";
27 installPhase = "ocaml setup.ml -install";
30 nativeCheckInputs = [ ounit ];
32 checkPhase = "ocaml setup.ml -test";
37 homepage = "https://forge.ocamlcore.org/projects/ocamlmod/ocamlmod";
38 description = "Generate OCaml modules from source files";
39 platforms = ocaml.meta.platforms or [];
40 maintainers = with lib.maintainers; [