summary refs log tree commit diff
diff options
context:
space:
mode:
authorSophia Donataccio <srdqty@gmail.com>2018-10-12 00:21:49 -0400
committerSophia Donataccio <srdqty@gmail.com>2018-10-12 00:21:49 -0400
commit30da2b565917622f52108bcb93bf759700e6a144 (patch)
tree39a2515cd4327dd9aa402e542beb33585aaf14d9
parent4845d9324f96a0b879030e87b99cf1b841a833a0 (diff)
downloadnixlib-30da2b565917622f52108bcb93bf759700e6a144.tar
nixlib-30da2b565917622f52108bcb93bf759700e6a144.tar.gz
nixlib-30da2b565917622f52108bcb93bf759700e6a144.tar.bz2
nixlib-30da2b565917622f52108bcb93bf759700e6a144.tar.lz
nixlib-30da2b565917622f52108bcb93bf759700e6a144.tar.xz
nixlib-30da2b565917622f52108bcb93bf759700e6a144.tar.zst
nixlib-30da2b565917622f52108bcb93bf759700e6a144.zip
mlton: adds binary release package for mlton version 20180207
This works the same as the binary package in the old derivation, by
patching the release binary. The difference is that this derivation
is also exposed at the top level.
-rw-r--r--pkgs/development/compilers/mlton/20180207-binary.nix57
-rw-r--r--pkgs/development/compilers/mlton/default.nix4
-rw-r--r--pkgs/top-level/all-packages.nix3
3 files changed, 63 insertions, 1 deletions
diff --git a/pkgs/development/compilers/mlton/20180207-binary.nix b/pkgs/development/compilers/mlton/20180207-binary.nix
new file mode 100644
index 000000000000..0589733cb3c6
--- /dev/null
+++ b/pkgs/development/compilers/mlton/20180207-binary.nix
@@ -0,0 +1,57 @@
+{ stdenv, fetchurl, patchelf, gmp }:
+let
+  dynamic-linker = stdenv.cc.bintools.dynamicLinker;
+in
+stdenv.mkDerivation rec {
+  name = "mlton-${version}";
+  version = "20180207";
+
+  src = if stdenv.hostPlatform.system == "x86_64-linux" then (fetchurl {
+    url = "https://github.com/MLton/mlton/releases/download/on-${version}-release/${name}-1.amd64-linux.tgz";
+    sha256 = "0f4q575yfm5dpg4a2wsnqn4l2zrar96p6rlsk0dw10ggyfwvsjlf";
+    })
+  else if stdenv.hostPlatform.system == "x86_64-darwin" then (fetchurl {
+    url = "https://github.com/MLton/mlton/releases/download/on-${version}-release/${name}-1.amd64-darwin.gmp-static.tgz";
+      sha256 = "1cw7yhw48qp12q0adwf8srpjzrgkp84kmlkqw3pz8vkxz4p9hbdv";
+    })
+  else
+    throw "Architecture not supported";
+
+  buildInputs = [ gmp ];
+  nativeBuildInputs = stdenv.lib.optional stdenv.isLinux patchelf;
+
+  buildPhase = ''
+    make update \
+      CC="$(type -p cc)" \
+      WITH_GMP_INC_DIR="${gmp.dev}/include" \
+      WITH_GMP_LIB_DIR="${gmp}/lib"
+  '';
+
+  installPhase = ''
+    make install PREFIX=$out
+  '';
+
+  postFixup = stdenv.lib.optionalString stdenv.isLinux ''
+    patchelf --set-interpreter ${dynamic-linker} $out/lib/mlton/mlton-compile
+    patchelf --set-rpath ${gmp}/lib $out/lib/mlton/mlton-compile
+
+    for e in mllex mlnlffigen mlprof mlyacc; do
+      patchelf --set-interpreter ${dynamic-linker} $out/bin/$e
+      patchelf --set-rpath ${gmp}/lib $out/bin/$e
+    done
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -change \
+      /opt/local/lib/libgmp.10.dylib \
+      ${gmp}/lib/libgmp.10.dylib \
+      $out/lib/mlton/mlton-compile
+
+    for e in mllex mlnlffigen mlprof mlyacc; do
+      install_name_tool -change \
+        /opt/local/lib/libgmp.10.dylib \
+        ${gmp}/lib/libgmp.10.dylib \
+        $out/bin/$e
+    done
+  '';
+
+  meta = import ./meta.nix;
+}
diff --git a/pkgs/development/compilers/mlton/default.nix b/pkgs/development/compilers/mlton/default.nix
index 7139a8a073de..a0662cd18a31 100644
--- a/pkgs/development/compilers/mlton/default.nix
+++ b/pkgs/development/compilers/mlton/default.nix
@@ -3,4 +3,8 @@ rec {
   mlton20130715 = import ./20130715.nix {
     inherit stdenv fetchurl patchelf gmp;
   };
+
+  mlton20180207Binary = import ./20180207-binary.nix {
+    inherit stdenv fetchurl patchelf gmp;
+  };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index b998cbedec77..539b84abd4e0 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7163,7 +7163,8 @@ with pkgs;
   mkcl = callPackage ../development/compilers/mkcl {};
 
   inherit (callPackage ../development/compilers/mlton {})
-    mlton20130715;
+    mlton20130715
+    mlton20180207Binary;
 
   mlton = mlton20130715;