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.
This commit is contained in:
Moritz Angermann 2018-03-11 17:13:25 +08:00 committed by John Ericson
parent 38fbdcc726
commit a4d5dbd45d

View File

@ -31,7 +31,7 @@ in
, enableSharedExecutables ? false , enableSharedExecutables ? false
, enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version) , enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin , enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
, enableStaticLibraries ? true , enableStaticLibraries ? !hostPlatform.isWindows
, enableHsc2hsViaAsm ? hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4" , enableHsc2hsViaAsm ? hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4"
, extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? [] , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
, homepage ? "http://hackage.haskell.org/package/${pname}" , homepage ? "http://hackage.haskell.org/package/${pname}"
@ -68,6 +68,10 @@ in
assert editedCabalFile != null -> revision != null; 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 let
inherit (stdenv.lib) optional optionals optionalString versionOlder versionAtLeast inherit (stdenv.lib) optional optionals optionalString versionOlder versionAtLeast