1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 ocaml,
6 findlib,
7 ocamlbuild,
8 camlp4,
9 menhir,
10 menhirLib,
11 yojson,
12 ulex,
13 pprint,
14 fix,
15 functory,
16}:
17
18if lib.versionAtLeast ocaml.version "4.06" then
19 throw "mezzo is not available for OCaml ${ocaml.version}"
20else
21
22 let
23 check-ocaml-version = lib.versionAtLeast (lib.getVersion ocaml);
24 in
25
26 assert check-ocaml-version "4";
27
28 stdenv.mkDerivation {
29
30 pname = "mezzo";
31 version = "0.0.m8";
32
33 src = fetchFromGitHub {
34 owner = "protz";
35 repo = "mezzo";
36 rev = "m8";
37 sha256 = "0yck5r6di0935s3iy2mm9538jkf77ssr789qb06ms7sivd7g3ip6";
38 };
39
40 strictDeps = true;
41
42 nativeBuildInputs = [
43 ocaml
44 findlib
45 ocamlbuild
46 camlp4
47 menhir
48 ];
49 buildInputs = [
50 yojson
51 menhirLib
52 ulex
53 pprint
54 fix
55 functory
56 ocamlbuild
57 ];
58
59 # Sets warning 3 as non-fatal
60 prePatch =
61 lib.optionalString (check-ocaml-version "4.02") ''
62 substituteInPlace myocamlbuild.pre.ml \
63 --replace '@1..3' '@1..2+3'
64 ''
65 # Compatibility with PPrint ≥ 20220103
66 + ''
67 substituteInPlace typing/Fact.ml --replace PPrintOCaml PPrint.OCaml
68 '';
69
70 createFindlibDestdir = true;
71
72 postInstall = ''
73 mkdir $out/bin
74 cp mezzo $out/bin/
75 '';
76
77 meta = with lib; {
78 homepage = "http://protz.github.io/mezzo/";
79 description = "Programming language in the ML tradition, which places strong emphasis on the control of aliasing and access to mutable memory";
80 license = licenses.gpl2;
81 platforms = ocaml.meta.platforms or [ ];
82 };
83 }