cross: Allow Windows toolchains to use ucrt as libc.
This commit is contained in:
parent
4447d4071b
commit
504d38ae7b
|
@ -79,7 +79,7 @@ let majorVersion = "10";
|
|||
});
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
|
@ -292,7 +292,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ let majorVersion = "11";
|
|||
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
|
@ -296,7 +296,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ let majorVersion = "4";
|
|||
javaAwtGtk = langJava && x11Support;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
|
@ -316,7 +316,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ let majorVersion = "4";
|
|||
javaAwtGtk = langJava && x11Support;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
|
@ -332,7 +332,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ let majorVersion = "6";
|
|||
javaAwtGtk = langJava && x11Support;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
|
@ -345,7 +345,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ let majorVersion = "7";
|
|||
++ [ ../libsanitizer-no-cyclades-9.patch ];
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
|
@ -301,7 +301,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ let majorVersion = "8";
|
|||
++ [ ../libsanitizer-no-cyclades-9.patch ];
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
|
@ -280,7 +280,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ let majorVersion = "9";
|
|||
++ [ ../libsanitizer-no-cyclades-9.patch ];
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
|
@ -311,7 +311,7 @@ stdenv.mkDerivation ({
|
|||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ let
|
|||
inherit (stdenv)
|
||||
buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
|
||||
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
|
||||
|
||||
targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
, enableDebug ? false
|
||||
, enableSingleThreaded ? false
|
||||
, enableMultiThreaded ? true
|
||||
, enableShared ? !(with stdenv.hostPlatform; isStatic || libc == "msvcrt") # problems for now
|
||||
, enableShared ? !(with stdenv.hostPlatform; isStatic || isMinGW) # problems for now
|
||||
, enableStatic ? !enableShared
|
||||
, enablePython ? false
|
||||
, enableNumpy ? false
|
||||
|
@ -102,7 +102,7 @@ let
|
|||
++ optional (toolset != null) "toolset=${toolset}"
|
||||
++ optional (!enablePython) "--without-python"
|
||||
++ optional needUserConfig "--user-config=user-config.jam"
|
||||
++ optionals (stdenv.hostPlatform.libc == "msvcrt") [
|
||||
++ optionals (stdenv.hostPlatform.isMinGW) [
|
||||
"threadapi=win32"
|
||||
] ++ extraB2Args
|
||||
);
|
||||
|
@ -252,7 +252,7 @@ stdenv.mkDerivation {
|
|||
# Make boost header paths relative so that they are not runtime dependencies
|
||||
cd "$dev" && find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
|
||||
-exec sed '1s/^\xef\xbb\xbf//;1i#line 1 "{}"' -i '{}' \;
|
||||
'' + optionalString (stdenv.hostPlatform.libc == "msvcrt") ''
|
||||
'' + optionalString (stdenv.hostPlatform.isMinGW) ''
|
||||
$RANLIB "$out/lib/"*.a
|
||||
'';
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
|
|||
];
|
||||
|
||||
postPatch =
|
||||
lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
|
||||
lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isMinGW) || stdenv.cc.nativeLibc)
|
||||
''
|
||||
sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h
|
||||
''
|
||||
|
|
|
@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
|
|||
|
||||
# This is needed by freeimage
|
||||
patches = [ ./0001-Compile-transupp.c-as-part-of-the-library.patch ]
|
||||
++ lib.optional (stdenv.hostPlatform.libc or null == "msvcrt")
|
||||
++ lib.optional (stdenv.hostPlatform.isMinGW)
|
||||
./mingw-boolean.patch;
|
||||
|
||||
outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
, pythonSupport ? enableShared && stdenv.buildPlatform == stdenv.hostPlatform
|
||||
, icuSupport ? false
|
||||
, icu
|
||||
, enableShared ? stdenv.hostPlatform.libc != "msvcrt" && !stdenv.hostPlatform.isStatic
|
||||
, enableShared ? !stdenv.hostPlatform.isMinGW && !stdenv.hostPlatform.isStatic
|
||||
, enableStatic ? !enableShared
|
||||
, gnome
|
||||
}:
|
||||
|
|
|
@ -88,7 +88,7 @@ stdenv.mkDerivation (rec {
|
|||
''
|
||||
# Non-typical naming confuses libtool which then refuses to use zlib's DLL
|
||||
# in some cases, e.g. when compiling libpng.
|
||||
+ lib.optionalString (stdenv.hostPlatform.libc == "msvcrt" && shared) ''
|
||||
+ lib.optionalString (stdenv.hostPlatform.isMinGW && shared) ''
|
||||
ln -s zlib1.dll $out/bin/libz.dll
|
||||
'';
|
||||
|
||||
|
@ -101,7 +101,7 @@ stdenv.mkDerivation (rec {
|
|||
dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static;
|
||||
configurePlatforms = [];
|
||||
|
||||
installFlags = lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
|
||||
installFlags = lib.optionals (stdenv.hostPlatform.isMinGW) [
|
||||
"BINARY_PATH=$(out)/bin"
|
||||
"INCLUDE_PATH=$(dev)/include"
|
||||
"LIBRARY_PATH=$(out)/lib"
|
||||
|
@ -112,7 +112,7 @@ stdenv.mkDerivation (rec {
|
|||
|
||||
makeFlags = [
|
||||
"PREFIX=${stdenv.cc.targetPrefix}"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isMinGW) [
|
||||
"-f" "win32/Makefile.gcc"
|
||||
] ++ lib.optionals shared [
|
||||
# Note that as of writing (zlib 1.2.11), this flag only has an effect
|
||||
|
@ -134,6 +134,6 @@ stdenv.mkDerivation (rec {
|
|||
preConfigure = ''
|
||||
export CHOST=${stdenv.hostPlatform.config}
|
||||
'';
|
||||
} // lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") {
|
||||
} // lib.optionalAttrs (stdenv.hostPlatform.isMinGW) {
|
||||
dontConfigure = true;
|
||||
})
|
||||
|
|
|
@ -19,6 +19,7 @@ let
|
|||
then [] # maybe autoconf will save us
|
||||
else map (arch: lib.enableFeature (arch == enabledArch) "lib${arch}") knownArches;
|
||||
|
||||
crt = stdenv.hostPlatform.libc;
|
||||
in stdenv.mkDerivation {
|
||||
pname = "mingw-w64";
|
||||
inherit version;
|
||||
|
@ -33,6 +34,7 @@ in stdenv.mkDerivation {
|
|||
configureFlags = [
|
||||
"--enable-idl"
|
||||
"--enable-secure-api"
|
||||
"--with-default-msvcrt=${crt}"
|
||||
] ++ archFlags;
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
@ -43,5 +45,6 @@ in stdenv.mkDerivation {
|
|||
|
||||
meta = {
|
||||
platforms = lib.platforms.windows;
|
||||
broken = !(lib.elem crt [ "msvcrt" "ucrt" ]);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{ stdenvNoCC, mingw_w64 }:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
let
|
||||
crt = stdenvNoCC.hostPlatform.libc;
|
||||
in stdenvNoCC.mkDerivation {
|
||||
name = "${mingw_w64.name}-headers";
|
||||
inherit (mingw_w64) src meta;
|
||||
|
||||
|
@ -8,4 +10,10 @@ stdenvNoCC.mkDerivation {
|
|||
cd mingw-w64-headers
|
||||
'';
|
||||
|
||||
configureFlags = [
|
||||
"--enable-idl"
|
||||
"--enable-secure-api"
|
||||
"--with-default-msvcrt=${crt}"
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -17415,7 +17415,7 @@ with pkgs;
|
|||
# These are used when buiding compiler-rt / libgcc, prior to building libc.
|
||||
preLibcCrossHeaders = let
|
||||
inherit (stdenv.targetPlatform) libc;
|
||||
in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers
|
||||
in if libc == "msvcrt" || libc == "ucrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers
|
||||
else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers
|
||||
else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross
|
||||
else null;
|
||||
|
@ -17434,7 +17434,7 @@ with pkgs;
|
|||
else if name == "newlib" then targetPackages.newlibCross or newlibCross
|
||||
else if name == "newlib-nano" then targetPackages.newlib-nanoCross or newlib-nanoCross
|
||||
else if name == "musl" then targetPackages.muslCross or muslCross
|
||||
else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
|
||||
else if name == "msvcrt" || name == "ucrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
|
||||
else if name == "libSystem" then
|
||||
if stdenv.targetPlatform.useiOSPrebuilt
|
||||
then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries
|
||||
|
|
Loading…
Reference in a new issue