Skip to content
4 changes: 2 additions & 2 deletions lib/systems/examples.nix
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ rec {

# 32 bit mingw-w64
mingw32 = {
config = "i686-pc-mingw32";
config = "i686-w64-mingw32";
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {};
};

# 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 = {};
};
Expand Down
3 changes: 3 additions & 0 deletions lib/systems/parse.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/fetchurl/default.nix
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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;
Expand Down
34 changes: 15 additions & 19 deletions pkgs/development/compilers/gcc/4.8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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
Expand All @@ -47,10 +48,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;

Expand Down Expand Up @@ -171,6 +176,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;
Expand Down Expand Up @@ -251,24 +258,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;
Expand Down
34 changes: 15 additions & 19 deletions pkgs/development/compilers/gcc/4.9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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
Expand All @@ -47,10 +48,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;

Expand Down Expand Up @@ -177,6 +182,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;
Expand Down Expand Up @@ -257,24 +264,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;
Expand Down
38 changes: 19 additions & 19 deletions pkgs/development/compilers/gcc/5/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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
Expand All @@ -45,10 +46,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;

Expand All @@ -61,6 +66,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 {
Expand Down Expand Up @@ -183,6 +192,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 {
Expand Down Expand Up @@ -264,24 +275,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;
Expand Down
41 changes: 20 additions & 21 deletions pkgs/development/compilers/gcc/6/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,6 +23,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
Expand All @@ -45,10 +46,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;

Expand All @@ -58,7 +63,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
Expand Down Expand Up @@ -185,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 {
Expand Down Expand Up @@ -266,24 +276,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;
Expand Down
Loading