From 0fc9fdf7f2e6bc36224275cebebb4992c7d31ea4 Mon Sep 17 00:00:00 2001 From: Sophia Donataccio Date: Thu, 11 Oct 2018 23:58:25 -0400 Subject: [PATCH 1/6] mlton: use stdenv.cc.bintools.dynamicLinker --- pkgs/development/compilers/mlton/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/development/compilers/mlton/default.nix b/pkgs/development/compilers/mlton/default.nix index 0b991e22fa9..63fa3445b44 100644 --- a/pkgs/development/compilers/mlton/default.nix +++ b/pkgs/development/compilers/mlton/default.nix @@ -5,9 +5,7 @@ let usr_prefix = if stdenv.isDarwin then "usr/local" else "usr"; - dynamic_linker = - if stdenv.isx86_64 then "${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2" - else "${stdenv.glibc.out}/lib/ld-linux.so.2"; + dynamic_linker = stdenv.cc.bintools.dynamicLinker; in stdenv.mkDerivation rec { From 4845d9324f96a0b879030e87b99cf1b841a833a0 Mon Sep 17 00:00:00 2001 From: Sophia Donataccio Date: Fri, 12 Oct 2018 00:04:16 -0400 Subject: [PATCH 2/6] mlton: prepare old version for refactoring 20130715.nix is exactly the same as the old default.nix other than pulling the meta data out into its own file. --- pkgs/development/compilers/mlton/20130715.nix | 118 +++++++++++++++ pkgs/development/compilers/mlton/default.nix | 134 +----------------- pkgs/development/compilers/mlton/meta.nix | 15 ++ pkgs/top-level/all-packages.nix | 5 +- 4 files changed, 141 insertions(+), 131 deletions(-) create mode 100644 pkgs/development/compilers/mlton/20130715.nix create mode 100644 pkgs/development/compilers/mlton/meta.nix diff --git a/pkgs/development/compilers/mlton/20130715.nix b/pkgs/development/compilers/mlton/20130715.nix new file mode 100644 index 00000000000..f495be8a93e --- /dev/null +++ b/pkgs/development/compilers/mlton/20130715.nix @@ -0,0 +1,118 @@ +{ stdenv, fetchurl, patchelf, gmp }: + +let + version = "20130715"; + + usr_prefix = if stdenv.isDarwin then "usr/local" else "usr"; + + dynamic_linker = stdenv.cc.bintools.dynamicLinker; +in + +stdenv.mkDerivation rec { + name = "mlton-${version}"; + + binSrc = + if stdenv.hostPlatform.system == "i686-linux" then (fetchurl { + url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.x86-linux.tgz"; + sha256 = "1kxjjmnw4xk2d9hpvz43w9dvyhb3025k4zvjx785c33nrwkrdn4j"; + }) + else if stdenv.hostPlatform.system == "x86_64-linux" then (fetchurl { + url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.amd64-linux.tgz"; + sha256 = "0fyhwxb4nmpirjbjcvk9f6w67gmn2gkz7xcgz0xbfih9kc015ygn"; + }) + else if stdenv.hostPlatform.system == "x86_64-darwin" then (fetchurl { + url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.amd64-darwin.gmp-macports.tgz"; + sha256 = "044wnh9hhg6if886xy805683k0as347xd37r0r1yi4x7qlxzzgx9"; + }) + else throw "Architecture not supported"; + + codeSrc = + fetchurl { + url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}.src.tgz"; + sha256 = "0v1x2hrh9hiqkvnbq11kf34v4i5a2x0ffxbzqaa8skyl26nmfn11"; + }; + + srcs = [ binSrc codeSrc ]; + + sourceRoot = name; + + buildInputs = [ gmp ]; + nativeBuildInputs = stdenv.lib.optional stdenv.isLinux patchelf; + + makeFlags = [ "all-no-docs" ]; + + configurePhase = '' + # Fix paths in the source. + find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@" + + substituteInPlace $(pwd)/Makefile --replace '/bin/cp' $(type -p cp) + substituteInPlace bin/mlton-script --replace gcc cc + substituteInPlace bin/regression --replace gcc cc + substituteInPlace lib/mlnlffi-lib/Makefile --replace gcc cc + substituteInPlace mlnlffigen/gen-cppcmd --replace gcc cc + substituteInPlace runtime/Makefile --replace gcc cc + substituteInPlace ../${usr_prefix}/bin/mlton --replace gcc cc + + # Fix paths in the binary distribution. + BIN_DIST_DIR="$(pwd)/../${usr_prefix}" + for f in "bin/mlton" "lib/mlton/platform" "lib/mlton/static-library" ; do + substituteInPlace "$BIN_DIST_DIR/$f" --replace '/${usr_prefix}/bin/env bash' $(type -p bash) + done + + substituteInPlace $(pwd)/../${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $(pwd)/../${usr_prefix}/lib/mlton + '' + stdenv.lib.optionalString stdenv.cc.isClang '' + sed -i "s_ patch -s -p0 Date: Fri, 12 Oct 2018 00:21:49 -0400 Subject: [PATCH 3/6] 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. --- .../compilers/mlton/20180207-binary.nix | 57 +++++++++++++++++++ pkgs/development/compilers/mlton/default.nix | 4 ++ pkgs/top-level/all-packages.nix | 3 +- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/compilers/mlton/20180207-binary.nix diff --git a/pkgs/development/compilers/mlton/20180207-binary.nix b/pkgs/development/compilers/mlton/20180207-binary.nix new file mode 100644 index 00000000000..0589733cb3c --- /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 7139a8a073d..a0662cd18a3 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 b998cbedec7..539b84abd4e 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; From a130228fe87c06a75f2f19343caea6905f611388 Mon Sep 17 00:00:00 2001 From: Sophia Donataccio Date: Fri, 12 Oct 2018 00:30:48 -0400 Subject: [PATCH 4/6] mlton: adds mlton version 20180207 --- pkgs/development/compilers/mlton/default.nix | 10 +++++- .../compilers/mlton/from-git-source.nix | 33 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 3 +- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/compilers/mlton/from-git-source.nix diff --git a/pkgs/development/compilers/mlton/default.nix b/pkgs/development/compilers/mlton/default.nix index a0662cd18a3..b32a817e20a 100644 --- a/pkgs/development/compilers/mlton/default.nix +++ b/pkgs/development/compilers/mlton/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, fetchFromGitHub, patchelf, gmp }: +{ stdenv, fetchurl, fetchgit, patchelf, gmp }: rec { mlton20130715 = import ./20130715.nix { inherit stdenv fetchurl patchelf gmp; @@ -7,4 +7,12 @@ rec { mlton20180207Binary = import ./20180207-binary.nix { inherit stdenv fetchurl patchelf gmp; }; + + mlton20180207 = import ./from-git-source.nix { + mltonBootstrap = mlton20180207Binary; + version = "20180207"; + rev = "on-20180207-release"; + sha256 = "00rdd2di5x1dzac64il9z05m3fdzicjd3226wwjyynv631jj3q2a"; + inherit stdenv fetchgit gmp; + }; } diff --git a/pkgs/development/compilers/mlton/from-git-source.nix b/pkgs/development/compilers/mlton/from-git-source.nix new file mode 100644 index 00000000000..6678335b4b9 --- /dev/null +++ b/pkgs/development/compilers/mlton/from-git-source.nix @@ -0,0 +1,33 @@ +{ fetchgit +, gmp +, mltonBootstrap +, url ? "https://github.com/mlton/mlton" +, rev +, sha256 +, stdenv +, version +}: + +stdenv.mkDerivation { + name = "mlton-${version}"; + + src = fetchgit { + inherit url rev sha256; + }; + + buildInputs = [mltonBootstrap gmp]; + + preBuild = '' + makeFlagsArray=( + MLTON_VERSION="${version} ${rev}" + CC="$(type -p cc)" + PREFIX="$out" + WITH_GMP_INC_DIR="${gmp.dev}/include" + WITH_GMP_LIB_DIR="${gmp}/lib" + ) + ''; + + doCheck = true; + + meta = import ./meta.nix; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 539b84abd4e..a221c194a24 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7164,7 +7164,8 @@ with pkgs; inherit (callPackage ../development/compilers/mlton {}) mlton20130715 - mlton20180207Binary; + mlton20180207Binary + mlton20180207; mlton = mlton20130715; From fd9a07c7d4dc1679805e2699bdea8ade3c0ed1d9 Mon Sep 17 00:00:00 2001 From: Sophia Donataccio Date: Fri, 12 Oct 2018 00:36:07 -0400 Subject: [PATCH 5/6] mlton: add one-liner from old derivation to fix source files Updates from-git-source.nix to use the one-liner to fix up the bash shebang lines. --- pkgs/development/compilers/mlton/from-git-source.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/compilers/mlton/from-git-source.nix b/pkgs/development/compilers/mlton/from-git-source.nix index 6678335b4b9..3a3538a7ea4 100644 --- a/pkgs/development/compilers/mlton/from-git-source.nix +++ b/pkgs/development/compilers/mlton/from-git-source.nix @@ -18,6 +18,8 @@ stdenv.mkDerivation { buildInputs = [mltonBootstrap gmp]; preBuild = '' + find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@" + makeFlagsArray=( MLTON_VERSION="${version} ${rev}" CC="$(type -p cc)" From bb7ed2cd8119583a8ed2f5ef0b8b71f26bd436ce Mon Sep 17 00:00:00 2001 From: Sophia Donataccio Date: Fri, 12 Oct 2018 00:47:54 -0400 Subject: [PATCH 6/6] mlton: refactor and adds mlton20180207Binary mlton20180207 mltonHEAD This commit adds mltonHEAD. Summary of all the changes in this branch: * mlton20130715 - for this one I just copy and pasted the old default.nix - I have tested some projects that compile with this version and don't compile with the newer version, so I think it makes sense to keep the old version * mlton20180207Binary - This is used to build the source derivations * mlton20180207 - latest release * mltonHEAD - latest commit to the master branch of the github repo at the time of creating this derivation --- pkgs/development/compilers/mlton/default.nix | 8 ++++++++ pkgs/top-level/all-packages.nix | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/mlton/default.nix b/pkgs/development/compilers/mlton/default.nix index b32a817e20a..aaf58885140 100644 --- a/pkgs/development/compilers/mlton/default.nix +++ b/pkgs/development/compilers/mlton/default.nix @@ -15,4 +15,12 @@ rec { sha256 = "00rdd2di5x1dzac64il9z05m3fdzicjd3226wwjyynv631jj3q2a"; inherit stdenv fetchgit gmp; }; + + mltonHEAD = import ./from-git-source.nix { + mltonBootstrap = mlton20180207Binary; + version = "HEAD"; + rev = "e149c9917cfbfe6aba5c986a958ed76d5cc6cfde"; + sha256 = "0a0j1i0f0fxw2my1309srq5j3vz0kawrrln01gxms2m5hy5dl50d"; + inherit stdenv fetchgit gmp; + }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a221c194a24..011a42c3255 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7165,9 +7165,10 @@ with pkgs; inherit (callPackage ../development/compilers/mlton {}) mlton20130715 mlton20180207Binary - mlton20180207; + mlton20180207 + mltonHEAD; - mlton = mlton20130715; + mlton = mlton20180207; mono = mono5; mono5 = mono58;