git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #29424 from obsidiansystems/slight-haskell-cleanup

haskell infra, ghc: Slight cleanup

commit2295533f43e0ca801c3a90614db889128b0314bc authorJohn Ericson <Ericson2314@yahoo.com> dateFri 15 Sep 2017, 12:12 (9 years ago) parenta4633cae92cda1
20 files changed+272−132
pkgs/development/compilers/ghc/6.10.2-binary.nix+19−14 pkgs/development/compilers/ghc/6.10.4.nix+5 pkgs/development/compilers/ghc/6.12.3.nix+5 pkgs/development/compilers/ghc/7.0.4-binary.nix+18−15 pkgs/development/compilers/ghc/7.0.4.nix+5 pkgs/development/compilers/ghc/7.10.2.nix+21−7 pkgs/development/compilers/ghc/7.10.3.nix+21−7 pkgs/development/compilers/ghc/7.2.2.nix+6−1 pkgs/development/compilers/ghc/7.4.2-binary.nix+18−15 pkgs/development/compilers/ghc/7.4.2.nix+8−2 pkgs/development/compilers/ghc/7.6.3.nix+8−2 pkgs/development/compilers/ghc/7.8.3.nix+8−2 pkgs/development/compilers/ghc/7.8.4.nix+8−2 pkgs/development/compilers/ghc/8.0.2.nix+24−11 pkgs/development/compilers/ghc/8.2.1.nix+29−12 pkgs/development/compilers/ghc/head.nix+28−12 pkgs/development/haskell-modules/generic-builder.nix+23−15 pkgs/development/haskell-modules/make-package-set.nix+15−10 pkgs/development/haskell-modules/with-packages-wrapper.nix+2−3 pkgs/os-specific/darwin/ghc-standalone-archive/default.nix+1−2
pkgs/development/compilers/ghc/6.10.2-binary.nix+19−14
@@ -1,24 +1,29 @@
1−{stdenv, lib, fetchurl, perl, libedit, ncurses5, gmp}:
1+{ stdenv
2+, fetchurl, perl
3+, libedit, ncurses5, gmp
4+}:
5+
6+# Prebuilt only does native
7+assert stdenv.targetPlatform == stdenv.hostPlatform;
28
39stdenv.mkDerivation rec {
410 version = "6.10.2";
511
612 name = "ghc-${version}-binary";
713
8− src =
9− if stdenv.system == "i686-linux" then
10− fetchurl {
14+ src = {
15+ "i686-linux" = fetchurl {
1116 # This binary requires libedit.so.0 (rather than libedit.so.2).
1217 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
1318 sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b";
14− }
15− else if stdenv.system == "x86_64-linux" then
16− fetchurl {
19+ };
20+ "x86_64-linux" = fetchurl {
1721 # Idem.
1822 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
1923 sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj";
20− }
21− else throw "cannot bootstrap GHC on this platform";
24+ };
25+ }.${stdenv.hostPlatform.system}
26+ or (throw "cannot bootstrap GHC on this platform");
2227
2328 buildInputs = [perl];
2429
@@ -37,17 +42,17 @@ stdenv.mkDerivation rec {
3742 '' +
3843 # On Linux, use patchelf to modify the executables so that they can
3944 # find editline/gmp.
40− (if stdenv.isLinux then ''
45+ stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
4146 find . -type f -perm -0100 \
4247 -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
4348 --set-rpath "${lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \;
4449 for prog in ld ar gcc strip ranlib; do
4550 find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
4651 done
47− '' else "");
52+ '';
4853
4954 configurePhase = ''
50− ./configure --prefix=$out --with-gmp-libraries=${lib.getLib gmp}/lib --with-gmp-includes=${lib.getDev gmp}/include
55+ ./configure --prefix=$out --with-gmp-libraries=${stdenv.lib.getLib gmp}/lib --with-gmp-includes=${stdenv.lib.getDev gmp}/include
5156 '';
5257
5358 # Stripping combined with patchelf breaks the executables (they die
@@ -62,7 +67,7 @@ stdenv.mkDerivation rec {
6267 # and create some wrapper scripts that set DYLD_FRAMEWORK_PATH so
6368 # that the executables work with no special setup.
6469 postInstall =
65− (if stdenv.isDarwin then
70+ stdenv.lib.optionalString stdenv.hostPlatform.isDarwin
6671 ''
6772 mkdir -p $out/frameworks/GMP.framework/Versions/A
6873 ln -s ${gmp.out}/lib/libgmp.dylib $out/frameworks/GMP.framework/GMP
@@ -79,7 +84,7 @@ stdenv.mkDerivation rec {
7984 echo \"DYLD_FRAMEWORK_PATH=$out/frameworks exec $out/bin-orig/$i -framework-path $out/frameworks \\\"\\$@\\\"\" >> $out/bin/$i
8085 chmod +x $out/bin/$i
8186 done
82− '' else "")
87+ ''
8388 +
8489 ''
8590 # bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way
pkgs/development/compilers/ghc/6.10.4.nix+5
@@ -1,5 +1,8 @@
11{stdenv, fetchurl, libedit, ghc, perl, gmp, ncurses}:
22
3+# TODO(@Ericson2314): Cross compilation support
4+assert stdenv.targetPlatform == stdenv.hostPlatform;
5+
36stdenv.mkDerivation rec {
47 version = "6.10.4";
58
@@ -22,6 +25,8 @@ stdenv.mkDerivation rec {
2225
2326 NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
2427
28+ passthru = { prefix = ""; };
29+
2530 meta = {
2631 homepage = http://haskell.org/ghc;
2732 description = "The Glasgow Haskell Compiler";
pkgs/development/compilers/ghc/6.12.3.nix+5
@@ -1,5 +1,8 @@
11{stdenv, fetchurl, ghc, perl, gmp, ncurses}:
22
3+# TODO(@Ericson2314): Cross compilation support
4+assert stdenv.targetPlatform == stdenv.hostPlatform;
5+
36stdenv.mkDerivation rec {
47 version = "6.12.3";
58
@@ -33,6 +36,8 @@ stdenv.mkDerivation rec {
3336 # that in turn causes GHCi to abort
3437 stripDebugFlags=["-S" "--keep-file-symbols"];
3538
39+ passthru = { prefix = ""; };
40+
3641 meta = {
3742 homepage = http://haskell.org/ghc;
3843 description = "The Glasgow Haskell Compiler";
pkgs/development/compilers/ghc/7.0.4-binary.nix+18−15
@@ -1,32 +1,35 @@
1−{stdenv, fetchurl, perl, ncurses5, gmp, libiconv}:
1+{ stdenv
2+, fetchurl, perl
3+, ncurses5, gmp, libiconv
4+}:
5+
6+# Prebuilt only does native
7+assert stdenv.targetPlatform == stdenv.hostPlatform;
28
39stdenv.mkDerivation rec {
410 version = "7.0.4";
511
612 name = "ghc-${version}-binary";
713
8− src =
9− if stdenv.system == "i686-linux" then
10− fetchurl {
14+ src = {
15+ "i686-linux" = fetchurl {
1116 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
1217 sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
13− }
14− else if stdenv.system == "x86_64-linux" then
15− fetchurl {
18+ };
19+ "x86_64-linux" = fetchurl {
1620 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
1721 sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
18− }
19− else if stdenv.system == "i686-darwin" then
20− fetchurl {
22+ };
23+ "i686-darwin" = fetchurl {
2124 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
2225 sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
23− }
24− else if stdenv.system == "x86_64-darwin" then
25− fetchurl {
26+ };
27+ "x86_64-darwin" = fetchurl {
2628 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
2729 sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
28− }
29− else throw "cannot bootstrap GHC on this platform";
30+ };
31+ }.${stdenv.hostPlatform.system}
32+ or (throw "cannot bootstrap GHC on this platform");
3033
3134 buildInputs = [perl];
3235
pkgs/development/compilers/ghc/7.0.4.nix+5
@@ -1,5 +1,8 @@
11{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }:
22
3+# TODO(@Ericson2314): Cross compilation support
4+assert stdenv.targetPlatform == stdenv.hostPlatform;
5+
36stdenv.mkDerivation rec {
47 version = "7.0.4";
58 name = "ghc-${version}";
@@ -42,6 +45,8 @@ stdenv.mkDerivation rec {
4245 # that in turn causes GHCi to abort
4346 stripDebugFlags=["-S" "--keep-file-symbols"];
4447
48+ passthru = { prefix = ""; };
49+
4550 meta = {
4651 homepage = http://haskell.org/ghc;
4752 description = "The Glasgow Haskell Compiler";
pkgs/development/compilers/ghc/7.10.2.nix+21−7
@@ -1,14 +1,28 @@
1−{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, binutils, coreutils
2−, libxml2, libxslt, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, hscolour
1+{ stdenv, __targetPackages
2+, buildPlatform, hostPlatform, targetPlatform
33
4− # If enabled GHC will be build with the GPL-free but slower integer-simple
4+# build-tools
5+, bootPkgs, hscolour
6+, binutils, coreutils, fetchurl, fetchpatch, perl
7+, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, libxml2, libxslt
8+
9+, ncurses, libiconv
10+
11+, # If enabled GHC will be build with the GPL-free but slower integer-simple
512 # library instead of the faster but GPLed integer-gmp library.
6−, enableIntegerSimple ? false, gmp
13+ enableIntegerSimple ? false, gmp ? null
714}:
815
16+assert !enableIntegerSimple -> gmp != null;
17+
918let
1019 inherit (bootPkgs) ghc;
1120
21+ # TODO(@Ericson2314) Make unconditional
22+ prefix = stdenv.lib.optionalString
23+ (targetPlatform != hostPlatform)
24+ "${targetPlatform.config}-";
25+
1226 buildMK = ''
1327 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses.dev}/include"
1428 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses.out}/lib"
@@ -27,7 +41,7 @@ in
2741
2842stdenv.mkDerivation rec {
2943 version = "7.10.2";
30− name = "ghc-${version}";
44+ name = "${prefix}ghc-${version}";
3145
3246 src = fetchurl {
3347 url = "https://downloads.haskell.org/~ghc/7.10.2/${name}-src.tar.xz";
@@ -64,7 +78,7 @@ stdenv.mkDerivation rec {
6478
6579 postInstall = ''
6680 # Install the bash completion file.
67− install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
81+ install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
6882
6983 # Patch scripts to include "readelf" and "cat" in $PATH.
7084 for i in "$out/bin/"*; do
@@ -75,7 +89,7 @@ stdenv.mkDerivation rec {
7589 '';
7690
7791 passthru = {
78− inherit bootPkgs;
92+ inherit bootPkgs prefix;
7993 };
8094
8195 meta = {
pkgs/development/compilers/ghc/7.10.3.nix+21−7
@@ -1,14 +1,28 @@
1−{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, binutils, coreutils
2−, libxml2, libxslt, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, hscolour
1+{ stdenv, __targetPackages
2+, buildPlatform, hostPlatform, targetPlatform
33
4− # If enabled GHC will be build with the GPL-free but slower integer-simple
4+# build-tools
5+, bootPkgs, hscolour
6+, binutils, coreutils, fetchurl, fetchpatch, perl
7+, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, libxml2, libxslt
8+
9+, ncurses, libiconv
10+
11+, # If enabled GHC will be build with the GPL-free but slower integer-simple
512 # library instead of the faster but GPLed integer-gmp library.
6−, enableIntegerSimple ? false, gmp
13+ enableIntegerSimple ? false, gmp ? null
714}:
815
16+assert !enableIntegerSimple -> gmp != null;
17+
918let
1019 inherit (bootPkgs) ghc;
1120
21+ # TODO(@Ericson2314) Make unconditional
22+ prefix = stdenv.lib.optionalString
23+ (targetPlatform != hostPlatform)
24+ "${targetPlatform.config}-";
25+
1226 docFixes = fetchurl {
1327 url = "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3a.patch";
1428 sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0";
@@ -18,7 +32,7 @@ in
1832
1933stdenv.mkDerivation rec {
2034 version = "7.10.3";
21− name = "ghc-${version}";
35+ name = "${prefix}ghc-${version}";
2236
2337 src = fetchurl {
2438 url = "https://downloads.haskell.org/~ghc/${version}/${name}-src.tar.xz";
@@ -62,7 +76,7 @@ stdenv.mkDerivation rec {
6276
6377 postInstall = ''
6478 # Install the bash completion file.
65− install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
79+ install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
6680
6781 # Patch scripts to include "readelf" and "cat" in $PATH.
6882 for i in "$out/bin/"*; do
@@ -73,7 +87,7 @@ stdenv.mkDerivation rec {
7387 '';
7488
7589 passthru = {
76− inherit bootPkgs;
90+ inherit bootPkgs prefix;
7791 };
7892
7993 meta = {
pkgs/development/compilers/ghc/7.2.2.nix+6−1
@@ -2,9 +2,12 @@
22
33 # If enabled GHC will be build with the GPL-free but slower integer-simple
44 # library instead of the faster but GPLed integer-gmp library.
5−, enableIntegerSimple ? false, gmp
5+, enableIntegerSimple ? false, gmp ? null
66}:
77
8+# TODO(@Ericson2314): Cross compilation support
9+assert stdenv.targetPlatform == stdenv.hostPlatform;
10+
811stdenv.mkDerivation rec {
912 version = "7.2.2";
1013 name = "ghc-${version}";
@@ -51,6 +54,8 @@ stdenv.mkDerivation rec {
5154 # that in turn causes GHCi to abort
5255 stripDebugFlags=["-S" "--keep-file-symbols"];
5356
57+ passthru = { prefix = ""; };
58+
5459 meta = {
5560 homepage = http://haskell.org/ghc;
5661 description = "The Glasgow Haskell Compiler";
pkgs/development/compilers/ghc/7.4.2-binary.nix+18−15
@@ -1,32 +1,35 @@
1−{stdenv, fetchurl, perl, ncurses5, gmp, libiconv, makeWrapper}:
1+{ stdenv
2+, fetchurl, perl, makeWrapper
3+, ncurses5, gmp, libiconv
4+}:
5+
6+# Prebuilt only does native
7+assert stdenv.targetPlatform == stdenv.hostPlatform;
28
39stdenv.mkDerivation rec {
410 version = "7.4.2";
511
612 name = "ghc-${version}-binary";
713
8− src =
9− if stdenv.system == "i686-linux" then
10− fetchurl {
14+ src = {
15+ "i686-linux" = fetchurl {
1116 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
1217 sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi";
13− }
14− else if stdenv.system == "x86_64-linux" then
15− fetchurl {
18+ };
19+ "x86_64-linux" = fetchurl {
1620 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
1721 sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns";
18− }
19− else if stdenv.system == "i686-darwin" then
20− fetchurl {
22+ };
23+ "i686-darwin" = fetchurl {
2124 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
2225 sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0";
23− }
24− else if stdenv.system == "x86_64-darwin" then
25− fetchurl {
26+ };
27+ "x86_64-darwin" = fetchurl {
2628 url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
2729 sha256 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf";
28− }
29− else throw "cannot bootstrap GHC on this platform";
30+ };
31+ }.${stdenv.hostPlatform.system}
32+ or (throw "cannot bootstrap GHC on this platform");
3033
3134 buildInputs = [perl];
3235
pkgs/development/compilers/ghc/7.4.2.nix+8−2
@@ -1,10 +1,14 @@
11{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
22
3− # If enabled GHC will be build with the GPL-free but slower integer-simple
3+, # If enabled GHC will be build with the GPL-free but slower integer-simple
44 # library instead of the faster but GPLed integer-gmp library.
5−, enableIntegerSimple ? false, gmp
5+ enableIntegerSimple ? false, gmp ? null
66}:
77
8+# TODO(@Ericson2314): Cross compilation support
9+assert stdenv.targetPlatform == stdenv.hostPlatform;
10+assert !enableIntegerSimple -> gmp != null;
11+
812stdenv.mkDerivation rec {
913 version = "7.4.2";
1014
@@ -52,6 +56,8 @@ stdenv.mkDerivation rec {
5256 # that in turn causes GHCi to abort
5357 stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
5458
59+ passthru = { prefix = ""; };
60+
5561 meta = {
5662 homepage = http://haskell.org/ghc;
5763 description = "The Glasgow Haskell Compiler";
pkgs/development/compilers/ghc/7.6.3.nix+8−2
@@ -1,10 +1,14 @@
11{ stdenv, fetchurl, ghc, perl, ncurses, binutils, libiconv
22
3− # If enabled GHC will be build with the GPL-free but slower integer-simple
3+, # If enabled GHC will be build with the GPL-free but slower integer-simple
44 # library instead of the faster but GPLed integer-gmp library.
5−, enableIntegerSimple ? false, gmp
5+ enableIntegerSimple ? false, gmp ? null
66}:
77
8+# TODO(@Ericson2314): Cross compilation support
9+assert stdenv.targetPlatform == stdenv.hostPlatform;
10+assert !enableIntegerSimple -> gmp != null;
11+
812let
913 # The "-Wa,--noexecstack" options might be needed only with GNU ld (as opposed
1014 # to the gold linker). It prevents binaries' stacks from being marked as
@@ -78,6 +82,8 @@ in stdenv.mkDerivation rec {
7882 # that in turn causes GHCi to abort
7983 stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
8084
85+ passthru = { prefix = ""; };
86+
8187 meta = {
8288 homepage = http://haskell.org/ghc;
8389 description = "The Glasgow Haskell Compiler";
pkgs/development/compilers/ghc/7.8.3.nix+8−2
@@ -1,10 +1,14 @@
11{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
22
3− # If enabled GHC will be build with the GPL-free but slower integer-simple
3+, # If enabled GHC will be build with the GPL-free but slower integer-simple
44 # library instead of the faster but GPLed integer-gmp library.
5−, enableIntegerSimple ? false, gmp
5+ enableIntegerSimple ? false, gmp ? null
66}:
77
8+# TODO(@Ericson2314): Cross compilation support
9+assert stdenv.targetPlatform == stdenv.hostPlatform;
10+assert !enableIntegerSimple -> gmp != null;
11+
812stdenv.mkDerivation rec {
913 version = "7.8.3";
1014 name = "ghc-${version}";
@@ -49,6 +53,8 @@ stdenv.mkDerivation rec {
4953 # that in turn causes GHCi to abort
5054 stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
5155
56+ passthru = { prefix = ""; };
57+
5258 meta = {
5359 homepage = http://haskell.org/ghc;
5460 description = "The Glasgow Haskell Compiler";
pkgs/development/compilers/ghc/7.8.4.nix+8−2
@@ -1,10 +1,14 @@
11{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
22
3− # If enabled GHC will be build with the GPL-free but slower integer-simple
3+, # If enabled GHC will be build with the GPL-free but slower integer-simple
44 # library instead of the faster but GPLed integer-gmp library.
5−, enableIntegerSimple ? false, gmp
5+ enableIntegerSimple ? false, gmp ? null
66}:
77
8+# TODO(@Ericson2314): Cross compilation support
9+assert stdenv.targetPlatform == stdenv.hostPlatform;
10+assert !enableIntegerSimple -> gmp != null;
11+
812stdenv.mkDerivation (rec {
913 version = "7.8.4";
1014 name = "ghc-${version}";
@@ -49,6 +53,8 @@ stdenv.mkDerivation (rec {
4953 # that in turn causes GHCi to abort
5054 stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
5155
56+ passthru = { prefix = ""; };
57+
5258 meta = {
5359 homepage = http://haskell.org/ghc;
5460 description = "The Glasgow Haskell Compiler";
pkgs/development/compilers/ghc/8.0.2.nix+24−11
@@ -1,18 +1,30 @@
1−{ stdenv, lib, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, binutils, coreutils
2−, hscolour, patchutils, sphinx
1+{ stdenv, __targetPackages
2+, buildPlatform, hostPlatform, targetPlatform
33
4− # If enabled GHC will be build with the GPL-free but slower integer-simple
4+# build-tools
5+, bootPkgs, hscolour
6+, binutils, coreutils, fetchurl, fetchpatch, patchutils, perl, sphinx
7+
8+, libiconv, ncurses
9+
10+, # If enabled GHC will be build with the GPL-free but slower integer-simple
511 # library instead of the faster but GPLed integer-gmp library.
6−, enableIntegerSimple ? false, gmp
7−, cross ? null
12+ enableIntegerSimple ? false, gmp ? null
813}:
914
15+assert !enableIntegerSimple -> gmp != null;
16+
1017let
1118 inherit (bootPkgs) ghc;
19+
20+ # TODO(@Ericson2314) Make unconditional
21+ prefix = stdenv.lib.optionalString
22+ (targetPlatform != hostPlatform)
23+ "${targetPlatform.config}-";
1224in
1325stdenv.mkDerivation rec {
1426 version = "8.0.2";
15− name = "ghc-${version}";
27+ name = "${prefix}ghc-${version}";
1628
1729 src = fetchurl {
1830 url = "https://downloads.haskell.org/~ghc/8.0.2/${name}-src.tar.xz";
@@ -47,19 +59,20 @@ stdenv.mkDerivation rec {
4759 "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
4860 ] ++ stdenv.lib.optional stdenv.isDarwin [
4961 "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
50− ] ++
62+ ] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
5163 # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
52− lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
64+ "--disable-large-address-space"
65+ ];
5366
5467 # required, because otherwise all symbols from HSffi.o are stripped, and
5568 # that in turn causes GHCi to abort
5669 stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
5770
5871 postInstall = ''
59− paxmark m $out/lib/${name}/bin/{ghc,haddock}
72+ paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
6073
6174 # Install the bash completion file.
62− install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
75+ install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
6376
6477 # Patch scripts to include "readelf" and "cat" in $PATH.
6578 for i in "$out/bin/"*; do
@@ -70,7 +83,7 @@ stdenv.mkDerivation rec {
7083 '';
7184
7285 passthru = {
73− inherit bootPkgs;
86+ inherit bootPkgs prefix;
7487 };
7588
7689 meta = {
pkgs/development/compilers/ghc/8.2.1.nix+29−12
@@ -1,16 +1,30 @@
1−{ stdenv, lib, fetchurl, bootPkgs, perl, ncurses, libiconv, binutils, coreutils
2−, autoconf, automake, happy, alex, python3, sphinx, hscolour
3−, buildPlatform, targetPlatform , selfPkgs, cross ? null
1+{ stdenv, __targetPackages
2+, buildPlatform, hostPlatform, targetPlatform
3+, selfPkgs, cross ? null
44
5− # If enabled GHC will be build with the GPL-free but slower integer-simple
5+# build-tools
6+, bootPkgs, alex, happy, hscolour
7+, autoconf, automake, binutils, coreutils, fetchurl, perl, python3, sphinx
8+
9+, libiconv ? null, ncurses
10+
11+, # If enabled, GHC will be build with the GPL-free but slower integer-simple
612 # library instead of the faster but GPLed integer-gmp library.
7−, enableIntegerSimple ? false, gmp
13+ enableIntegerSimple ? false, gmp ? null
814}:
915
16+assert !enableIntegerSimple -> gmp != null;
17+
1018let
1119 inherit (bootPkgs) ghc;
20+
1221 version = "8.2.1";
1322
23+ # TODO(@Ericson2314) Make unconditional
24+ prefix = stdenv.lib.optionalString
25+ (targetPlatform != hostPlatform)
26+ "${targetPlatform.config}-";
27+
1428 commonBuildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ];
1529 commonPreConfigure = ''
1630 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
@@ -21,9 +35,10 @@ let
2135 '' + stdenv.lib.optionalString enableIntegerSimple ''
2236 echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
2337 '';
24−in stdenv.mkDerivation (rec {
38+in
39+stdenv.mkDerivation (rec {
2540 inherit version;
26− name = "ghc-${version}";
41+ name = "${prefix}ghc-${version}";
2742
2843 src = fetchurl {
2944 url = "https://downloads.haskell.org/~ghc/${version}/${name}-src.tar.xz";
@@ -52,15 +67,17 @@ in stdenv.mkDerivation (rec {
5267
5368 # required, because otherwise all symbols from HSffi.o are stripped, and
5469 # that in turn causes GHCi to abort
55− stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
70+ stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
5671
5772 checkTarget = "test";
5873
74+ # zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
75+ # treat that as a unary `{x,y,z,..}` repetition.
5976 postInstall = ''
60− paxmark m $out/lib/${name}/bin/{ghc,haddock}
77+ paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
6178
6279 # Install the bash completion file.
63− install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
80+ install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
6481
6582 # Patch scripts to include "readelf" and "cat" in $PATH.
6683 for i in "$out/bin/"*; do
@@ -73,7 +90,7 @@ in stdenv.mkDerivation (rec {
7390 outputs = [ "out" "doc" ];
7491
7592 passthru = {
76− inherit bootPkgs;
93+ inherit bootPkgs prefix;
7794 } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
7895 crossCompiler = selfPkgs.ghc.override {
7996 cross = targetPlatform;
@@ -105,7 +122,7 @@ in stdenv.mkDerivation (rec {
105122 "--enable-bootstrap-with-devel-snapshot"
106123 ] ++
107124 # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
108− lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
125+ stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
109126
110127 buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutils ];
111128
pkgs/development/compilers/ghc/head.nix+28−12
@@ -1,20 +1,33 @@
1−{ stdenv, lib, fetchgit, bootPkgs, perl, ncurses, libiconv, binutils, coreutils
2−, autoconf, automake, happy, alex, python3, buildPlatform, targetPlatform
1+{ stdenv, __targetPackages
2+, buildPlatform, hostPlatform, targetPlatform
33, selfPkgs, cross ? null
44
5− # If enabled GHC will be build with the GPL-free but slower integer-simple
5+# build-tools
6+, bootPkgs, alex, happy
7+, autoconf, automake, binutils, coreutils, fetchgit, perl, python3
8+
9+, libiconv ? null, ncurses
10+
11+, # If enabled, GHC will be build with the GPL-free but slower integer-simple
612 # library instead of the faster but GPLed integer-gmp library.
7−, enableIntegerSimple ? false, gmp
13+ enableIntegerSimple ? false, gmp ? null
14+
815, version ? "8.3.20170808"
916}:
1017
18+assert !enableIntegerSimple -> gmp != null;
19+
1120let
1221 inherit (bootPkgs) ghc;
1322
14− commonBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
15−
1623 rev = "14457cf6a50f708eecece8f286f08687791d51f7";
1724
25+ # TODO(@Ericson2314) Make unconditional
26+ prefix = stdenv.lib.optionalString
27+ (targetPlatform != hostPlatform)
28+ "${targetPlatform.config}-";
29+
30+ commonBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
1831 commonPreConfigure = ''
1932 echo ${version} >VERSION
2033 echo ${rev} >GIT_COMMIT_ID
@@ -27,7 +40,8 @@ let
2740 '' + stdenv.lib.optionalString enableIntegerSimple ''
2841 echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
2942 '';
30−in stdenv.mkDerivation (rec {
43+in
44+stdenv.mkDerivation (rec {
3145 inherit version rev;
3246 name = "ghc-${version}";
3347
@@ -57,15 +71,17 @@ in stdenv.mkDerivation (rec {
5771
5872 # required, because otherwise all symbols from HSffi.o are stripped, and
5973 # that in turn causes GHCi to abort
60− stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
74+ stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
6175
6276 checkTarget = "test";
6377
78+ # zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
79+ # treat that as a unary `{x,y,z,..}` repetition.
6480 postInstall = ''
65− paxmark m $out/lib/${name}/bin/{ghc,haddock}
81+ paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
6682
6783 # Install the bash completion file.
68− install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
84+ install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
6985
7086 # Patch scripts to include "readelf" and "cat" in $PATH.
7187 for i in "$out/bin/"*; do
@@ -78,7 +94,7 @@ in stdenv.mkDerivation (rec {
7894 outputs = [ "out" "doc" ];
7995
8096 passthru = {
81− inherit bootPkgs;
97+ inherit bootPkgs prefix;
8298 } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
8399 crossCompiler = selfPkgs.ghc.override {
84100 cross = targetPlatform;
@@ -110,7 +126,7 @@ in stdenv.mkDerivation (rec {
110126 "--enable-bootstrap-with-devel-snapshot"
111127 ] ++
112128 # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
113− lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
129+ stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
114130
115131 buildInputs = commonBuildInputs;
116132
pkgs/development/haskell-modules/generic-builder.nix+23−15
@@ -1,7 +1,14 @@
1−{ stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused
2−, jailbreak-cabal, hscolour, cpphs, nodejs, lib, removeReferencesTo
1+{ stdenv, buildPackages, ghc
2+, jailbreak-cabal, hscolour, cpphs, nodejs
3+, buildPlatform, hostPlatform
34}:
4−let isCross = (ghc.cross or null) != null; in
5+
6+let
7+ isCross = buildPlatform != hostPlatform;
8+ inherit (buildPackages)
9+ fetchurl removeReferencesTo
10+ pkgconfig binutils coreutils gnugrep gnused glibcLocales;
11+in
512
613{ pname
714, dontStrip ? (ghc.isGhcjs or false)
@@ -20,8 +27,8 @@ let isCross = (ghc.cross or null) != null; in
2027, enableLibraryProfiling ? false
2128, enableExecutableProfiling ? false
2229# TODO enable shared libs for cross-compiling
23−, enableSharedExecutables ? !isCross && (((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version))
24−, enableSharedLibraries ? !isCross && (((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version))
30+, enableSharedExecutables ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
31+, enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
2532, enableSplitObjs ? null # OBSOLETE, use enableDeadCodeElimination
2633, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
2734, enableStaticLibraries ? true
@@ -53,7 +60,7 @@ let isCross = (ghc.cross or null) != null; in
5360, shellHook ? ""
5461, coreSetup ? false # Use only core packages to build Setup.hs.
5562, useCpphs ? false
56−, hardeningDisable ? lib.optional (ghc.isHaLVM or false) "all"
63+, hardeningDisable ? stdenv.lib.optional (ghc.isHaLVM or false) "all"
5764, enableSeparateDataOutput ? false
5865, enableSeparateDocOutput ? doHaddock
5966} @ args:
@@ -102,11 +109,12 @@ let
102109 enableParallelBuilding = (versionOlder "7.8" ghc.version && !hasActiveLibrary) || versionOlder "8.0.1" ghc.version;
103110
104111 crossCabalFlags = [
105− "--with-ghc=${ghc.cross.config}-ghc"
106− "--with-ghc-pkg=${ghc.cross.config}-ghc-pkg"
107− "--with-gcc=${ghc.cc}"
108− "--with-ld=${ghc.ld}"
112+ "--with-ghc=${ghc.prefix}ghc"
113+ "--with-ghc-pkg=${ghc.prefix}ghc-pkg"
114+ "--with-gcc=${ghc.prefix}cc"
115+ "--with-ld=${ghc.prefix}ld"
109116 "--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
117+ "--with-strip=${binutils}/bin/${ghc.prefix}strip"
110118 ] ++ (if isHaLVM then [] else ["--hsc2hs-options=--cross-compile"]);
111119
112120 crossCabalFlagsString =
@@ -135,7 +143,7 @@ let
135143 ] ++ optionals isGhcjs [
136144 "--ghcjs"
137145 ] ++ optionals isCross ([
138− "--configure-option=--host=${ghc.cross.config}"
146+ "--configure-option=--host=${hostPlatform.config}"
139147 ] ++ crossCabalFlags);
140148
141149 setupCompileFlags = [
@@ -170,8 +178,7 @@ let
170178 setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand;
171179 setupCommand = "./Setup";
172180 ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
173− crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
174− ghcCommand = "${crossPrefix}${ghcCommand'}";
181+ ghcCommand = "${ghc.prefix}${ghcCommand'}";
175182 ghcCommandCaps= toUpper ghcCommand';
176183
177184in
@@ -268,6 +275,8 @@ stdenv.mkDerivation ({
268275 runHook postCompileBuildDriver
269276 '';
270277
278+ inherit configureFlags;
279+
271280 configurePhase = ''
272281 runHook preConfigure
273282
@@ -393,7 +402,6 @@ stdenv.mkDerivation ({
393402// optionalAttrs (postCompileBuildDriver != "") { inherit postCompileBuildDriver; }
394403// optionalAttrs (preUnpack != "") { inherit preUnpack; }
395404// optionalAttrs (postUnpack != "") { inherit postUnpack; }
396−// optionalAttrs (configureFlags != []) { inherit configureFlags; }
397405// optionalAttrs (patches != []) { inherit patches; }
398406// optionalAttrs (patchPhase != "") { inherit patchPhase; }
399407// optionalAttrs (preConfigure != "") { inherit preConfigure; }
@@ -412,5 +420,5 @@ stdenv.mkDerivation ({
412420// optionalAttrs (postFixup != "") { inherit postFixup; }
413421// optionalAttrs (dontStrip) { inherit dontStrip; }
414422// optionalAttrs (hardeningDisable != []) { inherit hardeningDisable; }
415−// optionalAttrs (stdenv.isLinux) { LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
423+// optionalAttrs (buildPlatform.isLinux){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; }
416424)
pkgs/development/haskell-modules/make-package-set.nix+15−10
@@ -1,7 +1,10 @@
11# This expression takes a file like `hackage-packages.nix` and constructs
22# a full package set out of that.
33
4−{ # package-set used for non-haskell dependencies (all of nixpkgs)
4+{ # package-set used for build tools (all of nixpkgs)
5+ buildPackages
6+
7+, # package-set used for non-haskell dependencies (all of nixpkgs)
58 pkgs
69
710, # stdenv to use for building haskell packages
@@ -28,19 +31,21 @@
2831self:
2932
3033let
34+ inherit (stdenv) buildPlatform hostPlatform;
3135
3236 inherit (stdenv.lib) fix' extends makeOverridable;
3337 inherit (haskellLib) overrideCabal;
3438
39+ buildHaskellPackages = if hostPlatform != buildPlatform
40+ then self.ghc.bootPkgs
41+ else self;
42+
3543 mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
3644 inherit stdenv;
37− inherit (pkgs) fetchurl pkgconfig glibcLocales coreutils gnugrep gnused;
38− nodejs = pkgs.nodejs-slim;
39− jailbreak-cabal = if (self.ghc.cross or null) != null
40− then self.ghc.bootPkgs.jailbreak-cabal
41− else self.jailbreak-cabal;
45+ nodejs = buildPackages.nodejs-slim;
46+ inherit (buildHaskellPackages) jailbreak-cabal;
4247 inherit (self) ghc;
43− hscolour = overrideCabal self.hscolour (drv: {
48+ hscolour = overrideCabal buildHaskellPackages.hscolour (drv: {
4449 isLibrary = false;
4550 doHaddock = false;
4651 hyperlinkSource = false; # Avoid depending on hscolour for this build.
@@ -104,13 +109,13 @@ let
104109 haskellSrc2nix = { name, src, sha256 ? null }:
105110 let
106111 sha256Arg = if isNull sha256 then "--sha256=" else ''--sha256="${sha256}"'';
107− in pkgs.stdenv.mkDerivation {
112+ in pkgs.buildPackages.stdenv.mkDerivation {
108113 name = "cabal2nix-${name}";
109− buildInputs = [ pkgs.haskellPackages.cabal2nix ];
114+ nativeBuildInputs = [ pkgs.buildPackages.haskellPackages.cabal2nix ];
110115 preferLocalBuild = true;
111116 phases = ["installPhase"];
112117 LANG = "en_US.UTF-8";
113− LOCALE_ARCHIVE = pkgs.lib.optionalString pkgs.stdenv.isLinux "${pkgs.glibcLocales}/lib/locale/locale-archive";
118+ LOCALE_ARCHIVE = pkgs.lib.optionalString buildPlatform.isLinux "${buildPackages.glibcLocales}/lib/locale/locale-archive";
114119 installPhase = ''
115120 export HOME="$TMP"
116121 mkdir -p "$out"
pkgs/development/haskell-modules/with-packages-wrapper.nix+2−3
@@ -36,9 +36,8 @@ let
3636 isHaLVM = ghc.isHaLVM or false;
3737 ghc761OrLater = isGhcjs || isHaLVM || lib.versionOlder "7.6.1" ghc.version;
3838 packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
39− ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
40− crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
41− ghcCommand = "${crossPrefix}${ghcCommand'}";
39+ ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
40+ ghcCommand = "${ghc.prefix}${ghcCommand'}";
4241 ghcCommandCaps= lib.toUpper ghcCommand';
4342 libDir = if isHaLVM then "$out/lib/HaLVM-${ghc.version}" else "$out/lib/${ghcCommand}-${ghc.version}";
4443 docDir = "$out/share/doc/ghc/html";
pkgs/os-specific/darwin/ghc-standalone-archive/default.nix+1−2
@@ -2,8 +2,7 @@
22{ haskellPackages, src, deps ? p : [], name }: let
33 inherit (haskellPackages) ghc ghcWithPackages;
44 with-env = ghcWithPackages deps;
5− crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
6− ghcName = "${crossPrefix}ghc";
5+ ghcName = "${ghc.prefix}ghc";
76in runCommand name { buildInputs = [ with-env cctools ]; } ''
87 mkdir -p $out/lib
98 mkdir -p $out/include