Merge pull request #73195 from Ericson2314/mingw-mcfthreads

MinGW: Enable C++ threads with mcfgthreads
This commit is contained in:
John Ericson 2019-11-11 21:43:29 -05:00 committed by GitHub
commit 01429fc2ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 308 additions and 199 deletions

View File

@ -207,7 +207,7 @@ rec {
# 32 bit mingw-w64
mingw32 = {
config = "i686-pc-mingw32";
config = "i686-w64-mingw32";
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {};
};
@ -215,7 +215,7 @@ rec {
# 64 bit mingw-w64
mingwW64 = {
# That's the triplet they use in the mingw-w64 docs.
config = "x86_64-pc-mingw32";
config = "x86_64-w64-mingw32";
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {};
};

View File

@ -208,6 +208,9 @@ rec {
vendors = setTypes types.openVendor {
apple = {};
pc = {};
# Actually matters, unlocking some MinGW-w64-specific options in GCC. See
# bottom of https://sourceforge.net/p/mingw-w64/wiki2/Unicode%20apps/
w64 = {};
none = {};
unknown = {};

View File

@ -1,4 +1,4 @@
{ lib, stdenvNoCC, curl }: # Note that `curl' may be `null', in case of the native stdenvNoCC.
{ lib, buildPackages ? { inherit stdenvNoCC; }, stdenvNoCC, curl }: # Note that `curl' may be `null', in case of the native stdenvNoCC.
let
@ -10,7 +10,7 @@ let
# resulting store derivations (.drv files) much smaller, which in
# turn makes nix-env/nix-instantiate faster.
mirrorsFile =
stdenvNoCC.mkDerivation ({
buildPackages.stdenvNoCC.mkDerivation ({
name = "mirrors-list";
builder = ./write-mirror-list.sh;
preferLocalBuild = true;

View File

@ -24,6 +24,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
@ -48,10 +49,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 = "4.8.5";
let majorVersion = "4";
version = "${majorVersion}.8.5";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@ -172,6 +177,8 @@ stdenv.mkDerivation ({
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
preConfigure = import ../common/pre-configure.nix {
inherit (stdenv) lib;
inherit version hostPlatform langJava langGo;
@ -253,24 +260,13 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ]
));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -24,6 +24,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
@ -48,10 +49,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 = "4.9.4";
let majorVersion = "4";
version = "${majorVersion}.9.4";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@ -178,6 +183,8 @@ stdenv.mkDerivation ({
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
preConfigure = import ../common/pre-configure.nix {
inherit (stdenv) lib;
inherit version hostPlatform langJava langGo;
@ -259,24 +266,13 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ]
));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -24,6 +24,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
@ -46,10 +47,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 = "5.5.0";
let majorVersion = "5";
version = "${majorVersion}.5.0";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@ -62,6 +67,10 @@ let version = "5.5.0";
++ optional stdenv.hostPlatform.isMusl (fetchpatch {
url = https://raw.githubusercontent.com/richfelker/musl-cross-make/e84b1bd1fc12a3def33111ca6df522cd6e5ec361/patches/gcc-5.3.0/0001-musl.diff;
sha256 = "0pppbf8myi2kjhm3z3479ihn1cm60kycfv60gj8yy1bs0pl1qcfm";
})
++ 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 = "074bl5n27d1ksa31pvzj4vd8xd46r118k0w94gdv3s1vydg7mah0";
});
javaEcj = fetchurl {
@ -184,6 +193,8 @@ stdenv.mkDerivation ({
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = import ../common/pre-configure.nix {
@ -266,24 +277,13 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ]
));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -1,4 +1,4 @@
{ stdenv, targetPackages, fetchurl, noSysDirs
{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin
@ -24,6 +24,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
@ -46,10 +47,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 = "6.5.0";
let majorVersion = "6";
version = "${majorVersion}.5.0";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@ -59,7 +64,10 @@ let version = "6.5.0";
++ optional noSysDirs ../no-sys-dirs.patch
++ optional langFortran ../gfortran-driving.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 = "1c449jgm1vx9g4kv82bxmvlgrwb8f6kwkl0gqmjlmhf7f4hjy2nr";
});
javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@ -186,6 +194,8 @@ stdenv.mkDerivation ({
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = import ../common/pre-configure.nix {
@ -268,24 +278,13 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ]
));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -17,6 +17,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
@ -35,10 +36,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;
@ -59,7 +64,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";
@ -161,6 +170,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,24 +243,13 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -1,4 +1,4 @@
{ stdenv, targetPackages, fetchurl, noSysDirs
{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin
@ -17,6 +17,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
@ -35,10 +36,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 = "8.3.0";
let majorVersion = "8";
version = "${majorVersion}.3.0";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@ -51,7 +56,11 @@ let version = "8.3.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 = "1in5kvcknlpi9z1vvjw6jfmwy8k12zvbqlqfnq84qpm99r0rh00a";
});
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
@ -153,6 +162,8 @@ stdenv.mkDerivation ({
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = import ../common/pre-configure.nix {
@ -219,24 +230,13 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -1,4 +1,4 @@
{ stdenv, targetPackages, fetchurl, noSysDirs
{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin
@ -17,6 +17,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
@ -35,10 +36,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 = "9.2.0";
let majorVersion = "9";
version = "${majorVersion}.2.0";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@ -50,7 +55,11 @@ let version = "9.2.0";
sha256 = ""; # TODO: uncomment and check hash when available.
}) */
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch;
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.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 = "1in5kvcknlpi9z1vvjw6jfmwy8k12zvbqlqfnq84qpm99r0rh00a";
});
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
@ -152,6 +161,8 @@ stdenv.mkDerivation ({
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = import ../common/pre-configure.nix {
@ -218,24 +229,13 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -50,7 +50,7 @@ let
"--disable-decimal-float" # requires libc
"--disable-libmpx" # requires libc
] ++ lib.optionals crossMingw [
"--with-headers=${libcCross}/include"
"--with-headers=${lib.getDev libcCross}/include"
"--with-gcc"
"--with-gnu-as"
"--with-gnu-ld"
@ -63,7 +63,7 @@ let
"--enable-__cxa_atexit"
"--enable-long-long"
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "win32"
else if targetPlatform.isWindows then "mcf"
else "single"}"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)

View File

@ -0,0 +1,30 @@
{ stdenv, crossStageStatic, libcCross, threadsCross }:
let
inherit (stdenv) lib hostPlatform targetPlatform;
in
{
EXTRA_TARGET_FLAGS = let
mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([
"-idirafter ${lib.getDev dep}${dep.incdir or "/include"}"
] ++ stdenv.lib.optionals (! crossStageStatic) [
"-B${lib.getLib dep}${dep.libdir or "/lib"}"
]);
in mkFlags libcCross
++ lib.optionals (!crossStageStatic) (mkFlags threadsCross)
;
EXTRA_TARGET_LDFLAGS = let
mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([
"-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${lib.getLib dep}${dep.libdir or "/lib"}"
] else [
"-Wl,-rpath,${lib.getLib dep}${dep.libdir or "/lib"}"
"-Wl,-rpath-link,${lib.getLib dep}${dep.libdir or "/lib"}"
]));
in mkFlags libcCross
++ lib.optionals (!crossStageStatic) (mkFlags threadsCross)
;
}

View File

@ -0,0 +1 @@
"740f233da00c4fb5bcc225b2e29768824bcecc58"

View File

@ -1,4 +1,4 @@
{ stdenv, targetPackages, fetchurl, noSysDirs
{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? stdenv.targetPlatform.isDarwin
, langObjCpp ? stdenv.targetPlatform.isDarwin
@ -17,6 +17,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
@ -36,10 +37,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-20170409";
let majorVersion = "7";
version = "${majorVersion}-20170409";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
@ -47,7 +52,11 @@ let version = "7-20170409";
[ ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch
++ optional langFortran ../gfortran-driving.patch;
++ optional langFortran ../gfortran-driving.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";
@ -119,6 +128,8 @@ stdenv.mkDerivation ({
++ (optional hostPlatform.isDarwin gnused)
;
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
preConfigure = import ../common/pre-configure.nix {
@ -186,24 +197,13 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
inherit
(import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross;
})
EXTRA_TARGET_FLAGS
EXTRA_TARGET_LDFLAGS
;
passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -1,4 +1,5 @@
{ lib, stdenv, fetchurl
, autoreconfHook
, enableLargeConfig ? false # doc: https://github.com/ivmai/bdwgc/blob/v7.6.6/doc/README.macros#L179
}:
@ -22,12 +23,17 @@ stdenv.mkDerivation rec {
'';
patches = # https://github.com/ivmai/bdwgc/pull/208
lib.optional stdenv.hostPlatform.isRiscV ./riscv.patch;
lib.optional stdenv.hostPlatform.isRiscV ./riscv.patch
# boehm-gc whitelists GCC threading models
++ lib.optional stdenv.hostPlatform.isMinGW ./mcfgthread.patch;
configureFlags =
[ "--enable-cplusplus" "--with-libatomic-ops=none" ]
++ lib.optional enableLargeConfig "--enable-large-config";
nativeBuildInputs =
lib.optional stdenv.hostPlatform.isMinGW autoreconfHook;
doCheck = true; # not cross;
enableParallelBuilding = true;

View File

@ -0,0 +1,11 @@
--- a/configure.ac
+++ b/configure.ac
@@ -277,7 +277,7 @@ case "$THREADS" in
;;
esac
;;
- win32)
+ win32 | mcf)
AC_DEFINE(GC_THREADS)
use_parallel_mark=$enable_parallel_mark
if test "${enable_parallel_mark}" != no \

View File

@ -1,7 +1,9 @@
{ stdenv, fetchurl, pkgconfig
# Optional Dependencies
, openssl ? null, libev ? null, zlib ? null, c-ares ? null
, openssl ? null, zlib ? null
, enableLibEv ? !stdenv.hostPlatform.isWindows, libev ? null
, enableCAres ? !stdenv.hostPlatform.isWindows, c-ares ? null
, enableHpack ? false, jansson ? null
, enableAsioLib ? false, boost ? null
, enableGetAssets ? false, libxml2 ? null
@ -28,7 +30,10 @@ stdenv.mkDerivation rec {
outputs = [ "bin" "out" "dev" "lib" ];
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ openssl libev zlib c-ares ]
buildInputs = [ openssl ]
++ optional enableLibEv libev
++ [ zlib ]
++ optional enableCAres c-ares
++ optional enableHpack jansson
++ optional enableAsioLib boost
++ optional enableGetAssets libxml2

View File

@ -29,8 +29,6 @@ in stdenv.mkDerivation {
]
++ optional (variant != null) "--enable-${variant}";
buildInputs = optional (stdenv.hostPlatform.libc == "msvcrt") windows.mingw_w64_pthreads;
# https://bugs.exim.org/show_bug.cgi?id=2173
patches = [ ./stacksize-detection.patch ];

View File

@ -1,29 +1,45 @@
{ newScope, crossLibcStdenv }: let
{ stdenv, buildPackages
, newScope, overrideCC, crossLibcStdenv, libcCross
}:
callPackage = newScope self;
stdenv.lib.makeScope newScope (self: with self; {
self = {
cygwinSetup = callPackage ./cygwin-setup { };
cygwinSetup = callPackage ./cygwin-setup { };
jom = callPackage ./jom { };
jom = callPackage ./jom { };
w32api = callPackage ./w32api { };
w32api = callPackage ./w32api { };
mingwrt = callPackage ./mingwrt { };
mingw_runtime = self.mingwrt;
mingwrt = callPackage ./mingwrt { };
mingw_runtime = mingwrt;
mingw_w64 = callPackage ./mingw-w64 {
stdenv = crossLibcStdenv;
};
mingw_w64_headers = callPackage ./mingw-w64/headers.nix { };
mingw_w64_pthreads = callPackage ./mingw-w64/pthreads.nix { };
pthreads = callPackage ./pthread-w32 { };
wxMSW = callPackage ./wxMSW-2.8 { };
libgnurx = callPackage ./libgnurx { };
mingw_w64 = callPackage ./mingw-w64 {
stdenv = crossLibcStdenv;
};
in self
crossThreadsStdenv = overrideCC crossLibcStdenv
(if stdenv.hostPlatform.useLLVM or false
then buildPackages.llvmPackages_8.lldClangNoLibcxx
else buildPackages.gccCrossStageStatic.override (old: {
bintools = old.bintools.override {
libc = libcCross;
};
libc = libcCross;
}));
mingw_w64_headers = callPackage ./mingw-w64/headers.nix { };
mingw_w64_pthreads = callPackage ./mingw-w64/pthreads.nix {
stdenv = crossThreadsStdenv;
};
mcfgthreads = callPackage ./mcfgthreads {
stdenv = crossThreadsStdenv;
};
pthreads = callPackage ./pthread-w32 { };
wxMSW = callPackage ./wxMSW-2.8 { };
libgnurx = callPackage ./libgnurx { };
})

View File

@ -0,0 +1,24 @@
{ stdenv, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation {
pname = "mcfgthreads";
version = "git";
src = fetchFromGitHub {
owner = "lhmouse";
repo = "mcfgthread";
rev = "9570e5ca7b98002d707c502c919d951bf256b9c6";
sha256 = "10y2x3x601a7c1hkd6zlr3xpfsnlr05xl28v23clf619756a5755";
};
outputs = [ "out" "dev" ];
# Don't want prebuilt binaries sneaking in.
postUnpack = ''
rm -r "$sourceRoot/debug" "$sourceRoot/release"
'';
nativeBuildInputs = [
autoreconfHook
];
}

View File

@ -11,11 +11,15 @@ in stdenv.mkDerivation {
sha256 = "00zq3z1hbzd5yzmskskjg79xrzwsqx7ihyprfaxy4hb897vf29sm";
};
outputs = [ "out" "dev" ];
configureFlags = [
"--enable-idl"
"--enable-secure-api"
];
enableParallelBuilding = true;
buildInputs = [ windows.mingw_w64_headers ];
dontStrip = true;
hardeningDisable = [ "stackprotector" "fortify" ];

View File

@ -293,8 +293,10 @@ in
fetchhg = callPackage ../build-support/fetchhg { };
# `fetchurl' downloads a file from the network.
fetchurl = makeOverridable (import ../build-support/fetchurl) {
inherit lib stdenvNoCC;
fetchurl = if stdenv.buildPlatform != stdenv.hostPlatform
then buildPackages.fetchurl # No need to do special overrides twice,
else makeOverridable (import ../build-support/fetchurl) {
inherit lib stdenvNoCC buildPackages;
curl = buildPackages.curl.override (old: rec {
# break dependency cycles
fetchurl = stdenv.fetchurlBoot;
@ -7795,7 +7797,7 @@ in
../development/compilers/gcc/libstdc++-hook.sh;
crossLibcStdenv = overrideCC stdenv
(if stdenv.targetPlatform.useLLVM or false
(if stdenv.hostPlatform.useLLVM or false
then buildPackages.llvmPackages_8.lldClangNoLibc
else buildPackages.gccCrossStageStatic);
@ -7828,6 +7830,7 @@ in
};
bintools = binutils1;
libc = libcCross1;
extraPackages = [];
};
gcc48 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 {
@ -7837,6 +7840,7 @@ in
profiledCompiler = with stdenv; (!isSunOS && !isDarwin && (isi686 || isx86_64));
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
isl = if !stdenv.isDarwin then isl_0_14 else null;
cloog = if !stdenv.isDarwin then cloog else null;
@ -7850,6 +7854,7 @@ in
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
isl = if !stdenv.isDarwin then isl_0_11 else null;
@ -7863,6 +7868,7 @@ in
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
isl = if !stdenv.isDarwin then isl_0_14 else null;
}));
@ -7874,6 +7880,7 @@ in
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
isl = if !stdenv.isDarwin then isl_0_14 else null;
}));
@ -7885,6 +7892,7 @@ in
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
isl = if !stdenv.isDarwin then isl_0_17 else null;
}));
@ -7896,6 +7904,7 @@ in
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
isl = if !stdenv.isDarwin then isl_0_17 else null;
}));
@ -7907,6 +7916,7 @@ in
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
isl = if !stdenv.isDarwin then isl_0_17 else null;
}));
@ -7918,6 +7928,7 @@ in
profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64));
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then libcCross else null;
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else null;
isl = isl_0_17;
}));
@ -8755,6 +8766,7 @@ in
# provide the default choice, avoiding infinite recursion.
bintools ? if stdenv.targetPlatform.isDarwin then darwin.binutils else binutils
, libc ? bintools.libc
, extraPackages ? stdenv.lib.optional (cc.isGNU or false && stdenv.targetPlatform.isMinGW) threadsCross
, ...
} @ extraArgs:
callPackage ../build-support/cc-wrapper (let self = {
@ -8766,7 +8778,7 @@ in
isGNU = cc.isGNU or false;
isClang = cc.isClang or false;
inherit cc bintools libc;
inherit cc bintools libc extraPackages;
} // extraArgs; in self);
wrapCC = cc: wrapCCWith {
@ -11286,6 +11298,11 @@ in
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;
wasilibc = callPackage ../development/libraries/wasilibc {
stdenv = crossLibcStdenv;
};
@ -13280,7 +13297,10 @@ in
wolfssl = callPackage ../development/libraries/wolfssl { };
openssl = openssl_1_1;
openssl =
if stdenv.hostPlatform.isMinGW # Work around broken cross build
then openssl_1_0_2
else openssl_1_1;
inherit (callPackages ../development/libraries/openssl { })
openssl_1_0_2