git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commita4d5dbd45dfe35ca93b32daedba1c25167701cb0 authorMoritz Angermann <moritz.angermann@gmail.com> dateSun 11 Mar 2018, 17:13 (9 years ago) parent38fbdcc
1 file changed+5−1
pkgs/development/haskell-modules/generic-builder.nix+5−1
pkgs/development/haskell-modules/generic-builder.nix+5−1
@@ -31,7 +31,7 @@ in
3131, enableSharedExecutables ? false
3232, enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
3333, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
34−, enableStaticLibraries ? true
34+, enableStaticLibraries ? !hostPlatform.isWindows
3535, enableHsc2hsViaAsm ? hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4"
3636, extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
3737, homepage ? "http://hackage.haskell.org/package/${pname}"
@@ -68,6 +68,10 @@ in
6868
6969assert editedCabalFile != null -> revision != null;
7070
71+# --enable-static does not work on windows. This is a bug in GHC.
72+# --enable-static will pass -staticlib to ghc, which only works for mach-o and elf.
73+assert hostPlatform.isWindows -> enableStaticLibraries == false;
74+
7175let
7276
7377 inherit (stdenv.lib) optional optionals optionalString versionOlder versionAtLeast