summary refs log tree commit diff
path: root/pkgs/development/compilers/ghc/8.0.2.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2018-05-22 20:37:45 +0200
committerGitHub <noreply@github.com>2018-05-22 20:37:45 +0200
commit0e35858252220922622491557e974e90281fa35f (patch)
tree42d07b3c76fc90a06cf766258909405effff0b44 /pkgs/development/compilers/ghc/8.0.2.nix
parent65c327325086fc6ffce0c72af3d09b1474b0a41f (diff)
parent4b480942851d72bc6f292539b1e9a0c100323fae (diff)
downloadnixlib-0e35858252220922622491557e974e90281fa35f.tar
nixlib-0e35858252220922622491557e974e90281fa35f.tar.gz
nixlib-0e35858252220922622491557e974e90281fa35f.tar.bz2
nixlib-0e35858252220922622491557e974e90281fa35f.tar.lz
nixlib-0e35858252220922622491557e974e90281fa35f.tar.xz
nixlib-0e35858252220922622491557e974e90281fa35f.tar.zst
nixlib-0e35858252220922622491557e974e90281fa35f.zip
Merge pull request #40929 from obsidiansystems/cross-ghc-for-master
ghc, haskell infra: #40642 direct to master
Diffstat (limited to 'pkgs/development/compilers/ghc/8.0.2.nix')
-rw-r--r--pkgs/development/compilers/ghc/8.0.2.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix
index 4017a01e7027..3ab44ea7f5e7 100644
--- a/pkgs/development/compilers/ghc/8.0.2.nix
+++ b/pkgs/development/compilers/ghc/8.0.2.nix
@@ -23,6 +23,10 @@
 , # Whether to build dynamic libs for the standard library (on the target
   # platform). Static libs are always built.
   enableShared ? true
+
+, # What flavour to build. An empty string indicates no
+  # specific flavour and falls back to ghc default values.
+  ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross"
 }:
 
 assert !enableIntegerSimple -> gmp != null;
@@ -36,11 +40,14 @@ let
     "${targetPlatform.config}-";
 
   buildMK = ''
+    BuildFlavour = ${ghcFlavour}
+    ifneq \"\$(BuildFlavour)\" \"\"
+    include mk/flavours/\$(BuildFlavour).mk
+    endif
     DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
   '' + stdenv.lib.optionalString enableIntegerSimple ''
     INTEGER_LIBRARY = integer-simple
   '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
-    BuildFlavour = perf-cross
     Stage1Only = YES
     HADDOCK_DOCS = NO
   '' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
@@ -87,6 +94,8 @@ stdenv.mkDerivation rec {
     ++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch
     ++ stdenv.lib.optional stdenv.isDarwin ./backport-dylib-command-size-limit.patch;
 
+  postPatch = "patchShebangs .";
+
   # GHC is a bit confused on its cross terminology.
   preConfigure = ''
     for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
@@ -103,6 +112,7 @@ stdenv.mkDerivation rec {
     export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
     export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
     export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
+
     echo -n "${buildMK}" > mk/build.mk
     sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
   '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
@@ -134,7 +144,10 @@ stdenv.mkDerivation rec {
   # masss-rebuild.
   crossConfig = true;
 
-  nativeBuildInputs = [ ghc perl hscolour sphinx ];
+  nativeBuildInputs = [
+    perl sphinx
+    ghc hscolour
+  ];
 
   # For building runtime libs
   depsBuildTarget = toolsForTarget;
@@ -154,7 +167,7 @@ stdenv.mkDerivation rec {
   # zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
   # treat that as a unary `{x,y,z,..}` repetition.
   postInstall = ''
-    paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
+    paxmark m $out/lib/${name}/bin/*
 
     # Install the bash completion file.
     install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc