mingw-w64: Clean up, especially clarifying staging

authored by John Ericson and committed by John Ericson bb7067f8 c2e2152a

+55 -51
+11
pkgs/os-specific/windows/mingw-w64/common.nix
··· 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 + }
+4 -34
pkgs/os-specific/windows/mingw-w64/default.nix
··· 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 ]; 1 + { stdenv, callPackage }: 31 2 32 - crossConfig = gccCross.crossConfig; 33 - 3 + stdenv.mkDerivation { 4 + inherit (callPackage ./common.nix {}) name src; 34 5 dontStrip = true; 35 - }) 36 - ) 6 + }
+13
pkgs/os-specific/windows/mingw-w64/headers.nix
··· 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 + }
+13
pkgs/os-specific/windows/mingw-w64/pthreads.nix
··· 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 + }
+14 -17
pkgs/top-level/all-packages.nix
··· 5163 5163 5164 5164 gccApple = throw "gccApple is no longer supported"; 5165 5165 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 + 5166 5174 gccCrossStageStatic = assert targetPlatform != buildPlatform; let 5167 5175 libcCross1 = 5168 - if targetPlatform.libc == "msvcrt" then windows.mingw_w64_headers 5176 + if targetPlatform.libc == "msvcrt" then __targetPackages.windows.mingw_w64_headers 5169 5177 else if targetPlatform.libc == "libSystem" then darwin.xcode 5170 5178 else null; 5171 5179 in wrapCCCross { ··· 7800 7808 # Being redundant to avoid cycles on boot. TODO: find a better way 7801 7809 glibcCross = callPackage ../development/libraries/glibc { 7802 7810 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; 7810 7812 }; 7811 7813 7812 7814 # We can choose: ··· 7815 7817 # hack fixes the hack, *sigh*. 7816 7818 /**/ if name == "glibc" then __targetPackages.glibcCross or glibcCross 7817 7819 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 7819 7821 else if name == "libSystem" then darwin.xcode 7820 7822 else throw "Unknown libc"; 7821 7823 ··· 12561 12563 }; 12562 12564 12563 12565 mingw_w64 = callPackage ../os-specific/windows/mingw-w64 { 12564 - gccCross = gccCrossStageStatic; 12565 - binutils = binutils; 12566 + stdenv = crossLibcStdenv; 12566 12567 }; 12567 12568 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 { }; 12571 12570 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 { }; 12575 12572 12576 12573 pthreads = callPackage ../os-specific/windows/pthread-w32 { 12577 12574 mingw_headers = mingw_headers3;