gcc: Build MinGW stage two with threading library

Currently this is set up to be mcfgthreads, but it could be something
else instead.
This commit is contained in:
John Ericson
2019-11-11 11:02:38 -05:00
parent 999ef20129
commit 04cb05d20c
13 changed files with 130 additions and 28 deletions
+14 -3
View File
@@ -16,6 +16,7 @@
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
, name ? "gcc"
, libcCross ? null
, threadsCross ? null # for MinGW
, crossStageStatic ? false
, # Strip kills static libs of other archs (hence no cross)
stripped ? stdenv.hostPlatform == stdenv.buildPlatform
@@ -34,10 +35,14 @@ assert stdenv.hostPlatform.isDarwin -> gnused != null;
# The go frontend is written in c++
assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
with stdenv.lib;
with builtins;
let version = "7.4.0";
let majorVersion = "7";
version = "${majorVersion}.4.0";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@@ -58,7 +63,11 @@ let version = "7.4.0";
})
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch;
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
sha256 = "1nyjnshpq5gbcbbpfv27hy4ajvycmgkpiabkjlxnnrnq1d99k1ay";
});
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
@@ -160,6 +169,8 @@ stdenv.mkDerivation ({
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
@@ -232,7 +243,7 @@ stdenv.mkDerivation ({
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross;
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS