2018-12-14 15:41:51 +00:00
|
|
|
{ stdenv, fetchurl
|
|
|
|
, ncurses
|
2018-12-31 03:40:47 +00:00
|
|
|
, libX11, xorgproto, buildEnv
|
2018-12-14 15:41:51 +00:00
|
|
|
}:
|
2017-12-08 23:35:22 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
useX11 = stdenv.isi686 || stdenv.isx86_64;
|
2018-12-31 03:40:47 +00:00
|
|
|
x11deps = [ libX11 xorgproto ];
|
2018-07-20 20:36:12 +01:00
|
|
|
inherit (stdenv.lib) optionals;
|
2018-12-14 15:41:51 +00:00
|
|
|
|
|
|
|
baseOcamlBranch = "4.07";
|
|
|
|
baseOcamlVersion = "${baseOcamlBranch}.1";
|
|
|
|
metaocamlPatch = "107";
|
2017-12-08 23:35:22 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "ber-metaocaml";
|
2018-12-14 15:41:51 +00:00
|
|
|
version = metaocamlPatch;
|
2017-12-08 23:35:22 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-12-14 15:41:51 +00:00
|
|
|
url = "https://caml.inria.fr/pub/distrib/ocaml-${baseOcamlBranch}/ocaml-${baseOcamlVersion}.tar.gz";
|
2018-11-08 19:20:05 +00:00
|
|
|
sha256 = "1x4sln131mcspisr22qc304590rvg720rbl7g2i4xiymgvhkpm1a";
|
2017-12-08 23:35:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
metaocaml = fetchurl {
|
2018-11-08 19:20:05 +00:00
|
|
|
url = "http://okmij.org/ftp/ML/ber-metaocaml-107.tar.gz";
|
|
|
|
sha256 = "0xy6n0yj1f53pk612zfmn49pn04bd75qa40xgmr0w0lzx6dqsfmm";
|
2017-12-08 23:35:22 +00:00
|
|
|
};
|
|
|
|
|
2018-12-14 15:41:51 +00:00
|
|
|
x11env = buildEnv { name = "x11env"; paths = x11deps; };
|
|
|
|
x11lib = "${x11env}/lib";
|
|
|
|
x11inc = "${x11env}/include";
|
2017-12-08 23:35:22 +00:00
|
|
|
|
|
|
|
prefixKey = "-prefix ";
|
2018-12-14 15:41:51 +00:00
|
|
|
configureFlags = optionals useX11
|
|
|
|
[ "-x11lib" x11lib
|
|
|
|
"-x11include" x11inc
|
|
|
|
"-flambda"
|
|
|
|
];
|
2017-12-08 23:35:22 +00:00
|
|
|
|
|
|
|
dontStrip = true;
|
2018-12-14 15:41:51 +00:00
|
|
|
buildInputs = [ ncurses ] ++ optionals useX11 x11deps;
|
2017-12-08 23:35:22 +00:00
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
tar -xvzf $metaocaml
|
2019-08-15 13:41:18 +01:00
|
|
|
cd ${pname}-${version}
|
2017-12-08 23:35:22 +00:00
|
|
|
make patch
|
|
|
|
cd ..
|
|
|
|
'';
|
2018-12-14 15:41:51 +00:00
|
|
|
|
2017-12-08 23:35:22 +00:00
|
|
|
buildPhase = ''
|
|
|
|
make world
|
|
|
|
make -i install
|
|
|
|
|
|
|
|
make bootstrap
|
|
|
|
make opt.opt
|
|
|
|
make installopt
|
|
|
|
mkdir -p $out/include
|
|
|
|
ln -sv $out/lib/ocaml/caml $out/include/caml
|
2019-08-15 13:41:18 +01:00
|
|
|
cd ${pname}-${version}
|
2017-12-08 23:35:22 +00:00
|
|
|
make all
|
2018-12-14 15:41:51 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-12-08 23:35:22 +00:00
|
|
|
make install
|
|
|
|
make install.opt
|
|
|
|
'';
|
2018-12-14 15:41:51 +00:00
|
|
|
|
2017-12-08 23:35:22 +00:00
|
|
|
checkPhase = ''
|
2019-08-15 13:41:18 +01:00
|
|
|
cd ${pname}-${version}
|
2017-12-08 23:35:22 +00:00
|
|
|
make test
|
|
|
|
make test-compile
|
|
|
|
make test-native
|
|
|
|
cd ..
|
|
|
|
'';
|
|
|
|
|
2018-12-14 15:41:51 +00:00
|
|
|
passthru = {
|
|
|
|
nativeCompilers = true;
|
|
|
|
};
|
|
|
|
|
2017-12-08 23:35:22 +00:00
|
|
|
meta = with stdenv.lib; {
|
2018-12-14 15:41:51 +00:00
|
|
|
description = "Multi-Stage Programming extension for OCaml";
|
|
|
|
homepage = http://okmij.org/ftp/ML/MetaOCaml.html;
|
|
|
|
license = with licenses; [ /* compiler */ qpl /* library */ lgpl2 ];
|
|
|
|
maintainers = with maintainers; [ thoughtpolice ];
|
|
|
|
|
|
|
|
branch = baseOcamlBranch;
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
|
|
|
broken = stdenv.isAarch64 || stdenv.isMips;
|
|
|
|
|
2017-12-08 23:35:22 +00:00
|
|
|
longDescription = ''
|
2018-12-14 15:41:51 +00:00
|
|
|
A simple extension of OCaml with the primitive type of code values, and
|
|
|
|
three basic multi-stage expression forms: Brackets, Escape, and Run.
|
2017-12-08 23:35:22 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|