From 4845d9324f96a0b879030e87b99cf1b841a833a0 Mon Sep 17 00:00:00 2001 From: Sophia Donataccio Date: Fri, 12 Oct 2018 00:04:16 -0400 Subject: [PATCH] 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 000000000000..f495be8a93e4 --- /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