Merge pull request #199883 from Mic92/mingw

cross/mingw: make threading library configureable
This commit is contained in:
Jörg Thalheim 2022-11-14 13:59:00 +01:00 committed by GitHub
commit b60aa0e01c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 57 additions and 54 deletions

View File

@ -37,7 +37,7 @@ assert langGo -> langCC;
assert langAda -> gnatboot != null;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -65,7 +65,7 @@ let majorVersion = "10";
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ optional (buildPlatform.system == "aarch64-darwin" && targetPlatform != buildPlatform) (fetchpatch {
url = "https://raw.githubusercontent.com/richard-vd/musl-cross-make/5e9e87f06fc3220e102c29d3413fbbffa456fcd6/patches/gcc-${version}/0008-darwin-aarch64-self-host-driver.patch";
@ -179,7 +179,7 @@ stdenv.mkDerivation ({
++ (optional (zlib != null) zlib)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {} && threadsCross.package != null) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
@ -199,7 +199,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -37,7 +37,7 @@ assert langGo -> langCC;
assert langAda -> gnatboot != null;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -76,7 +76,7 @@ let majorVersion = "11";
})
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;
++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
@ -187,7 +187,7 @@ stdenv.mkDerivation ({
++ (optional (zlib != null) zlib)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {} && threadsCross.package != null) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
@ -207,7 +207,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -41,7 +41,7 @@ assert langAda -> gnatboot != null;
assert !langD;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -71,7 +71,7 @@ let majorVersion = "12";
++ optional langD ../libphobos.patch
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;
++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
@ -180,7 +180,7 @@ stdenv.mkDerivation ({
++ (optional (zlib != null) zlib)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
@ -201,7 +201,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -45,7 +45,7 @@ assert stdenv.buildPlatform.isDarwin -> gnused != null;
assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -188,7 +188,7 @@ stdenv.mkDerivation ({
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross;
preConfigure = import ../common/pre-configure.nix {
inherit lib;
@ -204,7 +204,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -45,7 +45,7 @@ assert stdenv.buildPlatform.isDarwin -> gnused != null;
assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -208,7 +208,7 @@ stdenv.mkDerivation ({
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross;
preConfigure = import ../common/pre-configure.nix {
inherit lib;
@ -224,7 +224,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -48,7 +48,7 @@ assert langGo -> langCC;
assert langAda -> gnatboot != null;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -72,7 +72,7 @@ let majorVersion = "6";
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isx86_32) (fetchpatch {
url = "https://git.alpinelinux.org/aports/plain/main/gcc/gcc-6.1-musl-libssp.patch?id=5e4b96e23871ee28ef593b439f8c07ca7c7eb5bb";
sha256 = "1jf1ciz4gr49lwyh8knfhw6l5gvfkwzjy90m7qiwkcbsf4a3fqn2";
@ -217,7 +217,7 @@ stdenv.mkDerivation ({
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
@ -235,7 +235,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -32,7 +32,7 @@ assert stdenv.buildPlatform.isDarwin -> gnused != null;
assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -75,7 +75,7 @@ let majorVersion = "7";
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ [ ../libsanitizer-no-cyclades-9.patch ];
@ -184,7 +184,7 @@ stdenv.mkDerivation ({
++ (optional (zlib != null) zlib)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
@ -203,7 +203,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -32,7 +32,7 @@ assert stdenv.buildPlatform.isDarwin -> gnused != null;
assert langGo -> langCC;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -59,8 +59,7 @@ let majorVersion = "8";
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ [ ../libsanitizer-no-cyclades-9.patch ];
/* Cross-gcc settings (build == host != target) */
@ -168,7 +167,7 @@ stdenv.mkDerivation ({
++ (optional (zlib != null) zlib)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
@ -186,7 +185,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -41,7 +41,7 @@ assert langGo -> langCC;
assert langAda -> gnatboot != null;
# threadsCross is just for MinGW
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
# profiledCompiler builds inject non-determinism in one of the compilation stages.
# If turned on, we can't provide reproducible builds anymore
@ -71,7 +71,7 @@ let majorVersion = "9";
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
;
/* Cross-gcc settings (build == host != target) */
@ -180,7 +180,7 @@ stdenv.mkDerivation ({
++ (optional (zlib != null) zlib)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package;
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";
@ -198,7 +198,7 @@ stdenv.mkDerivation ({
lib
stdenv
targetPackages
crossStageStatic libcCross
crossStageStatic libcCross threadsCross
version
gmp mpfr libmpc isl

View File

@ -2,6 +2,7 @@
, targetPackages
, crossStageStatic, libcCross
, threadsCross
, version
, gmp, mpfr, libmpc, isl
@ -86,7 +87,7 @@ let
"--enable-__cxa_atexit"
"--enable-long-long"
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "mcf"
else if targetPlatform.isWindows then (threadsCross.model or "win32")
else "single"}"
"--enable-nls"
] ++ lib.optionals (targetPlatform.libc == "uclibc" || targetPlatform.libc == "musl") [

View File

@ -15,7 +15,7 @@ in
"-B${lib.getLib dep}${dep.libdir or "/lib"}"
]);
in mkFlags libcCross langD
++ lib.optionals (!crossStageStatic) (mkFlags threadsCross langD)
++ lib.optionals (!crossStageStatic) (mkFlags (threadsCross.package or null) langD)
;
EXTRA_LDFLAGS_FOR_TARGET = let
@ -28,6 +28,6 @@ in
"-Wl,-rpath-link,${lib.getLib dep}${dep.libdir or "/lib"}"
]));
in mkFlags libcCross
++ lib.optionals (!crossStageStatic) (mkFlags threadsCross)
++ lib.optionals (!crossStageStatic) (mkFlags (threadsCross.package or null))
;
}

View File

@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
depsBuildTarget = lib.optional isCross targetCC;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross.package;
postPatch = ''
patchShebangs .

View File

@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
depsBuildTarget = lib.optional isCross targetCC;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross;
depsTargetTarget = lib.optional stdenv.targetPlatform.isWindows threadsCross.package;
postPatch = ''
patchShebangs .

View File

@ -13858,7 +13858,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
isl = if !stdenv.isDarwin then isl_0_14 else null;
cloog = if !stdenv.isDarwin then cloog else null;
@ -13872,7 +13872,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
isl = if !stdenv.isDarwin then isl_0_11 else null;
@ -13889,7 +13889,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;
@ -13908,7 +13908,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;
@ -13923,7 +13923,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
# gcc 10 is too strict to cross compile gcc <= 8
stdenv = if (stdenv.targetPlatform != stdenv.buildPlatform) && stdenv.cc.isGNU then gcc7Stdenv else stdenv;
@ -13938,7 +13938,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
@ -13950,7 +13950,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
@ -13962,7 +13962,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
@ -13974,7 +13974,7 @@ with pkgs;
profiledCompiler = false;
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else {};
isl = if !stdenv.isDarwin then isl_0_20 else null;
}));
@ -15415,7 +15415,7 @@ with pkgs;
# want the C++ library to be explicitly chosen by the caller, and null by
# default.
libcxx ? null
, extraPackages ? lib.optional (cc.isGNU or false && stdenv.targetPlatform.isMinGW) threadsCross
, extraPackages ? lib.optional (cc.isGNU or false && stdenv.targetPlatform.isMinGW) threadsCross.package
, nixSupport ? {}
, ...
} @ extraArgs:
@ -19142,10 +19142,13 @@ with pkgs;
libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;
threadsCross =
if stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)
then targetPackages.windows.mcfgthreads or windows.mcfgthreads
else null;
threadsCross = if stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)
then {
# other possible values: win32 or posix
model = "mcf";
# For win32 or posix set this to null
package = targetPackages.windows.mcfgthreads or windows.mcfgthreads;
} else {};
wasilibc = callPackage ../development/libraries/wasilibc {
stdenv = crossLibcStdenv;