git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #34023 from deepfire/x-ghc-8.4-master

GHC 8.4: compiler and package fixes

commit766bfd6d618e860c185e53f28a1cc61ef627cbd6 authorPeter Simons <simons@cryp.to> dateFri 19 Jan 2018, 14:43 (9 years ago) parentd2d1a2d8d027c1
3 files changed+183
pkgs/development/compilers/ghc/8.4.1.nix+129 pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix+44 pkgs/top-level/haskell-packages.nix+10
pkgs/development/compilers/ghc/8.4.1.nixnew file+129
@@ -0,0 +1,129 @@
1+{ stdenv, targetPackages
2+, buildPlatform, hostPlatform, targetPlatform
3+, selfPkgs, cross ? null
4+
5+# build-tools
6+, bootPkgs, alex, happy
7+, autoconf, automake, coreutils, fetchgit, perl, python3
8+
9+, libiconv ? null, ncurses
10+
11+, # If enabled, GHC will be built with the GPL-free but slower integer-simple
12+ # library instead of the faster but GPLed integer-gmp library.
13+ enableIntegerSimple ? false, gmp ? null
14+
15+, version ? "8.4.20180115"
16+}:
17+
18+assert !enableIntegerSimple -> gmp != null;
19+
20+let
21+ inherit (bootPkgs) ghc;
22+
23+ rev = "3e3a096885c0fcd0703edbeffb4e47f5cbd8f4cc";
24+
25+ # TODO(@Ericson2314) Make unconditional
26+ targetPrefix = stdenv.lib.optionalString
27+ (targetPlatform != hostPlatform)
28+ "${targetPlatform.config}-";
29+in
30+stdenv.mkDerivation (rec {
31+ inherit version rev;
32+ name = "${targetPrefix}ghc-${version}";
33+
34+ src = fetchgit {
35+ url = "git://git.haskell.org/ghc.git";
36+ inherit rev;
37+ sha256 = "06slymbsd7vsfp4hh40v7cxf7nmp0kvlni2wfq7ag5wlqh04slgs";
38+ };
39+
40+ postPatch = "patchShebangs .";
41+
42+ preConfigure = ''
43+ echo ${version} >VERSION
44+ echo ${rev} >GIT_COMMIT_ID
45+ ./boot
46+ sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
47+ '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
48+ export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
49+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
50+ export NIX_LDFLAGS+=" -no_dtrace_dof"
51+ '' + stdenv.lib.optionalString enableIntegerSimple ''
52+ echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
53+ '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
54+ sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
55+ '';
56+
57+ buildInputs = [ ghc perl autoconf automake happy alex python3 ];
58+
59+ enableParallelBuilding = true;
60+
61+ configureFlags = [
62+ "CC=${stdenv.cc}/bin/cc"
63+ "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
64+ "--datadir=$doc/share/doc/ghc"
65+ ] ++ stdenv.lib.optional (! enableIntegerSimple) [
66+ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
67+ ] ++ stdenv.lib.optional stdenv.isDarwin [
68+ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
69+ ];
70+
71+ # required, because otherwise all symbols from HSffi.o are stripped, and
72+ # that in turn causes GHCi to abort
73+ stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
74+
75+ checkTarget = "test";
76+
77+ postInstall = ''
78+ paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
79+
80+ # Install the bash completion file.
81+ install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
82+
83+ # Patch scripts to include "readelf" and "cat" in $PATH.
84+ for i in "$out/bin/"*; do
85+ test ! -h $i || continue
86+ egrep --quiet '^#!' <(head -n 1 $i) || continue
87+ sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
88+ done
89+ '';
90+
91+ outputs = [ "out" "doc" ];
92+
93+ passthru = {
94+ inherit bootPkgs targetPrefix;
95+ } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
96+ crossCompiler = selfPkgs.ghc.override {
97+ cross = targetPlatform;
98+ bootPkgs = selfPkgs;
99+ };
100+ };
101+
102+ meta = {
103+ homepage = http://haskell.org/ghc;
104+ description = "The Glasgow Haskell Compiler";
105+ maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
106+ inherit (ghc.meta) license platforms;
107+ };
108+
109+} // stdenv.lib.optionalAttrs (cross != null) {
110+ configureFlags = [
111+ "CC=${stdenv.cc}/bin/${cross.config}-cc"
112+ "LD=${stdenv.cc.bintools}/bin/${cross.config}-ld"
113+ "AR=${stdenv.cc.bintools}/bin/${cross.config}-ar"
114+ "NM=${stdenv.cc.bintools}/bin/${cross.config}-nm"
115+ "RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib"
116+ "--target=${cross.config}"
117+ "--enable-bootstrap-with-devel-snapshot"
118+ ] ++
119+ # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
120+ stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
121+
122+ configurePlatforms = [];
123+
124+ passthru = {
125+ inherit bootPkgs cross;
126+ cc = "${stdenv.cc}/bin/${cross.config}-cc";
127+ ld = "${stdenv.cc}/bin/${cross.config}-ld";
128+ };
129+})
pkgs/development/haskell-modules/configuration-ghc-8.4.x.nixnew file+44
@@ -0,0 +1,44 @@
1+{ pkgs, haskellLib }:
2+
3+with haskellLib;
4+
5+self: super: {
6+
7+ # Use the latest LLVM.
8+ inherit (pkgs) llvmPackages;
9+
10+ # Disable GHC 8.4.x core libraries.
11+ #
12+ # Verify against:
13+ # ls /nix/store/wnh3kxra586h9wvxrn62g4lmsri2akds-ghc-8.4.20180115/lib/ghc-8.4.20180115/ -1 | sort | grep -e '-' | grep -Ev '(txt|h|targets)$'
14+ array = null;
15+ base = null;
16+ binary = null;
17+ bytestring = null;
18+ Cabal = null;
19+ containers = null;
20+ deepseq = null;
21+ directory = null;
22+ filepath = null;
23+ bin-package-db = null;
24+ ghc-boot = null;
25+ ghc-boot-th = null;
26+ ghc-compact = null;
27+ ghci = null;
28+ ghc-prim = null;
29+ haskeline = null;
30+ hpc = null;
31+ integer-gmp = null;
32+ mtl = null;
33+ parsec = null;
34+ pretty = null;
35+ process = null;
36+ stm = null;
37+ template-haskell = null;
38+ terminfo = null;
39+ text = null;
40+ time = null;
41+ transformers = null;
42+ unix = null;
43+ xhtml = null;
44+}
pkgs/top-level/haskell-packages.nix+10
@@ -78,6 +78,12 @@ in rec {
7878 sphinx = pkgs.python3Packages.sphinx;
7979 selfPkgs = packages.ghc822;
8080 };
81+ ghc841 = callPackage ../development/compilers/ghc/8.4.1.nix rec {
82+ bootPkgs = packages.ghc821Binary;
83+ inherit (bootPkgs) alex happy;
84+ inherit buildPlatform targetPlatform;
85+ selfPkgs = packages.ghc841;
86+ };
8187 ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec {
8288 bootPkgs = packages.ghc821Binary;
8389 inherit (bootPkgs) alex happy;
@@ -136,6 +142,10 @@ in rec {
136142 ghc = compiler.ghc821Binary;
137143 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
138144 };
145+ ghc841 = callPackage ../development/haskell-modules {
146+ ghc = compiler.ghc841;
147+ compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.4.x.nix { };
148+ };
139149 ghcHEAD = callPackage ../development/haskell-modules {
140150 ghc = compiler.ghcHEAD;
141151 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };