@@ -0,0 +1,61 @@
1+{ stdenv, fetchurl, fetchpatch, ghc, perl, gmp, ncurses, libiconv, binutils, coreutils
2+, libxml2, libxslt, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, hscolour
3+}:
4+
5+stdenv.mkDerivation rec {
6+ version = "8.0.0.20160111";
7+ name = "ghc-${version}";
8+
9+ src = fetchurl {
10+ url = "https://downloads.haskell.org/~ghc/8.0.1-rc1/${name}-src.tar.xz";
11+ sha256 = "0y4nha46mw01ysw90kh8szcbsfdc37rqjm7r5fyk6flqwr8b6pvr";
12+ };
13+
14+ patches = [
15+ ./dont-pass-linker-flags-via-response-files.patch # https://github.com/NixOS/nixpkgs/issues/10752
16+ ];
17+
18+ buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ];
19+
20+ enableParallelBuilding = true;
21+
22+ preConfigure = ''
23+ sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
24+ '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
25+ export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
26+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
27+ export NIX_LDFLAGS+=" -no_dtrace_dof"
28+ '';
29+
30+ configureFlags = [
31+ "--with-gcc=${stdenv.cc}/bin/cc"
32+ "--with-gmp-includes=${gmp}/include" "--with-gmp-libraries=${gmp}/lib"
33+ "--with-curses-includes=${ncurses}/include" "--with-curses-libraries=${ncurses}/lib"
34+ ] ++ stdenv.lib.optional stdenv.isDarwin [
35+ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
36+ ];
37+
38+ # required, because otherwise all symbols from HSffi.o are stripped, and
39+ # that in turn causes GHCi to abort
40+ stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
41+
42+ postInstall = ''
43+ # Install the bash completion file.
44+ install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
45+
46+ # Patch scripts to include "readelf" and "cat" in $PATH.
47+ for i in "$out/bin/"*; do
48+ test ! -h $i || continue
49+ egrep --quiet '^#!' <(head -n 1 $i) || continue
50+ sed -i -e '2i export PATH="$PATH:${binutils}/bin:${coreutils}/bin"' $i
51+ done
52+ '';
53+
54+ meta = {
55+ homepage = "http://haskell.org/ghc";
56+ description = "The Glasgow Haskell Compiler";
57+ maintainers = with stdenv.lib.maintainers; [ marcweber andres simons ];
58+ inherit (ghc.meta) license platforms;
59+ };
60+
61+}