@@ -0,0 +1,56 @@
1+{ stdenv, fetchurl, fetchpatch, ghc, perl, gmp, ncurses, libiconv }:
2+
3+let
4+
5+ buildMK = ''
6+ libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib"
7+ libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include"
8+ libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include"
9+ libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib"
10+ ${stdenv.lib.optionalString stdenv.isDarwin ''
11+ libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include"
12+ libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
13+ ''}
14+ '';
15+
16+in
17+
18+stdenv.mkDerivation rec {
19+ version = "7.10.1.20150630";
20+ name = "ghc-${version}";
21+
22+ src = fetchurl {
23+ url = "https://downloads.haskell.org/~ghc/7.10.2-rc2/${name}-src.tar.xz";
24+ sha256 = "1wxf7jkkgpvvrg3q311c4rca4vsxrqrmnrqg4j4klgj445yj82gb";
25+ };
26+
27+ buildInputs = [ ghc perl ];
28+
29+ enableParallelBuilding = true;
30+
31+ preConfigure = ''
32+ echo >mk/build.mk "${buildMK}"
33+ sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
34+ '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
35+ export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
36+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
37+ export NIX_LDFLAGS+=" -no_dtrace_dof"
38+ '';
39+
40+ configureFlags = [
41+ "--with-gcc=${stdenv.cc}/bin/cc"
42+ "--with-gmp-includes=${gmp}/include" "--with-gmp-libraries=${gmp}/lib"
43+ ];
44+
45+ # required, because otherwise all symbols from HSffi.o are stripped, and
46+ # that in turn causes GHCi to abort
47+ stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
48+
49+ meta = {
50+ homepage = "http://haskell.org/ghc";
51+ description = "The Glasgow Haskell Compiler";
52+ maintainers = with stdenv.lib.maintainers; [ marcweber andres simons ];
53+ inherit (ghc.meta) license platforms;
54+ };
55+
56+}