1{
2 lib,
3 stdenv,
4 fetchurl,
5 ocaml,
6 findlib,
7 ocamlbuild,
8}:
9
10lib.throwIf (lib.versionAtLeast ocaml.version "5.0")
11 "ocamlify is not available for OCaml ${ocaml.version}"
12
13 stdenv.mkDerivation
14 rec {
15 pname = "ocamlify";
16 version = "0.0.2";
17
18 src = fetchurl {
19 url = "https://forge.ocamlcore.org/frs/download.php/1209/${pname}-${version}.tar.gz";
20 sha256 = "1f0fghvlbfryf5h3j4as7vcqrgfjb4c8abl5y0y5h069vs4kp5ii";
21 };
22
23 strictDeps = true;
24
25 nativeBuildInputs = [
26 ocaml
27 findlib
28 ocamlbuild
29 ];
30
31 configurePhase = ''
32 substituteInPlace src/ocamlify.ml --replace 'OCamlifyConfig.version' '"0.0.2"'
33 '';
34
35 buildPhase = "ocamlbuild src/ocamlify.native";
36
37 installPhase = ''
38 mkdir -p $out/bin
39 mv _build/src/ocamlify.native $out/bin/ocamlify
40 '';
41
42 dontStrip = true;
43
44 meta = {
45 homepage = "https://forge.ocamlcore.org/projects/ocamlmod/ocamlmod";
46 description = "Generate OCaml modules from source files";
47 platforms = ocaml.meta.platforms or [ ];
48 license = lib.licenses.lgpl21;
49 maintainers = with lib.maintainers; [
50 maggesi
51 ];
52 };
53 }