@@ -1,24 +1,26 @@
1−{stdenv, lib, fetchurl, perl, libedit, ncurses5, gmp}:
1+{ stdenv
2+, fetchurl, perl
3+, libedit, ncurses5, gmp
4+}:
25
36stdenv.mkDerivation rec {
47 version = "6.10.2";
58
69 name = "ghc-${version}-binary";
710
8− src =
9− if stdenv.system == "i686-linux" then
10− fetchurl {
11+ src = fetchurl ({
12+ "i686-linux" = {
1113 # This binary requires libedit.so.0 (rather than libedit.so.2).
1214 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
1315 sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b";
14− }
15− else if stdenv.system == "x86_64-linux" then
16− fetchurl {
16+ };
17+ "x86_64-linux" = {
1718 # Idem.
1819 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
1920 sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj";
20− }
21− else throw "cannot bootstrap GHC on this platform";
21+ };
22+ }.${stdenv.hostPlatform.system}
23+ or (throw "cannot bootstrap GHC on this platform"));
2224
2325 buildInputs = [perl];
2426
@@ -37,17 +39,17 @@ stdenv.mkDerivation rec {
3739 '' +
3840 # On Linux, use patchelf to modify the executables so that they can
3941 # find editline/gmp.
40− (if stdenv.isLinux then ''
42+ stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
4143 find . -type f -perm -0100 \
4244 -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
43− --set-rpath "${lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \;
45+ --set-rpath "${stdenv.lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \;
4446 for prog in ld ar gcc strip ranlib; do
4547 find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
4648 done
47− '' else "");
49+ '';
4850
4951 configurePhase = ''
50− ./configure --prefix=$out --with-gmp-libraries=${lib.getLib gmp}/lib --with-gmp-includes=${lib.getDev gmp}/include
52+ ./configure --prefix=$out --with-gmp-libraries=${stdenv.lib.getLib gmp}/lib --with-gmp-includes=${stdenv.lib.getDev gmp}/include
5153 '';
5254
5355 # Stripping combined with patchelf breaks the executables (they die