summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2018-03-05 21:33:49 +0800
committerJohn Ericson <Ericson2314@yahoo.com>2018-03-20 15:27:02 -0400
commit918edbe485333376549aef70f923dd224bca6395 (patch)
tree1bf712db2cb3a5432774fc66dab101c916596bb0 /pkgs/development/haskell-modules
parentab67f36e7376e6e5d09f5bdfb00944ef2f7abaf0 (diff)
downloadnixlib-918edbe485333376549aef70f923dd224bca6395.tar
nixlib-918edbe485333376549aef70f923dd224bca6395.tar.gz
nixlib-918edbe485333376549aef70f923dd224bca6395.tar.bz2
nixlib-918edbe485333376549aef70f923dd224bca6395.tar.lz
nixlib-918edbe485333376549aef70f923dd224bca6395.tar.xz
nixlib-918edbe485333376549aef70f923dd224bca6395.tar.zst
nixlib-918edbe485333376549aef70f923dd224bca6395.zip
haskell-generic-builder: Add `enableHsc2hsViaAsm` for Windows cross compilation
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index 3cdf2e2252b2..45299e013696 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -32,6 +32,7 @@ in
 , enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
 , enableDeadCodeElimination ? (!stdenv.isDarwin)  # TODO: use -dead_strip for darwin
 , enableStaticLibraries ? true
+, enableHsc2hsViaAsm ? hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4"
 , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
 , homepage ? "http://hackage.haskell.org/package/${pname}"
 , platforms ? with stdenv.lib.platforms; unix ++ windows # GHC can cross-compile
@@ -114,9 +115,13 @@ let
     "--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg"
     "--with-gcc=${stdenv.cc.targetPrefix}cc"
     "--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
-    "--with-hsc2hs=${nativeGhc}/bin/hsc2hs" # not cross one
+    # use the one that comes with the cross compiler.
+    "--with-hsc2hs=${ghc.targetPrefix}hsc2hs"
     "--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
-  ] ++ (if isHaLVM then [] else ["--hsc2hs-options=--cross-compile"]);
+  ] ++ optionals (!isHaLVM) [
+    "--hsc2hs-option=--cross-compile"
+    (optionalString enableHsc2hsViaAsm "--hsc2hs-option=--via-asm")
+  ];
 
   crossCabalFlagsString =
     stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);