@@ -9,24 +9,24 @@ stdenv.mkDerivation rec {
99 name = "ghc-${version}-binary";
1010
1111 src = fetchurl ({
12− "i686-linux" = {
13− url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
14− sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
15− };
16− "x86_64-linux" = {
17− url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
18− sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
19− };
20− "i686-darwin" = {
21− url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
22− sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
23− };
24− "x86_64-darwin" = {
25− url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
26− sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
27− };
28− }.${stdenv.hostPlatform.system}
29− or (throw "cannot bootstrap GHC on this platform"));
12+ "i686-linux" = {
13+ url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
14+ sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
15+ };
16+ "x86_64-linux" = {
17+ url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
18+ sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
19+ };
20+ "i686-darwin" = {
21+ url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
22+ sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
23+ };
24+ "x86_64-darwin" = {
25+ url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
26+ sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
27+ };
28+ }.${stdenv.hostPlatform.system}
29+ or (throw "cannot bootstrap GHC on this platform"));
3030
3131 buildInputs = [perl];
3232
@@ -41,22 +41,22 @@ stdenv.mkDerivation rec {
4141 # first. The GHC Cabal build system makes use of strip by default and
4242 # has hardcoded paths to /usr/bin/strip in many places. We replace
4343 # those below, making them point to our dummy script.
44− ''
44+ ''
4545 mkdir "$TMP/bin"
4646 for i in strip; do
4747 echo '#! ${stdenv.shell}' > "$TMP/bin/$i"
4848 chmod +x "$TMP/bin/$i"
4949 done
5050 PATH="$TMP/bin:$PATH"
51− '' +
51+ '' +
5252 # We have to patch the GMP paths for the integer-gmp package.
53− ''
53+ ''
5454 find . -name integer-gmp.buildinfo \
5555 -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \;
56− '' + stdenv.lib.optionalString stdenv.isDarwin ''
56+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
5757 find . -name base.buildinfo \
5858 -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
59− '' +
59+ '' +
6060 # On Linux, use patchelf to modify the executables so that they can
6161 # find editline/gmp.
6262 stdenv.lib.optionalString stdenv.isLinux ''
@@ -68,24 +68,24 @@ stdenv.mkDerivation rec {
6868 for prog in ld ar gcc strip ranlib; do
6969 find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
7070 done
71− '' + stdenv.lib.optionalString stdenv.isDarwin ''
72− # not enough room in the object files for the full path to libiconv :(
73− fix () {
74− install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
75− }
71+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
72+ # not enough room in the object files for the full path to libiconv :(
73+ fix () {
74+ install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
75+ }
7676
77− ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/ghc-pwd/dist/build/tmp
78− ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/hpc/dist/build/tmp
79− ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/ghc/stage2/build/tmp
77+ ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/ghc-pwd/dist/build/tmp
78+ ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/utils/hpc/dist/build/tmp
79+ ln -s ${libiconv}/lib/libiconv.dylib ghc-${version}/ghc/stage2/build/tmp
8080
81− for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
82− fix $(find . -type f -name $file)
83− done
81+ for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
82+ fix $(find . -type f -name $file)
83+ done
8484
85− for file in $(find . -name setup-config); do
86− substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
87− done
88− '';
85+ for file in $(find . -name setup-config); do
86+ substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
87+ done
88+ '';
8989
9090 configurePhase = ''
9191 ./configure --prefix=$out \
@@ -101,19 +101,18 @@ stdenv.mkDerivation rec {
101101 # calls install-strip ...
102102 dontBuild = true;
103103
104− postInstall =
105− ''
106− # Sanity check, can ghc create executables?
107− cd $TMP
108− mkdir test-ghc; cd test-ghc
109− cat > main.hs << EOF
110− module Main where
111− main = putStrLn "yes"
112− EOF
113− $out/bin/ghc --make main.hs
114− echo compilation ok
115− [ $(./main) == "yes" ]
116− '';
104+ postInstall = ''
105+ # Sanity check, can ghc create executables?
106+ cd $TMP
107+ mkdir test-ghc; cd test-ghc
108+ cat > main.hs << EOF
109+ module Main where
110+ main = putStrLn "yes"
111+ EOF
112+ $out/bin/ghc --make main.hs
113+ echo compilation ok
114+ [ $(./main) == "yes" ]
115+ '';
117116
118117 meta.license = stdenv.lib.licenses.bsd3;
119118 meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];