summaryrefslogtreecommitdiff
path: root/pkgs/development/compilers/mezzo/default.nix
blob: 202c3d12049ae877d20d92a6659168f8b8ff38b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
  lib,
  stdenv,
  fetchFromGitHub,
  ocaml,
  findlib,
  ocamlbuild,
  camlp4,
  menhir,
  menhirLib,
  yojson,
  ulex,
  pprint,
  fix,
  functory,
}:

let
  check-ocaml-version = lib.versionAtLeast (lib.getVersion ocaml);
in

assert check-ocaml-version "4";

stdenv.mkDerivation {

  pname = "mezzo";
  version = "0.0.m8";

  src = fetchFromGitHub {
    owner = "protz";
    repo = "mezzo";
    rev = "m8";
    sha256 = "0yck5r6di0935s3iy2mm9538jkf77ssr789qb06ms7sivd7g3ip6";
  };

  strictDeps = true;

  nativeBuildInputs = [
    ocaml
    findlib
    ocamlbuild
    camlp4
    menhir
  ];
  buildInputs = [
    yojson
    menhirLib
    ulex
    pprint
    fix
    functory
    ocamlbuild
  ];

  # Sets warning 3 as non-fatal
  prePatch =
    lib.optionalString (check-ocaml-version "4.02") ''
      substituteInPlace myocamlbuild.pre.ml \
      --replace '@1..3' '@1..2+3'
    ''
    # Compatibility with PPrint ≥ 20220103
    + ''
      substituteInPlace typing/Fact.ml --replace PPrintOCaml PPrint.OCaml
    '';

  createFindlibDestdir = true;

  postInstall = ''
    mkdir $out/bin
    cp mezzo $out/bin/
  '';

  meta = {
    homepage = "http://protz.github.io/mezzo/";
    description = "Programming language in the ML tradition, which places strong emphasis on the control of aliasing and access to mutable memory";
    license = lib.licenses.gpl2;
    broken = lib.versionAtLeast ocaml.version "4.06";
    platforms = ocaml.meta.platforms or [ ];
  };
}