3e6abb633c
This puts MetaOCaml on more equal footing with the normal OCaml packages, which have a few passthru's and expect to have more 'meta' information available (such as 'platforms'). With these changes, you can use the ber_metaocaml package along with ocaml-ng.mkOcamlPackages in order to create a full package set with Native MetaOCaml support, though this currently isn't implemented (you have to do this yourself). There are also other light cleanups, for example this also removes the old MIPS support and restricts the platforms to x86 Linux/Darwin, for now. Other platforms can be added on a case-by-case basis. Signed-off-by: Austin Seipp <aseipp@pobox.com>
97 lines
2.2 KiB
Nix
97 lines
2.2 KiB
Nix
{ stdenv, fetchurl
|
|
, ncurses
|
|
, libX11, xproto, buildEnv
|
|
}:
|
|
|
|
let
|
|
useX11 = stdenv.isi686 || stdenv.isx86_64;
|
|
x11deps = [ libX11 xproto ];
|
|
inherit (stdenv.lib) optionals;
|
|
|
|
baseOcamlBranch = "4.07";
|
|
baseOcamlVersion = "${baseOcamlBranch}.1";
|
|
metaocamlPatch = "107";
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "ber-metaocaml-${version}";
|
|
version = metaocamlPatch;
|
|
|
|
src = fetchurl {
|
|
url = "https://caml.inria.fr/pub/distrib/ocaml-${baseOcamlBranch}/ocaml-${baseOcamlVersion}.tar.gz";
|
|
sha256 = "1x4sln131mcspisr22qc304590rvg720rbl7g2i4xiymgvhkpm1a";
|
|
};
|
|
|
|
metaocaml = fetchurl {
|
|
url = "http://okmij.org/ftp/ML/ber-metaocaml-107.tar.gz";
|
|
sha256 = "0xy6n0yj1f53pk612zfmn49pn04bd75qa40xgmr0w0lzx6dqsfmm";
|
|
};
|
|
|
|
x11env = buildEnv { name = "x11env"; paths = x11deps; };
|
|
x11lib = "${x11env}/lib";
|
|
x11inc = "${x11env}/include";
|
|
|
|
prefixKey = "-prefix ";
|
|
configureFlags = optionals useX11
|
|
[ "-x11lib" x11lib
|
|
"-x11include" x11inc
|
|
"-flambda"
|
|
];
|
|
|
|
dontStrip = true;
|
|
buildInputs = [ ncurses ] ++ optionals useX11 x11deps;
|
|
|
|
postConfigure = ''
|
|
tar -xvzf $metaocaml
|
|
cd ${name}
|
|
make patch
|
|
cd ..
|
|
'';
|
|
|
|
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
|
|
cd ${name}
|
|
make all
|
|
'';
|
|
|
|
installPhase = ''
|
|
make install
|
|
make install.opt
|
|
'';
|
|
|
|
checkPhase = ''
|
|
cd ${name}
|
|
make test
|
|
make test-compile
|
|
make test-native
|
|
cd ..
|
|
'';
|
|
|
|
passthru = {
|
|
nativeCompilers = true;
|
|
};
|
|
|
|
meta = with stdenv.lib; {
|
|
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;
|
|
|
|
longDescription = ''
|
|
A simple extension of OCaml with the primitive type of code values, and
|
|
three basic multi-stage expression forms: Brackets, Escape, and Run.
|
|
'';
|
|
};
|
|
}
|