summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/generic-builder.nix
diff options
context:
space:
mode:
authorMoritz Angermann <moritz.angermann@gmail.com>2018-03-11 17:13:25 +0800
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-21 15:11:11 -0400
commit4ea33def46709e90b9f41ccd6fb6a84342ecd926 (patch)
tree024bc2c203bb5787a4b0bb62f9a6e350e246093b /pkgs/development/haskell-modules/generic-builder.nix
parent15759df6607204d960f70420a092178cf65306b7 (diff)
downloadnixlib-4ea33def46709e90b9f41ccd6fb6a84342ecd926.tar
nixlib-4ea33def46709e90b9f41ccd6fb6a84342ecd926.tar.gz
nixlib-4ea33def46709e90b9f41ccd6fb6a84342ecd926.tar.bz2
nixlib-4ea33def46709e90b9f41ccd6fb6a84342ecd926.tar.lz
nixlib-4ea33def46709e90b9f41ccd6fb6a84342ecd926.tar.xz
nixlib-4ea33def46709e90b9f41ccd6fb6a84342ecd926.tar.zst
nixlib-4ea33def46709e90b9f41ccd6fb6a84342ecd926.zip
haskell generic builder: Disable static libs on Windows because no -staticlib
The reason why this does not work is not that we can't built static
objects, we can, but we can't use `-staticlib` on GHC on windows.
`-staticlib` rolls all dependencies into a combined archive. While this
would work on windows if we used gnu ar and MRI script, GHC can't rely
on GNU ar, and as such has a quick archive concatenation module for GNU
and BSD archives only.
Diffstat (limited to 'pkgs/development/haskell-modules/generic-builder.nix')
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index 3e191cd23451..1b9372c28df5 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -31,7 +31,7 @@ in
 , enableSharedExecutables ? false
 , enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
 , enableDeadCodeElimination ? (!stdenv.isDarwin)  # TODO: use -dead_strip for darwin
-, enableStaticLibraries ? true
+, enableStaticLibraries ? !hostPlatform.isWindows
 , enableHsc2hsViaAsm ? hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4"
 , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
 , homepage ? "http://hackage.haskell.org/package/${pname}"
@@ -68,6 +68,10 @@ in
 
 assert editedCabalFile != null -> revision != null;
 
+# --enable-static does not work on windows. This is a bug in GHC.
+# --enable-static will pass -staticlib to ghc, which only works for mach-o and elf.
+assert hostPlatform.isWindows -> enableStaticLibraries == false;
+
 let
 
   inherit (stdenv.lib) optional optionals optionalString versionOlder versionAtLeast