summary refs log tree commit diff
path: root/pkgs/development/compilers/ocaml
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2017-12-08 23:35:22 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2017-12-09 12:18:05 +0000
commit08dfb9567320a64a082408fc157e62a09ae2df14 (patch)
treeb73affa6810e662c25761a24e3abebcc443cd289 /pkgs/development/compilers/ocaml
parent994a614ca3a82f3bf99d2c6504c94964955ee1ab (diff)
downloadnixpkgs-08dfb9567320a64a082408fc157e62a09ae2df14.tar
nixpkgs-08dfb9567320a64a082408fc157e62a09ae2df14.tar.gz
nixpkgs-08dfb9567320a64a082408fc157e62a09ae2df14.tar.bz2
nixpkgs-08dfb9567320a64a082408fc157e62a09ae2df14.tar.lz
nixpkgs-08dfb9567320a64a082408fc157e62a09ae2df14.tar.xz
nixpkgs-08dfb9567320a64a082408fc157e62a09ae2df14.tar.zst
nixpkgs-08dfb9567320a64a082408fc157e62a09ae2df14.zip
ber_metaocaml: (re)init at 104
Diffstat (limited to 'pkgs/development/compilers/ocaml')
-rw-r--r--pkgs/development/compilers/ocaml/ber-metaocaml-104.nix84
1 files changed, 84 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ocaml/ber-metaocaml-104.nix b/pkgs/development/compilers/ocaml/ber-metaocaml-104.nix
new file mode 100644
index 00000000000..81c8cd53402
--- /dev/null
+++ b/pkgs/development/compilers/ocaml/ber-metaocaml-104.nix
@@ -0,0 +1,84 @@
+{ stdenv, fetchurl, ncurses, libX11, xproto, buildEnv }:
+
+let
+   useX11 = stdenv.isi686 || stdenv.isx86_64;
+   useNativeCompilers = stdenv.isi686 || stdenv.isx86_64 || stdenv.isMips;
+   inherit (stdenv.lib) optionals optionalString;
+in
+
+stdenv.mkDerivation rec {
+
+  name = "ber-metaocaml-${version}";
+  version = "104";
+
+  src = fetchurl {
+    url = "http://caml.inria.fr/pub/distrib/ocaml-4.04/ocaml-4.04.0.tar.gz";
+    sha256 = "1pi2hdm9lxhn45qvfqfss1hpa4jijm14qgmrgajsadxqdiplhqyb";
+  };
+
+  metaocaml = fetchurl {
+    url = "http://okmij.org/ftp/ML/ber-metaocaml-104.tar.gz";
+    sha256 = "1gmwlxairxqcmqa2r6kbf8b4dxc7pfhfbh48g1s14d3z20rj8nib";
+  };
+
+  # Needed to avoid a SIGBUS on the final executable on mips
+  NIX_CFLAGS_COMPILE = if stdenv.isMips then "-fPIC" else "";
+
+  x11env = buildEnv { name = "x11env"; paths = [libX11 xproto];};
+  x11lib = x11env + "/lib";
+  x11inc = x11env + "/include";
+
+  prefixKey = "-prefix ";
+  configureFlags = optionals useX11 [ "-x11lib" x11lib
+                                      "-x11include" x11inc ];
+
+  dontStrip = true;
+  buildInputs = [ncurses] ++ optionals useX11 [ libX11 xproto ];
+  installFlags = "-i";
+  installTargets = "install"; # + optionalString useNativeCompilers " installopt";
+
+  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
+    make install
+    make install.opt
+    cd ..
+ '';
+  installPhase = "";
+  postBuild = ''
+  '';
+  checkPhase = ''
+    cd ${name}
+    make test
+    make test-compile
+    make test-native
+    cd ..
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "http://okmij.org/ftp/ML/index.html#ber-metaocaml";
+    license = with licenses; [
+      qpl /* compiler */
+      lgpl2 /* library */
+    ];
+    description = "Conservative extension of OCaml";
+    longDescription = ''
+      A conservative extension of OCaml with the primitive type of code values,
+      and three basic multi-stage expression forms: Brackets, Escape, and Run
+    '';
+  };
+}