tutanota-desktop: 259.250108.1 -> 266.250202.0 (#377234)
[NixPkgs.git] / pkgs / development / compilers / ocaml / ber-metaocaml.nix
blob2305055e0c24d516015def1e4b63ac45312c7129
2   lib,
3   stdenv,
4   fetchurl,
5   ncurses,
6   libX11,
7   xorgproto,
8   buildEnv,
9   useX11 ? stdenv.hostPlatform.isx86,
12 let
13   x11deps = [
14     libX11
15     xorgproto
16   ];
17   inherit (lib) optionals;
19   baseOcamlBranch = "4.14";
20   baseOcamlVersion = "${baseOcamlBranch}.1";
21   metaocamlPatch = "114";
24 stdenv.mkDerivation rec {
25   pname = "ber-metaocaml";
26   version = metaocamlPatch;
28   src = fetchurl {
29     url = "https://caml.inria.fr/pub/distrib/ocaml-${baseOcamlBranch}/ocaml-${baseOcamlVersion}.tar.gz";
30     sha256 = "sha256-GDl53JwJyw9YCiMraFMaCbAlqmKLjY1ydEnxRv1vX+4=";
31   };
33   metaocaml = fetchurl {
34     url = "http://okmij.org/ftp/ML/ber-metaocaml-${metaocamlPatch}.tar.gz";
35     sha256 = "sha256-vvq3xI4jSAsrXcDk97TPbFDYgO9NcQeN/yBcUbcb/y0=";
36   };
38   x11env = buildEnv {
39     name = "x11env";
40     paths = x11deps;
41   };
42   x11lib = "${x11env}/lib";
43   x11inc = "${x11env}/include";
45   prefixKey = "-prefix ";
46   configureFlags = optionals useX11 [ "--enable-flambda" ];
48   dontStrip = true;
49   buildInputs = [ ncurses ] ++ optionals useX11 x11deps;
51   postConfigure = ''
52     tar -xvzf $metaocaml
53     cd ${pname}-${version}
54     make patch
55     cd ..
56   '';
58   buildPhase = ''
59     make world
61     make bootstrap
62     make opt.opt
63     make -i install
64     make installopt
65     mkdir -p $out/include
66     ln -sv $out/lib/ocaml/caml $out/include/caml
67     cd ${pname}-${version}
68     make all
69   '';
71   installPhase = ''
72     make install
73     make install.opt
74   '';
76   checkPhase = ''
77     cd ${pname}-${version}
78     make test
79     make test-compile
80     make test-native
81     cd ..
82   '';
84   passthru = {
85     nativeCompilers = true;
86   };
88   meta = with lib; {
89     description = "Multi-Stage Programming extension for OCaml";
90     homepage = "https://okmij.org/ftp/ML/MetaOCaml.html";
91     license = with licenses; [
92       # compiler
93       qpl # library
94       lgpl2
95     ];
96     maintainers = with maintainers; [ thoughtpolice ];
98     branch = baseOcamlBranch;
99     platforms = with platforms; linux ++ darwin;
100     broken = stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isMips;
102     longDescription = ''
103       A simple extension of OCaml with the primitive type of code values, and
104       three basic multi-stage expression forms: Brackets, Escape, and Run.
105     '';
106   };