@@ -5163,9 +5163,17 @@ with pkgs;
51635163
51645164 gccApple = throw "gccApple is no longer supported";
51655165
5166+ # Can't just overrideCC, because then the stdenv-cross mkDerivation will be
5167+ # thrown away. TODO: find a better solution for this.
5168+ crossLibcStdenv = buildPackages.makeStdenvCross {
5169+ inherit (buildPackages.buildPackages) stdenv;
5170+ inherit buildPlatform hostPlatform targetPlatform;
5171+ cc = buildPackages.gccCrossStageStatic;
5172+ };
5173+
51665174 gccCrossStageStatic = assert targetPlatform != buildPlatform; let
51675175 libcCross1 =
5168− if targetPlatform.libc == "msvcrt" then windows.mingw_w64_headers
5176+ if targetPlatform.libc == "msvcrt" then __targetPackages.windows.mingw_w64_headers
51695177 else if targetPlatform.libc == "libSystem" then darwin.xcode
51705178 else null;
51715179 in wrapCCCross {
@@ -7800,13 +7808,7 @@ with pkgs;
78007808 # Being redundant to avoid cycles on boot. TODO: find a better way
78017809 glibcCross = callPackage ../development/libraries/glibc {
78027810 installLocales = config.glibc.locales or false;
7803− # Can't just overrideCC, because then the stdenv-cross mkDerivation will be
7804− # thrown away. TODO: find a better solution for this.
7805− stdenv = buildPackages.makeStdenvCross {
7806− inherit (buildPackages.buildPackages) stdenv;
7807− inherit buildPlatform hostPlatform targetPlatform;
7808− cc = buildPackages.gccCrossStageStatic;
7809− };
7811+ stdenv = crossLibcStdenv;
78107812 };
78117813
78127814 # We can choose:
@@ -7815,7 +7817,7 @@ with pkgs;
78157817 # hack fixes the hack, *sigh*.
78167818 /**/ if name == "glibc" then __targetPackages.glibcCross or glibcCross
78177819 else if name == "uclibc" then uclibcCross
7818− else if name == "msvcrt" then windows.mingw_w64
7820+ else if name == "msvcrt" then __targetPackages.windows.mingw_w64 or windows.mingw_w64
78197821 else if name == "libSystem" then darwin.xcode
78207822 else throw "Unknown libc";
78217823
@@ -12561,17 +12563,12 @@ with pkgs;
1256112563 };
1256212564
1256312565 mingw_w64 = callPackage ../os-specific/windows/mingw-w64 {
12564− gccCross = gccCrossStageStatic;
12565− binutils = binutils;
12566+ stdenv = crossLibcStdenv;
1256612567 };
1256712568
12568− mingw_w64_headers = callPackage ../os-specific/windows/mingw-w64 {
12569− onlyHeaders = true;
12570− };
12569+ mingw_w64_headers = callPackage ../os-specific/windows/mingw-w64/headers.nix { };
1257112570
12572− mingw_w64_pthreads = callPackage ../os-specific/windows/mingw-w64 {
12573− onlyPthreads = true;
12574− };
12571+ mingw_w64_pthreads = callPackage ../os-specific/windows/mingw-w64/pthreads.nix { };
1257512572
1257612573 pthreads = callPackage ../os-specific/windows/pthread-w32 {
1257712574 mingw_headers = mingw_headers3;