summary refs log tree commit diff
path: root/pkgs/development/compilers/mezzo/default.nix
blob: c0b535747133cfd4ded300eeca83c4085998a9c1 (plain) (blame)
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
{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, menhir, yojson, ulex, pprint, fix, functory }:

if stdenv.lib.versionAtLeast ocaml.version "4.06"
then throw "mezzo is not available for OCaml ${ocaml.version}"
else

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

assert check-ocaml-version "4";

stdenv.mkDerivation {

  name = "mezzo-0.0.m8";

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

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

  # Sets warning 3 as non-fatal
  prePatch = stdenv.lib.optionalString (check-ocaml-version "4.02") ''
    substituteInPlace myocamlbuild.pre.ml \
    --replace '@1..3' '@1..2+3'
  '';

  createFindlibDestdir = true;

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

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