Merge master-merged PR #29708 into staging

This commit is contained in:
John Ericson 2017-09-23 13:12:04 -04:00
commit ff88f7922b
3 changed files with 137 additions and 159 deletions

View file

@ -1,24 +1,26 @@
{stdenv, lib, fetchurl, perl, libedit, ncurses5, gmp}: { stdenv
, fetchurl, perl
, libedit, ncurses5, gmp
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "6.10.2"; version = "6.10.2";
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = src = fetchurl ({
if stdenv.system == "i686-linux" then "i686-linux" = {
fetchurl {
# This binary requires libedit.so.0 (rather than libedit.so.2). # This binary requires libedit.so.0 (rather than libedit.so.2).
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b"; sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b";
} };
else if stdenv.system == "x86_64-linux" then "x86_64-linux" = {
fetchurl {
# Idem. # Idem.
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj"; sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj";
} };
else throw "cannot bootstrap GHC on this platform"; }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform"));
buildInputs = [perl]; buildInputs = [perl];
@ -37,17 +39,17 @@ stdenv.mkDerivation rec {
'' + '' +
# On Linux, use patchelf to modify the executables so that they can # On Linux, use patchelf to modify the executables so that they can
# find editline/gmp. # find editline/gmp.
(if stdenv.isLinux then '' stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
find . -type f -perm -0100 \ find . -type f -perm -0100 \
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \; --set-rpath "${stdenv.lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \;
for prog in ld ar gcc strip ranlib; do for prog in ld ar gcc strip ranlib; do
find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \; find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
done done
'' else ""); '';
configurePhase = '' configurePhase = ''
./configure --prefix=$out --with-gmp-libraries=${lib.getLib gmp}/lib --with-gmp-includes=${lib.getDev gmp}/include ./configure --prefix=$out --with-gmp-libraries=${stdenv.lib.getLib gmp}/lib --with-gmp-includes=${stdenv.lib.getDev gmp}/include
''; '';
# Stripping combined with patchelf breaks the executables (they die # Stripping combined with patchelf breaks the executables (they die
@ -58,30 +60,7 @@ stdenv.mkDerivation rec {
# calls install-strip ... # calls install-strip ...
dontBuild = true; dontBuild = true;
# The binaries for Darwin use frameworks, so fake those frameworks, postInstall = ''
# and create some wrapper scripts that set DYLD_FRAMEWORK_PATH so
# that the executables work with no special setup.
postInstall =
(if stdenv.isDarwin then
''
mkdir -p $out/frameworks/GMP.framework/Versions/A
ln -s ${gmp.out}/lib/libgmp.dylib $out/frameworks/GMP.framework/GMP
ln -s ${gmp.out}/lib/libgmp.dylib $out/frameworks/GMP.framework/Versions/A/GMP
# !!! fix this
mkdir -p $out/frameworks/GNUeditline.framework/Versions/A
ln -s ${libedit}/lib/libeditline.dylib $out/frameworks/GNUeditline.framework/GNUeditline
ln -s ${libedit}/lib/libeditline.dylib $out/frameworks/GNUeditline.framework/Versions/A/GNUeditline
mv $out/bin $out/bin-orig
mkdir $out/bin
for i in $(cd $out/bin-orig && ls); do
echo \"#! $SHELL -e\" >> $out/bin/$i
echo \"DYLD_FRAMEWORK_PATH=$out/frameworks exec $out/bin-orig/$i -framework-path $out/frameworks \\\"\\$@\\\"\" >> $out/bin/$i
chmod +x $out/bin/$i
done
'' else "")
+
''
# bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way # bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way
sed -i "s@^\(.*pkgName = PackageName \"rts\".*\libraryDirs = \\[\)\(.*\)@\\1\"${gmp.out}/lib\",\2@" $out/lib/ghc-${version}/package.conf sed -i "s@^\(.*pkgName = PackageName \"rts\".*\libraryDirs = \\[\)\(.*\)@\\1\"${gmp.out}/lib\",\2@" $out/lib/ghc-${version}/package.conf

View file

@ -1,32 +1,32 @@
{stdenv, fetchurl, perl, ncurses5, gmp, libiconv}: { stdenv
, fetchurl, perl
, ncurses5, gmp, libiconv
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.0.4"; version = "7.0.4";
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = src = fetchurl ({
if stdenv.system == "i686-linux" then "i686-linux" = {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63"; sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
} };
else if stdenv.system == "x86_64-linux" then "x86_64-linux" = {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99"; sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
} };
else if stdenv.system == "i686-darwin" then "i686-darwin" = {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3"; sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
} };
else if stdenv.system == "x86_64-darwin" then "x86_64-darwin" = {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l"; sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
} };
else throw "cannot bootstrap GHC on this platform"; }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform"));
buildInputs = [perl]; buildInputs = [perl];
@ -74,9 +74,9 @@ stdenv.mkDerivation rec {
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1 install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
} }
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.0.4/utils/ghc-pwd/dist/build/tmp ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/ghc-pwd/dist/build/tmp
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.0.4/utils/hpc/dist/build/tmp ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/hpc/dist/build/tmp
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.0.4/ghc/stage2/build/tmp ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/ghc/stage2/build/tmp
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
fix $(find . -type f -name $file) fix $(find . -type f -name $file)
@ -101,8 +101,7 @@ stdenv.mkDerivation rec {
# calls install-strip ... # calls install-strip ...
dontBuild = true; dontBuild = true;
postInstall = postInstall = ''
''
# Sanity check, can ghc create executables? # Sanity check, can ghc create executables?
cd $TMP cd $TMP
mkdir test-ghc; cd test-ghc mkdir test-ghc; cd test-ghc

View file

@ -1,32 +1,32 @@
{stdenv, fetchurl, perl, ncurses5, gmp, libiconv, makeWrapper}: { stdenv
, fetchurl, perl, makeWrapper
, ncurses5, gmp, libiconv
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.4.2"; version = "7.4.2";
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = src = fetchurl ({
if stdenv.system == "i686-linux" then "i686-linux" = {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi"; sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi";
} };
else if stdenv.system == "x86_64-linux" then "x86_64-linux" = {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns"; sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns";
} };
else if stdenv.system == "i686-darwin" then "i686-darwin" = {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0"; sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0";
} };
else if stdenv.system == "x86_64-darwin" then "x86_64-darwin" = {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
sha256 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf"; sha256 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf";
} };
else throw "cannot bootstrap GHC on this platform"; }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform"));
buildInputs = [perl]; buildInputs = [perl];
@ -79,9 +79,9 @@ stdenv.mkDerivation rec {
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1 install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
} }
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/ghc-pwd/dist-install/build/tmp ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/ghc-pwd/dist-install/build/tmp
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/hpc/dist-install/build/tmp ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/hpc/dist-install/build/tmp
ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/ghc/stage2/build/tmp ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/ghc/stage2/build/tmp
for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
fix $(find . -type f -name $file) fix $(find . -type f -name $file)
@ -107,10 +107,10 @@ stdenv.mkDerivation rec {
dontBuild = true; dontBuild = true;
preInstall = stdenv.lib.optionalString stdenv.isDarwin '' preInstall = stdenv.lib.optionalString stdenv.isDarwin ''
mkdir -p $out/lib/ghc-7.4.2 mkdir -p $out/lib/ghc-${version}
mkdir -p $out/bin mkdir -p $out/bin
ln -s ${libiconv}/lib/libiconv.dylib $out/bin ln -s ${libiconv}/lib/libiconv.dylib $out/bin
ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-7.4.2/libiconv.dylib ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-${version}/libiconv.dylib
ln -s ${libiconv}/lib/libiconv.dylib utils/ghc-cabal/dist-install/build/tmp ln -s ${libiconv}/lib/libiconv.dylib utils/ghc-cabal/dist-install/build/tmp
''; '';