From 48048824c4c63c605d39532ff9ebeb7328a580e7 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Thu, 9 Sep 2021 02:33:43 +0100 Subject: [PATCH] ghc8.10.7: fix mingw build (cherry picked from commit eea8e3eacec12fe4e46d3ecb8e3cbbd03a10b2f0) --- pkgs/development/compilers/ghc/8.10.7.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index f3242f3e167..e3b09ecf155 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -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 {