summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/generic-builder.nix
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-12-31 16:35:53 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2019-12-31 16:35:53 +0100
commit555037a6670ba487ec23c3e819a6a2f24dc0a05f (patch)
tree55a7fca979cb68a309aab68b202477bb4a783682 /pkgs/development/haskell-modules/generic-builder.nix
parent0c2adc0fb1b0b551bef119477f37b86190cd9cc5 (diff)
parente4d0e33f36491a0e08a3b1a15db13366d7d0785f (diff)
downloadnixpkgs-555037a6670ba487ec23c3e819a6a2f24dc0a05f.tar
nixpkgs-555037a6670ba487ec23c3e819a6a2f24dc0a05f.tar.gz
nixpkgs-555037a6670ba487ec23c3e819a6a2f24dc0a05f.tar.bz2
nixpkgs-555037a6670ba487ec23c3e819a6a2f24dc0a05f.tar.lz
nixpkgs-555037a6670ba487ec23c3e819a6a2f24dc0a05f.tar.xz
nixpkgs-555037a6670ba487ec23c3e819a6a2f24dc0a05f.tar.zst
nixpkgs-555037a6670ba487ec23c3e819a6a2f24dc0a05f.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/development/haskell-modules/generic-builder.nix')
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index bf16e534f3e..2ae33138696 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -40,7 +40,7 @@ in
 # They must be propagated to the environment of any executable linking with the library
 , libraryFrameworkDepends ? [], executableFrameworkDepends ? []
 , homepage ? "https://hackage.haskell.org/package/${pname}"
-, platforms ? with stdenv.lib.platforms; unix ++ windows # GHC can cross-compile
+, platforms ? with stdenv.lib.platforms; all # GHC can cross-compile
 , hydraPlatforms ? null
 , hyperlinkSource ? true
 , isExecutable ? false, isLibrary ? !isExecutable
@@ -131,9 +131,13 @@ let
                    '';
 
   crossCabalFlags = [
-    "--with-ghc=${ghc.targetPrefix}ghc"
+    "--with-ghc=${ghcCommand}"
     "--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg"
-    "--with-gcc=${stdenv.cc.targetPrefix}cc"
+    # Pass the "wrong" C compiler rather than none at all so packages that just
+    # use the C preproccessor still work, see
+    # https://github.com/haskell/cabal/issues/6466 for details.
+    "--with-gcc=${(if stdenv.hasCC then stdenv else buildPackages.stdenv).cc.targetPrefix}cc"
+  ] ++ optionals stdenv.hasCC [
     "--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
     "--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
     # use the one that comes with the cross compiler.
@@ -156,7 +160,9 @@ let
     "--libsubdir=\\$abi/\\$libname"
     (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
     (optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}")
+  ] ++ optionals stdenv.hasCC [
     "--with-gcc=$CC" # Clang won't work without that extra information.
+  ] ++ [
     "--package-db=$packageConfDir"
     (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
     (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")