ghc prebuilt: Fix indentation

Doing this separately so the other commits are more readable
This commit is contained in:
John Ericson 2017-09-22 13:45:31 -04:00
parent a8ef3f6742
commit 2d52156793
3 changed files with 117 additions and 119 deletions

View File

@ -9,18 +9,18 @@ stdenv.mkDerivation rec {
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = fetchurl ({ src = fetchurl ({
"i686-linux" = { "i686-linux" = {
# 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";
}; };
"x86_64-linux" = { "x86_64-linux" = {
# 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";
}; };
}.${stdenv.hostPlatform.system} }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform")); or (throw "cannot bootstrap GHC on this platform"));
buildInputs = [perl]; buildInputs = [perl];
@ -29,14 +29,14 @@ stdenv.mkDerivation rec {
# first. The GHC Cabal build system makes use of strip by default and # first. The GHC Cabal build system makes use of strip by default and
# has hardcoded paths to /usr/bin/strip in many places. We replace # has hardcoded paths to /usr/bin/strip in many places. We replace
# those below, making them point to our dummy script. # those below, making them point to our dummy script.
'' ''
mkdir "$TMP/bin" mkdir "$TMP/bin"
for i in strip; do for i in strip; do
echo '#! ${stdenv.shell}' > "$TMP/bin/$i" echo '#! ${stdenv.shell}' > "$TMP/bin/$i"
chmod +x "$TMP/bin/$i" chmod +x "$TMP/bin/$i"
done done
PATH="$TMP/bin:$PATH" PATH="$TMP/bin:$PATH"
'' + '' +
# 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.
stdenv.lib.optionalString stdenv.hostPlatform.isLinux '' stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
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
''; '';
configurePhase = '' configurePhase = ''
./configure --prefix=$out --with-gmp-libraries=${stdenv.lib.getLib gmp}/lib --with-gmp-includes=${stdenv.lib.getDev gmp}/include ./configure --prefix=$out --with-gmp-libraries=${stdenv.lib.getLib gmp}/lib --with-gmp-includes=${stdenv.lib.getDev gmp}/include
@ -60,22 +60,21 @@ stdenv.mkDerivation rec {
# calls install-strip ... # calls install-strip ...
dontBuild = true; dontBuild = true;
postInstall = postInstall = ''
'' # 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
# 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
cat > main.hs << EOF cat > main.hs << EOF
module Main where module Main where
main = putStrLn "yes" main = putStrLn "yes"
EOF EOF
$out/bin/ghc --make main.hs $out/bin/ghc --make main.hs
echo compilation ok echo compilation ok
[ $(./main) == "yes" ] [ $(./main) == "yes" ]
''; '';
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;

View File

@ -9,24 +9,24 @@ stdenv.mkDerivation rec {
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = fetchurl ({ src = fetchurl ({
"i686-linux" = { "i686-linux" = {
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";
}; };
"x86_64-linux" = { "x86_64-linux" = {
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";
}; };
"i686-darwin" = { "i686-darwin" = {
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";
}; };
"x86_64-darwin" = { "x86_64-darwin" = {
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";
}; };
}.${stdenv.hostPlatform.system} }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform")); or (throw "cannot bootstrap GHC on this platform"));
buildInputs = [perl]; buildInputs = [perl];
@ -41,22 +41,22 @@ stdenv.mkDerivation rec {
# first. The GHC Cabal build system makes use of strip by default and # first. The GHC Cabal build system makes use of strip by default and
# has hardcoded paths to /usr/bin/strip in many places. We replace # has hardcoded paths to /usr/bin/strip in many places. We replace
# those below, making them point to our dummy script. # those below, making them point to our dummy script.
'' ''
mkdir "$TMP/bin" mkdir "$TMP/bin"
for i in strip; do for i in strip; do
echo '#! ${stdenv.shell}' > "$TMP/bin/$i" echo '#! ${stdenv.shell}' > "$TMP/bin/$i"
chmod +x "$TMP/bin/$i" chmod +x "$TMP/bin/$i"
done done
PATH="$TMP/bin:$PATH" PATH="$TMP/bin:$PATH"
'' + '' +
# We have to patch the GMP paths for the integer-gmp package. # We have to patch the GMP paths for the integer-gmp package.
'' ''
find . -name integer-gmp.buildinfo \ find . -name integer-gmp.buildinfo \
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \; -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \;
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
find . -name base.buildinfo \ find . -name base.buildinfo \
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \; -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
'' + '' +
# 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.
stdenv.lib.optionalString stdenv.isLinux '' stdenv.lib.optionalString stdenv.isLinux ''
@ -68,24 +68,24 @@ stdenv.mkDerivation rec {
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
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
# not enough room in the object files for the full path to libiconv :( # not enough room in the object files for the full path to libiconv :(
fix () { fix () {
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-${version}/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-${version}/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-${version}/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)
done done
for file in $(find . -name setup-config); do for file in $(find . -name setup-config); do
substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)" substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
done done
''; '';
configurePhase = '' configurePhase = ''
./configure --prefix=$out \ ./configure --prefix=$out \
@ -101,19 +101,18 @@ 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 cat > main.hs << EOF
cat > main.hs << EOF module Main where
module Main where main = putStrLn "yes"
main = putStrLn "yes" EOF
EOF $out/bin/ghc --make main.hs
$out/bin/ghc --make main.hs echo compilation ok
echo compilation ok [ $(./main) == "yes" ]
[ $(./main) == "yes" ] '';
'';
meta.license = stdenv.lib.licenses.bsd3; meta.license = stdenv.lib.licenses.bsd3;
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"]; meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];

View File

@ -9,24 +9,24 @@ stdenv.mkDerivation rec {
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = fetchurl ({ src = fetchurl ({
"i686-linux" = { "i686-linux" = {
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";
}; };
"x86_64-linux" = { "x86_64-linux" = {
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";
}; };
"i686-darwin" = { "i686-darwin" = {
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";
}; };
"x86_64-darwin" = { "x86_64-darwin" = {
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";
}; };
}.${stdenv.hostPlatform.system} }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform")); or (throw "cannot bootstrap GHC on this platform"));
buildInputs = [perl]; buildInputs = [perl];
@ -41,22 +41,22 @@ stdenv.mkDerivation rec {
# first. The GHC Cabal build system makes use of strip by default and # first. The GHC Cabal build system makes use of strip by default and
# has hardcoded paths to /usr/bin/strip in many places. We replace # has hardcoded paths to /usr/bin/strip in many places. We replace
# those below, making them point to our dummy script. # those below, making them point to our dummy script.
'' ''
mkdir "$TMP/bin" mkdir "$TMP/bin"
for i in strip; do for i in strip; do
echo '#! ${stdenv.shell}' > "$TMP/bin/$i" echo '#! ${stdenv.shell}' > "$TMP/bin/$i"
chmod +x "$TMP/bin/$i" chmod +x "$TMP/bin/$i"
done done
PATH="$TMP/bin:$PATH" PATH="$TMP/bin:$PATH"
'' + '' +
# We have to patch the GMP paths for the integer-gmp package. # We have to patch the GMP paths for the integer-gmp package.
'' ''
find . -name integer-gmp.buildinfo \ find . -name integer-gmp.buildinfo \
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \; -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \;
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
find . -name base.buildinfo \ find . -name base.buildinfo \
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \; -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
'' + '' +
# 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.
stdenv.lib.optionalString stdenv.isLinux '' stdenv.lib.optionalString stdenv.isLinux ''
@ -73,24 +73,24 @@ stdenv.mkDerivation rec {
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
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
# not enough room in the object files for the full path to libiconv :( # not enough room in the object files for the full path to libiconv :(
fix () { fix () {
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-${version}/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-${version}/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-${version}/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)
done done
for file in $(find . -name setup-config); do for file in $(find . -name setup-config); do
substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)" substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
done done
''; '';
configurePhase = '' configurePhase = ''
./configure --prefix=$out \ ./configure --prefix=$out \