lol
1{ stdenv, fetchgit, ghc, perl, gmp, ncurses, libiconv, autoconf, automake, happy, alex }:
2
3let
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 DYNAMIC_BY_DEFAULT = NO
11 ${stdenv.lib.optionalString stdenv.isDarwin ''
12 libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include"
13 libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
14 ''}
15 '';
16
17in
18
19stdenv.mkDerivation rec {
20 version = "7.11.20150809";
21 name = "ghc-${version}";
22 rev = "a40ec755d8e020cd4b87975f5a751f1e35c36977";
23
24 src = fetchgit {
25 url = "git://git.haskell.org/ghc.git";
26 inherit rev;
27 sha256 = "1hh1p9vrd1nrfi56jan4bnlczld2qzx85v7lfb6nara2bhcgqa1l";
28 };
29
30 postUnpack = ''
31 pushd ghc-${builtins.substring 0 7 rev}
32 echo ${version} >VERSION
33 echo ${rev} >GIT_COMMIT_ID
34 patchShebangs .
35 ./boot
36 popd
37 '';
38
39 buildInputs = [ ghc perl autoconf automake happy alex ];
40
41 preConfigure = ''
42 echo >mk/build.mk "${buildMK}"
43 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
44 '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
45 export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
46 '';
47
48 configureFlags = [
49 "--with-gcc=${stdenv.cc}/bin/cc"
50 "--with-gmp-includes=${gmp}/include" "--with-gmp-libraries=${gmp}/lib"
51 ];
52
53 enableParallelBuilding = true;
54
55 # required, because otherwise all symbols from HSffi.o are stripped, and
56 # that in turn causes GHCi to abort
57 stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
58
59 meta = {
60 homepage = "http://haskell.org/ghc";
61 description = "The Glasgow Haskell Compiler";
62 maintainers = with stdenv.lib.maintainers; [ marcweber andres simons ];
63 inherit (ghc.meta) license platforms;
64 };
65
66}