git.iko.soy/typeable/nixpkgs
on master help sign in
mingw-w64: Clean up, especially clarifying staging
commitbb7067f882bf3c53ea68780a8ec0a7117f563253 authorJohn Ericson <Ericson2314@Yahoo.com> dateMon 19 Jun 2017, 11:51 (9 years ago) parentc2e2152
5 files changed+55−51
pkgs/os-specific/windows/mingw-w64/common.nix+11 pkgs/os-specific/windows/mingw-w64/default.nix+4−34 pkgs/os-specific/windows/mingw-w64/headers.nix+13 pkgs/os-specific/windows/mingw-w64/pthreads.nix+13 pkgs/top-level/all-packages.nix+14−17
pkgs/os-specific/windows/mingw-w64/common.nixnew file+11
@@ -0,0 +1,11 @@
1+{ fetchurl }:
2+
3+rec {
4+ version = "4.0.6";
5+ name = "mingw-w64-${version}";
6+
7+ src = fetchurl {
8+ url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2";
9+ sha256 = "0p01vm5kx1ixc08402z94g1alip4vx66gjpvyi9maqyqn2a76h0c";
10+ };
11+}
pkgs/os-specific/windows/mingw-w64/default.nix+4−34
@@ -1,36 +1,6 @@
1−{ stdenv, fetchurl, binutils ? null, gccCross ? null
2−, onlyHeaders ? false
3−, onlyPthreads ? false
4−}:
5−
6−let
7− version = "4.0.6";
8− name = "mingw-w64-${version}";
9−in
10−stdenv.mkDerivation ({
11− inherit name;
12−
13− src = fetchurl {
14− url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2";
15− sha256 = "0p01vm5kx1ixc08402z94g1alip4vx66gjpvyi9maqyqn2a76h0c";
16− };
17−} //
18−(if onlyHeaders then {
19− name = name + "-headers";
20− preConfigure = ''
21− cd mingw-w64-headers
22− '';
23− configureFlags = "--without-crt";
24−} else if onlyPthreads then {
25− name = name + "-pthreads";
26− preConfigure = ''
27− cd mingw-w64-libraries/winpthreads
28− '';
29−} else {
30− buildInputs = [ gccCross binutils ];
31−
32− crossConfig = gccCross.crossConfig;
1+{ stdenv, callPackage }:
332
3+stdenv.mkDerivation {
4+ inherit (callPackage ./common.nix {}) name src;
345 dontStrip = true;
35−})
36−)
6+}
pkgs/os-specific/windows/mingw-w64/headers.nixnew file+13
@@ -0,0 +1,13 @@
1+{ stdenvNoCC, callPackage }:
2+
3+let
4+ inherit (callPackage ./common.nix {}) name src;
5+
6+in stdenvNoCC.mkDerivation {
7+ name = name + "-headers";
8+ inherit src;
9+
10+ preConfigure = ''
11+ cd mingw-w64-headers
12+ '';
13+}
pkgs/os-specific/windows/mingw-w64/pthreads.nixnew file+13
@@ -0,0 +1,13 @@
1+{ stdenvNoCC, callPackage }:
2+
3+let
4+ inherit (callPackage ./common.nix {}) name src;
5+
6+in stdenvNoCC.mkDerivation {
7+ name = name + "-pthreads";
8+ inherit src;
9+
10+ preConfigure = ''
11+ cd mingw-w64-libraries/winpthreads
12+ '';
13+}
pkgs/top-level/all-packages.nix+14−17
@@ -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;