treewide: replace libc == "msvcrt" with isMinGW

msvcrt is only one of the libcs in MinGW. We therefore
replace explictly testing for msvcrt with the isMinGW
predicate. This lays the foundation for ucrt64 support.

+14 -14
+1 -1
pkgs/development/compilers/gcc/common/configure-flags.nix
··· 47 # See https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903 48 disableBootstrap' = disableBootstrap && !langFortran && !langGo; 49 50 - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; 51 crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; 52 53 targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
··· 47 # See https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903 48 disableBootstrap' = disableBootstrap && !langFortran && !langGo; 49 50 + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; 51 crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem"; 52 53 targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
+1 -1
pkgs/development/compilers/gcc/common/libgcc.nix
··· 19 (pkg: pkg.overrideAttrs (previousAttrs: 20 lib.optionalAttrs ( 21 targetPlatform != hostPlatform && 22 - (enableShared || targetPlatform.libc == "msvcrt") && 23 withoutTargetLibc 24 ) { 25 makeFlags = [ "all-gcc" "all-target-libgcc" ];
··· 19 (pkg: pkg.overrideAttrs (previousAttrs: 20 lib.optionalAttrs ( 21 targetPlatform != hostPlatform && 22 + (enableShared || targetPlatform.isMinGW) && 23 withoutTargetLibc 24 ) { 25 makeFlags = [ "all-gcc" "all-target-libgcc" ];
+1 -1
pkgs/development/compilers/gcc/default.nix
··· 115 patches = callFile ./patches {}; 116 117 /* Cross-gcc settings (build == host != target) */ 118 - crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; 119 stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; 120 crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; 121
··· 115 patches = callFile ./patches {}; 116 117 /* Cross-gcc settings (build == host != target) */ 118 + crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW; 119 stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; 120 crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; 121
+3 -3
pkgs/development/libraries/boost/generic.nix
··· 9 , enableDebug ? false 10 , enableSingleThreaded ? false 11 , enableMultiThreaded ? true 12 - , enableShared ? !(with stdenv.hostPlatform; isStatic || libc == "msvcrt") # problems for now 13 , enableStatic ? !enableShared 14 , enablePython ? false 15 , enableNumpy ? false ··· 91 ++ lib.optional (!enablePython) "--without-python" 92 ++ lib.optional needUserConfig "--user-config=user-config.jam" 93 ++ lib.optional (stdenv.buildPlatform.isDarwin && stdenv.hostPlatform.isLinux) "pch=off" 94 - ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ 95 "threadapi=win32" 96 ] ++ extraB2Args 97 ); ··· 252 # Make boost header paths relative so that they are not runtime dependencies 253 cd "$dev" && find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ 254 -exec sed '1s/^\xef\xbb\xbf//;1i#line 1 "{}"' -i '{}' \; 255 - '' + lib.optionalString (stdenv.hostPlatform.libc == "msvcrt") '' 256 $RANLIB "$out/lib/"*.a 257 ''; 258
··· 9 , enableDebug ? false 10 , enableSingleThreaded ? false 11 , enableMultiThreaded ? true 12 + , enableShared ? !(with stdenv.hostPlatform; isStatic || isMinGW) # problems for now 13 , enableStatic ? !enableShared 14 , enablePython ? false 15 , enableNumpy ? false ··· 91 ++ lib.optional (!enablePython) "--without-python" 92 ++ lib.optional needUserConfig "--user-config=user-config.jam" 93 ++ lib.optional (stdenv.buildPlatform.isDarwin && stdenv.hostPlatform.isLinux) "pch=off" 94 + ++ lib.optionals stdenv.hostPlatform.isMinGW [ 95 "threadapi=win32" 96 ] ++ extraB2Args 97 ); ··· 252 # Make boost header paths relative so that they are not runtime dependencies 253 cd "$dev" && find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \ 254 -exec sed '1s/^\xef\xbb\xbf//;1i#line 1 "{}"' -i '{}' \; 255 + '' + lib.optionalString stdenv.hostPlatform.isMinGW '' 256 $RANLIB "$out/lib/"*.a 257 ''; 258
+1 -1
pkgs/development/libraries/libiconv/default.nix
··· 23 ]; 24 25 postPatch = 26 - lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc) 27 '' 28 sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h 29 ''
··· 23 ]; 24 25 postPatch = 26 + lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isMinGW) || stdenv.cc.nativeLibc) 27 '' 28 sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h 29 ''
+1 -1
pkgs/development/libraries/libjpeg-turbo/default.nix
··· 42 43 # This is needed by freeimage 44 patches = [ ./0001-Compile-transupp.c-as-part-of-the-library.patch ] 45 - ++ lib.optional (stdenv.hostPlatform.libc or null == "msvcrt") 46 ./mingw-boolean.patch; 47 48 outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];
··· 42 43 # This is needed by freeimage 44 patches = [ ./0001-Compile-transupp.c-as-part-of-the-library.patch ] 45 + ++ lib.optional stdenv.hostPlatform.isMinGW 46 ./mingw-boolean.patch; 47 48 outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];
+1 -1
pkgs/development/libraries/libxml2/default.nix
··· 17 (stdenv.hostPlatform == stdenv.buildPlatform || stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isWasi) 18 , icuSupport ? false 19 , icu 20 - , enableShared ? stdenv.hostPlatform.libc != "msvcrt" && !stdenv.hostPlatform.isStatic 21 , enableStatic ? !enableShared 22 , gnome 23 }:
··· 17 (stdenv.hostPlatform == stdenv.buildPlatform || stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isWasi) 18 , icuSupport ? false 19 , icu 20 + , enableShared ? !stdenv.hostPlatform.isMinGW && !stdenv.hostPlatform.isStatic 21 , enableStatic ? !enableShared 22 , gnome 23 }:
+4 -4
pkgs/development/libraries/zlib/default.nix
··· 51 setOutputFlags = false; 52 outputDoc = "dev"; # single tiny man3 page 53 54 - dontConfigure = stdenv.hostPlatform.libc == "msvcrt"; 55 56 preConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' 57 export CHOST=${stdenv.hostPlatform.config} ··· 96 '' 97 # Non-typical naming confuses libtool which then refuses to use zlib's DLL 98 # in some cases, e.g. when compiling libpng. 99 - + lib.optionalString (stdenv.hostPlatform.libc == "msvcrt" && shared) '' 100 ln -s zlib1.dll $out/bin/libz.dll 101 ''; 102 ··· 109 dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static; 110 configurePlatforms = []; 111 112 - installFlags = lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ 113 "BINARY_PATH=$(out)/bin" 114 "INCLUDE_PATH=$(dev)/include" 115 "LIBRARY_PATH=$(out)/lib" ··· 120 121 makeFlags = [ 122 "PREFIX=${stdenv.cc.targetPrefix}" 123 - ] ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ 124 "-f" "win32/Makefile.gcc" 125 ] ++ lib.optionals shared [ 126 # Note that as of writing (zlib 1.2.11), this flag only has an effect
··· 51 setOutputFlags = false; 52 outputDoc = "dev"; # single tiny man3 page 53 54 + dontConfigure = stdenv.hostPlatform.isMinGW; 55 56 preConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' 57 export CHOST=${stdenv.hostPlatform.config} ··· 96 '' 97 # Non-typical naming confuses libtool which then refuses to use zlib's DLL 98 # in some cases, e.g. when compiling libpng. 99 + + lib.optionalString (stdenv.hostPlatform.isMinGW && shared) '' 100 ln -s zlib1.dll $out/bin/libz.dll 101 ''; 102 ··· 109 dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static; 110 configurePlatforms = []; 111 112 + installFlags = lib.optionals stdenv.hostPlatform.isMinGW [ 113 "BINARY_PATH=$(out)/bin" 114 "INCLUDE_PATH=$(dev)/include" 115 "LIBRARY_PATH=$(out)/lib" ··· 120 121 makeFlags = [ 122 "PREFIX=${stdenv.cc.targetPrefix}" 123 + ] ++ lib.optionals stdenv.hostPlatform.isMinGW [ 124 "-f" "win32/Makefile.gcc" 125 ] ++ lib.optionals shared [ 126 # Note that as of writing (zlib 1.2.11), this flag only has an effect
+1 -1
pkgs/top-level/all-packages.nix
··· 21741 # These are used when buiding compiler-rt / libgcc, prior to building libc. 21742 preLibcCrossHeaders = let 21743 inherit (stdenv.targetPlatform) libc; 21744 - in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers 21745 else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers 21746 else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross 21747 else null;
··· 21741 # These are used when buiding compiler-rt / libgcc, prior to building libc. 21742 preLibcCrossHeaders = let 21743 inherit (stdenv.targetPlatform) libc; 21744 + in if stdenv.targetPlatform.isMinGW then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers 21745 else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers 21746 else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross 21747 else null;