ghc8.10.7: fix mingw build

(cherry picked from commit eea8e3eacec12fe4e46d3ecb8e3cbbd03a10b2f0)
This commit is contained in:
Alexandre Esteves 2021-09-09 02:33:43 +01:00 committed by John Ericson
parent 65c3102d78
commit 48048824c4
1 changed files with 14 additions and 1 deletions

View File

@ -75,6 +75,12 @@ let
GhcRtsHcOpts += -fPIC
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
''
# While split sections are now enabled by default in ghc 8.8 for windows,
# they seem to lead to `too many sections` errors when building base for
# profiling.
+ lib.optionalString targetPlatform.isWindows ''
SplitSections = NO
'';
# Splicer will pull out correct variations
@ -91,7 +97,7 @@ let
# ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl;
useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl && !targetPlatform.isWindows;
runtimeDeps = [
targetPackages.stdenv.cc.bintools
@ -124,6 +130,13 @@ stdenv.mkDerivation (rec {
# upstream patch. Don't forget to check backport status of the upstream patch
# when adding new GHC releases in nixpkgs.
./respect-ar-path.patch
# cabal passes incorrect --host= when cross-compiling
# https://github.com/haskell/cabal/issues/5887
(fetchpatch {
url = "https://raw.githubusercontent.com/input-output-hk/haskell.nix/122bd81150386867da07fdc9ad5096db6719545a/overlays/patches/ghc/cabal-host.patch";
sha256 = "sha256:0yd0sajgi24sc1w5m55lkg2lp6kfkgpp3lgija2c8y3cmkwfpdc1";
})
] ++ lib.optionals stdenv.isDarwin [
# Make Block.h compile with c++ compilers. Remove with the next release
(fetchpatch {