lol
1{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }:
2
3stdenv.mkDerivation rec {
4 version = "7.2.2";
5 name = "ghc-${version}";
6
7 src = fetchurl {
8 url = "http://haskell.org/ghc/dist/${version}/${name}-src.tar.bz2";
9 sha256 = "0g87d3z9275dniaqzkf56qfgzp1msd89nqqhhm2gkc6iga072spz";
10 };
11
12 patches = [ ./fix-7.2.2-clang.patch ];
13
14 buildInputs = [ ghc perl gmp ncurses ];
15
16 buildMK = ''
17 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib"
18 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include"
19 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include"
20 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib"
21 ${stdenv.lib.optionalString stdenv.isDarwin ''
22 libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include"
23 libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
24 ''}
25 '';
26
27 preConfigure = ''
28 echo "${buildMK}" > mk/build.mk
29 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
30 '' + stdenv.lib.optionalString stdenv.isDarwin ''
31 find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
32 find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
33 export NIX_LDFLAGS+=" -no_dtrace_dof"
34 '';
35
36 configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
37 else "--with-gcc=${stdenv.cc}/bin/gcc";
38
39 NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
40
41 # required, because otherwise all symbols from HSffi.o are stripped, and
42 # that in turn causes GHCi to abort
43 stripDebugFlags=["-S" "--keep-file-symbols"];
44
45 meta = {
46 homepage = "http://haskell.org/ghc";
47 description = "The Glasgow Haskell Compiler";
48 maintainers = [
49 stdenv.lib.maintainers.marcweber
50 stdenv.lib.maintainers.andres
51 stdenv.lib.maintainers.simons
52 ];
53 platforms = ["x86_64-linux" "i686-linux"]; # Darwin is unsupported.
54 inherit (ghc.meta) license;
55 };
56
57}