anchor.diff:      substituteInPlace $(pwd)/Makefile --replace '/bin/cp' $(type -p cp)
   
       # Fix paths in the binary distribution.
  -    BIN_DIST_DIR="$(pwd)/../usr"
  +    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/bin/env bash' $(type -p bash)
  +      substituteInPlace "$BIN_DIST_DIR/$f" --replace '/${usr_prefix}/bin/env bash' $(type -p bash)
       done
   
  -    substituteInPlace $(pwd)/../usr/bin/mlton --replace '/usr/lib/mlton' $(pwd)/../usr/lib/mlton
  +    substituteInPlace $(pwd)/../${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $(pwd)/../${usr_prefix}/lib/mlton
     '';
   
     preBuild = ''
       # To build the source we have to put the binary distribution in the $PATH.
  -    export PATH="$PATH:$(pwd)/../usr/bin/"
  +    export PATH="$PATH:$(pwd)/../${usr_prefix}/bin/"
   
       # Let the builder execute the binary distribution.
  -    chmod u+x $(pwd)/../usr/bin/mllex
  -    chmod u+x $(pwd)/../usr/bin/mlyacc
  -    chmod u+x $(pwd)/../usr/bin/mlton
  +    chmod u+x $(pwd)/../${usr_prefix}/bin/mllex
  +    chmod u+x $(pwd)/../${usr_prefix}/bin/mlyacc
  +    chmod u+x $(pwd)/../${usr_prefix}/bin/mlton
   
       # So the builder runs the binary compiler with gmp.
       export LD_LIBRARY_PATH=${gmp}/lib:$LD_LIBRARY_PATH
   
  +  '' + stdenv.lib.optionalString stdenv.isLinux ''
       # Patch ELF interpreter.
  -    patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $(pwd)/../usr/lib/mlton/mlton-compile
  +    patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $(pwd)/../${usr_prefix}/lib/mlton/mlton-compile
       for e in mllex mlyacc ; do
  -      patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $(pwd)/../usr/bin/$e
  +      patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $(pwd)/../${usr_prefix}/bin/$e
       done
     '';
   
  
positive.code: 
      homepage = http://mlton.org/;
      license = "bsd";
      platforms = [ "i686-linux" "x86_64-linux" ];
    };
  }
  
negative.code: 
  let
    version = "20130715";
  
    usr_prefix = if stdenv.isDarwin then "usr/local" else "usr";
  in
  stdenv.mkDerivation rec {
    name = "mlton-${version}";
  