Revert "Add mingwW64-llvm cross-system."

This commit is contained in:
Janne Heß 2022-05-18 13:50:23 +02:00 committed by GitHub
parent 7456be85db
commit c911240e9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 85 additions and 681 deletions

View File

@ -301,15 +301,6 @@ rec {
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
};
# 64 bit mingw-w64 with a llvm-based toolchain targetting ucrt
#
# Inspired by mstorsjo/llvm-mingw
mingwW64-llvm = {
config = "x86_64-w64-mingw32";
libc = "ucrt";
useLLVM = true;
};
# BSDs
amd64-netbsd = lib.warn "The amd64-netbsd system example is deprecated. Use x86_64-netbsd instead." x86_64-netbsd;

View File

@ -1,6 +0,0 @@
# ld.lld has two incompatible command-line drivers: One for the gnu-compatible COFF linker and one for
# the ELF linker. If no emulation is set (with -m), it will default to the ELF linker;
# unfortunately, some configure scripts use `ld --help` to check for certain Windows-specific flags,
# which don't show up in the help for the ELF linker. So we set a default -m here.
extraBefore+=("-m" "@mtype@")

View File

@ -31,13 +31,6 @@
# Darwin code signing support utilities
, postLinkSignHook ? null, signingUtils ? null
# Linker type
, isLld ? bintools.isLld or false
, isCctools ? bintools.isCctools or false
, isGNU ? bintools.isGNU or false
, isGold ? bintools.isGold or false
, isBfd ? bintools.isBfd or false
}:
with lib;
@ -120,8 +113,6 @@ stdenv.mkDerivation {
passthru = {
inherit bintools libc nativeTools nativeLibc nativePrefix;
inherit isLld isCctools isGNU isGold isBfd;
emacsBufferSetup = pkgs: ''
; We should handle propagation here too
(mapc
@ -302,11 +293,6 @@ stdenv.mkDerivation {
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags
''
# lld's MinGW driver (e.g. `ld.lld -m i386pep`) does not support the `-z` flag.
+ optionalString (targetPlatform.isWindows && isLld) ''
hardening_unsupported_flags+=" relro bindnow"
''
##
## GNU specific extra strip flags
##
@ -351,24 +337,6 @@ stdenv.mkDerivation {
''
)
##
## Set the default machine type so that $prefix-ld.lld uses the COFF driver for --help
##
## Needed because autotools parses --help for linker features...
##
+ optionalString (isLld && stdenv.targetPlatform.isWindows) (let
mtype =
/**/ if targetPlatform.isx86_32 then "i386pe"
else if targetPlatform.isx86_64 then "i386pep"
else if targetPlatform.isAarch32 then "thumb2pe"
else if targetPlatform.isAarch64 then "arm64pe"
else throw "unsupported target arch for lld";
in ''
export mtype=${mtype}
substituteAll ${./add-lld-ldflags-before.sh} add-local-ldflags-before.sh
cat add-local-ldflags-before.sh >> $out/nix-support/add-local-ldflags-before.sh
'')
##
## Code signing on Apple Silicon
##

View File

@ -18,7 +18,6 @@
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
, buildPackages ? {}
, libcxx ? null
, isCompilerRT ? false
}:
with lib;
@ -147,7 +146,7 @@ stdenv.mkDerivation {
# Binutils, and Apple's "cctools"; "bintools" as an attempt to find an
# unused middle-ground name that evokes both.
inherit bintools;
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang isCompilerRT;
inherit libc nativeTools nativeLibc nativePrefix isGNU isClang;
emacsBufferSetup = pkgs: ''
; We should handle propagation here too
@ -480,8 +479,6 @@ stdenv.mkDerivation {
hardening_unsupported_flags+=" pic"
'' + optionalString targetPlatform.isMinGW ''
hardening_unsupported_flags+=" stackprotector fortify"
'' + optionalString (targetPlatform.isWindows && isClang) ''
hardening_unsupported_flags+=" pic"
'' + optionalString targetPlatform.isAvr ''
hardening_unsupported_flags+=" stackprotector pic"
'' + optionalString (targetPlatform.libc == "newlib") ''

View File

@ -79,7 +79,7 @@ let majorVersion = "10";
});
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
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.isMinGW && crossStageStatic) {
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}

View File

@ -83,7 +83,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.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
@ -297,7 +297,7 @@ stdenv.mkDerivation ({
};
}
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.isMinGW && crossStageStatic) {
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}

View File

@ -114,7 +114,7 @@ let majorVersion = "4";
javaAwtGtk = langJava && x11Support;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
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.isMinGW && crossStageStatic) {
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}

View File

@ -130,7 +130,7 @@ let majorVersion = "4";
javaAwtGtk = langJava && x11Support;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
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.isMinGW && crossStageStatic) {
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}

View File

@ -111,7 +111,7 @@ let majorVersion = "6";
javaAwtGtk = langJava && x11Support;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
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.isMinGW && crossStageStatic) {
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}

View File

@ -87,7 +87,7 @@ let majorVersion = "7";
++ [ ../libsanitizer-no-cyclades-9.patch ];
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
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.isMinGW && crossStageStatic) {
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}

View File

@ -71,7 +71,7 @@ let majorVersion = "8";
++ [ ../libsanitizer-no-cyclades-9.patch ];
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
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.isMinGW && crossStageStatic) {
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}

View File

@ -98,7 +98,7 @@ let majorVersion = "9";
++ [ ../libsanitizer-no-cyclades-9.patch ];
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
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.isMinGW && crossStageStatic) {
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
makeFlags = [ "all-gcc" "all-target-libgcc" ];
installTargets = "install-gcc install-target-libgcc";
}

View File

@ -41,7 +41,7 @@ let
inherit (stdenv)
buildPlatform hostPlatform targetPlatform;
crossMingw = targetPlatform != hostPlatform && targetPlatform.isMinGW;
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
crossDarwin = targetPlatform != hostPlatform && targetPlatform.libc == "libSystem";
targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)

View File

@ -5,7 +5,7 @@ let
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)

View File

@ -5,7 +5,7 @@ let
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)

View File

@ -5,7 +5,7 @@ let
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)

View File

@ -1,17 +1,11 @@
{ runCommand, stdenv, llvm, lld, version, lib }:
{ runCommand, stdenv, llvm, lld, version }:
let
prefix =
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true;
passthru = {
isLld = true;
targetPrefix = prefix;
};
} (''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)
@ -32,7 +26,4 @@ in runCommand "llvm-binutils-${version}" {
ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
'' + lib.optionalString stdenv.targetPlatform.isWindows ''
ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres
ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool
'')
''

View File

@ -168,7 +168,6 @@ let
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibcxx = wrapCCWith rec {
@ -183,7 +182,6 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
echo "-nostdlib++" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibc = wrapCCWith rec {
@ -197,7 +195,6 @@ let
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoCompilerRt = wrapCCWith rec {

View File

@ -1,5 +1,5 @@
{ lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version
, libcxxabi, libunwind
, libcxxabi
, enableShared ? !stdenv.hostPlatform.isStatic
# If headersOnly is true, the resulting package would only include the headers.
@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python3 ]
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind);
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ]
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
@ -41,13 +41,7 @@ stdenv.mkDerivation rec {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
]
++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
++ lib.optionals (!headersOnly && libcxxabi.semi-static) [
"-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE"
"-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib"
] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder)
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON";
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
buildFlags = lib.optional headersOnly "generate-cxx-headers";
installTargets = lib.optional headersOnly "install-cxx-headers";

View File

@ -2,14 +2,9 @@
, enableShared ? !stdenv.hostPlatform.isStatic
, standalone ? stdenv.hostPlatform.useLLVM or false
, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm
}: let
# lld doesn't support unresolved references on Windows https://github.com/llvm/llvm-project/issues/55245
semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld;
}:
enableShared' = enableShared && !semi-static;
useLLVMUnwinder = standalone && withLibunwind;
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "libcxxabi";
inherit version;
@ -31,24 +26,18 @@ in stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python3 ];
buildInputs = lib.optional withLibunwind libunwind;
passthru = { inherit semi-static useLLVMUnwinder; };
cmakeFlags = [
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
] ++ lib.optionals standalone [
"-DLLVM_ENABLE_LIBCXX=ON"
] ++ lib.optionals useLLVMUnwinder [
] ++ lib.optionals (standalone && withLibunwind) [
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
] ++ lib.optionals stdenv.hostPlatform.isWasm [
"-DLIBCXXABI_ENABLE_THREADS=OFF"
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals (!enableShared') [
] ++ lib.optionals (!enableShared) [
"-DLIBCXXABI_ENABLE_SHARED=OFF"
] ++ lib.optionals semi-static [
"-DLIBCXX_ENABLE_SHARED=ON"
"-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON"
] ++ lib.optional stdenv.cc.isCompilerRT
"-DLIBCXXABI_USE_COMPILER_RT=ON";
];
installPhase = if stdenv.isDarwin
then ''
@ -67,7 +56,7 @@ in stdenv.mkDerivation rec {
install -d -m 755 $out/include $out/lib
install -m 644 lib/libc++abi.a $out/lib
install -m 644 ../include/cxxabi.h $out/include
'' + lib.optionalString enableShared' ''
'' + lib.optionalString enableShared ''
install -m 644 lib/libc++abi.so.1.0 $out/lib
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1

View File

@ -17,9 +17,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
cmakeFlags =
lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"
++ lib.optional (stdenv.cc.isCompilerRT) "-DLIBUNWIND_USE_COMPILER_RT=TRUE";
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
meta = llvm_meta // {
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst

View File

@ -1,17 +1,11 @@
{ runCommand, stdenv, llvm, lld, version, lib }:
{ runCommand, stdenv, llvm, lld, version }:
let
prefix =
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true;
passthru = {
isLld = true;
targetPrefix = prefix;
};
} (''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)
@ -32,7 +26,4 @@ in runCommand "llvm-binutils-${version}" {
ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
'' + lib.optionalString stdenv.targetPlatform.isWindows ''
ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres
ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool
'')
''

View File

@ -169,7 +169,6 @@ let
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
"-lunwind"
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
isCompilerRT = true;
};
clangNoLibcxx = wrapCCWith rec {
@ -185,7 +184,6 @@ let
"-B${targetLlvmLibraries.compiler-rt}/lib"
"-nostdlib++"
];
isCompilerRT = true;
};
clangNoLibc = wrapCCWith rec {
@ -200,7 +198,6 @@ let
"-rtlib=compiler-rt"
"-B${targetLlvmLibraries.compiler-rt}/lib"
];
isCompilerRT = true;
};
clangNoCompilerRt = wrapCCWith rec {

View File

@ -1,7 +1,7 @@
{ lib, stdenv, llvm_meta
, monorepoSrc, runCommand
, cmake, python3, fixDarwinDylibNames, version
, libcxxabi, libunwind
, libcxxabi
, enableShared ? !stdenv.hostPlatform.isStatic
# If headersOnly is true, the resulting package would only include the headers.
@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python3 ]
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind);
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ]
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
@ -57,13 +57,7 @@ stdenv.mkDerivation rec {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
]
++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
++ lib.optionals (!headersOnly && libcxxabi.semi-static) [
"-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE"
"-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib"
] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder)
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON";
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
buildFlags = lib.optional headersOnly "generate-cxx-headers";
installTargets = lib.optional headersOnly "install-cxx-headers";

View File

@ -2,17 +2,9 @@
, monorepoSrc, runCommand
, cxx-headers, libunwind, version
, enableShared ? !stdenv.hostPlatform.isStatic
}: let
withLibunwind = !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm;
}:
semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld;
enableShared' = enableShared && !semi-static;
standalone = stdenv.hostPlatform.useLLVM or false;
useLLVMUnwinder = standalone && withLibunwind;
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "libcxxabi";
inherit version;
@ -43,26 +35,19 @@ in stdenv.mkDerivation rec {
];
nativeBuildInputs = [ cmake python3 ];
buildInputs = lib.optional withLibunwind libunwind;
passthru = { inherit semi-static useLLVMUnwinder; };
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
cmakeFlags = [
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
] ++ lib.optionals standalone [
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLLVM_ENABLE_LIBCXX=ON"
] ++ lib.optionals useLLVMUnwinder [
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
] ++ lib.optionals stdenv.hostPlatform.isWasm [
"-DLIBCXXABI_ENABLE_THREADS=OFF"
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals (!enableShared') [
] ++ lib.optionals (!enableShared) [
"-DLIBCXXABI_ENABLE_SHARED=OFF"
] ++ lib.optionals semi-static [
"-DLIBCXX_ENABLE_SHARED=ON"
"-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON"
] ++ lib.optional stdenv.cc.isCompilerRT
"-DLIBCXXABI_USE_COMPILER_RT=ON";
];
installPhase = if stdenv.isDarwin
then ''
@ -81,7 +66,7 @@ in stdenv.mkDerivation rec {
install -d -m 755 $out/include $out/lib
install -m 644 lib/libc++abi.a $out/lib
install -m 644 ../include/cxxabi.h $out/include
'' + lib.optionalString enableShared' ''
'' + lib.optionalString enableShared ''
install -m 644 lib/libc++abi.so.1.0 $out/lib
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1

View File

@ -31,9 +31,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
cmakeFlags =
lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"
++ lib.optional (stdenv.cc.isCompilerRT) "-DLIBUNWIND_USE_COMPILER_RT=TRUE";
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
meta = llvm_meta // {
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst

View File

@ -5,7 +5,7 @@ let
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)

View File

@ -5,7 +5,7 @@ let
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)

View File

@ -5,7 +5,7 @@ let
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; passthru.isLld = true; } ''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)

View File

@ -1,17 +1,11 @@
{ runCommand, stdenv, llvm, lld, version, lib }:
{ runCommand, stdenv, llvm, lld, version }:
let
prefix =
if stdenv.hostPlatform != stdenv.targetPlatform
then "${stdenv.targetPlatform.config}-"
else "";
in runCommand "llvm-binutils-${version}" {
preferLocalBuild = true;
passthru = {
isLld = true;
targetPrefix = prefix;
};
} (''
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/${prefix}$(basename $prog)
@ -32,7 +26,4 @@ in runCommand "llvm-binutils-${version}" {
ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
'' + lib.optionalString stdenv.targetPlatform.isWindows ''
ln -s ${llvm}/bin/llvm-windres $out/bin/${prefix}windres
ln -s ${llvm}/bin/llvm-dlltool $out/bin/${prefix}dlltool
'')
''

View File

@ -168,7 +168,6 @@ let
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibcxx = wrapCCWith rec {
@ -183,7 +182,6 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
echo "-nostdlib++" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoLibc = wrapCCWith rec {
@ -197,7 +195,6 @@ let
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
isCompilerRT = true;
};
clangNoCompilerRt = wrapCCWith rec {

View File

@ -1,7 +1,7 @@
{ lib, stdenv, llvm_meta
, monorepoSrc, runCommand
, cmake, python3, fixDarwinDylibNames, version
, libcxxabi, libunwind
, libcxxabi
, enableShared ? !stdenv.hostPlatform.isStatic
# If headersOnly is true, the resulting package would only include the headers.
@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python3 ]
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind);
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ]
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
@ -57,14 +57,7 @@ stdenv.mkDerivation rec {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
]
++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF"
++ lib.optionals (!headersOnly && libcxxabi.semi-static) [
"-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=TRUE"
"-DLIBCXX_CXX_ABI_LIBRARY_PATH=${libcxxabi}/lib"
] ++ lib.optional (!headersOnly && libcxxabi.useLLVMUnwinder)
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON";
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
buildFlags = lib.optional headersOnly "generate-cxx-headers";
installTargets = lib.optional headersOnly "install-cxx-headers";

View File

@ -2,17 +2,7 @@
, monorepoSrc, runCommand
, cxx-headers, libunwind, version
, enableShared ? !stdenv.hostPlatform.isStatic
}: let
withLibunwind = !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm;
semi-static = enableShared && stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld;
enableShared' = enableShared && !semi-static;
standalone = stdenv.hostPlatform.useLLVM or false;
useLLVMUnwinder = standalone && withLibunwind;
in
}:
stdenv.mkDerivation rec {
pname = "libcxxabi";
@ -45,27 +35,19 @@ stdenv.mkDerivation rec {
];
nativeBuildInputs = [ cmake python3 ];
buildInputs = lib.optional withLibunwind libunwind;
passthru = { inherit semi-static useLLVMUnwinder; };
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
cmakeFlags = [
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
] ++ lib.optionals standalone [
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLLVM_ENABLE_LIBCXX=ON"
] ++ lib.optionals useLLVMUnwinder [
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
] ++ lib.optionals stdenv.hostPlatform.isWasm [
"-DLIBCXXABI_ENABLE_THREADS=OFF"
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals (!enableShared') [
] ++ lib.optionals (!enableShared) [
"-DLIBCXXABI_ENABLE_SHARED=OFF"
] ++ lib.optionals semi-static [
"-DLIBCXX_ENABLE_SHARED=ON"
"-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON"
] ++ lib.optional stdenv.cc.isCompilerRT
"-DLIBCXXABI_USE_COMPILER_RT=ON";
];
installPhase = if stdenv.isDarwin
then ''
@ -84,7 +66,7 @@ stdenv.mkDerivation rec {
install -d -m 755 $out/include $out/lib
install -m 644 lib/libc++abi.a $out/lib
install -m 644 ../include/cxxabi.h $out/include
'' + lib.optionalString enableShared' ''
'' + lib.optionalString enableShared ''
install -m 644 lib/libc++abi.so.1.0 $out/lib
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1

View File

@ -31,9 +31,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
cmakeFlags =
lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"
++ lib.optional stdenv.cc.isCompilerRT "-DLIBUNWIND_USE_COMPILER_RT=TRUE";
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
meta = llvm_meta // {
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst

View File

@ -9,7 +9,7 @@
, enableDebug ? false
, enableSingleThreaded ? false
, enableMultiThreaded ? true
, enableShared ? !(with stdenv.hostPlatform; isStatic || isMinGW) # problems for now
, enableShared ? !(with stdenv.hostPlatform; isStatic || libc == "msvcrt") # problems for now
, enableStatic ? !enableShared
, enablePython ? false
, enableNumpy ? false
@ -103,7 +103,7 @@ let
++ optional (toolset != null) "toolset=${toolset}"
++ optional (!enablePython) "--without-python"
++ optional needUserConfig "--user-config=user-config.jam"
++ optionals (stdenv.hostPlatform.isMinGW) [
++ optionals (stdenv.hostPlatform.libc == "msvcrt") [
"threadapi=win32"
] ++ extraB2Args
);
@ -257,7 +257,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.isMinGW) ''
'' + optionalString (stdenv.hostPlatform.libc == "msvcrt") ''
$RANLIB "$out/lib/"*.a
'';

View File

@ -1,6 +1,6 @@
{ lib, stdenv, fetchurl, m4
, cxx ? !stdenv.hostPlatform.useAndroidPrebuilt && !stdenv.hostPlatform.isWasm
, buildPackages, autoreconfHook
, buildPackages
, withStatic ? stdenv.hostPlatform.isStatic
}:
@ -29,7 +29,7 @@ let self = stdenv.mkDerivation rec {
passthru.static = self.out;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ m4 ] ++ lib.optional stdenv.hostPlatform.isWindows autoreconfHook;
nativeBuildInputs = [ m4 ];
configureFlags = [
"--with-pic"

View File

@ -32,9 +32,7 @@ stdenv.mkDerivation rec {
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283
"--disable-exec-static-tramp"
] ++
# ld.lld on Windows doesn't support --version-script.
lib.optional (stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld) "--disable-symvers";
];
preCheck = ''
# The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE.
@ -47,8 +45,6 @@ stdenv.mkDerivation rec {
checkInputs = [ dejagnu ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isWindows autoreconfHook;
meta = with lib; {
description = "A foreign function call interface library";
longDescription = ''

View File

@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
];
postPatch =
lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isMinGW) || stdenv.cc.nativeLibc)
lib.optionalString ((stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
''
sed '/^_GL_WARN_ON_USE (gets/d' -i srclib/stdio.in.h
''

View File

@ -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.isMinGW)
++ lib.optional (stdenv.hostPlatform.libc or null == "msvcrt")
./mingw-boolean.patch;
outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];

View File

@ -14,7 +14,7 @@
, pythonSupport ? enableShared && stdenv.buildPlatform == stdenv.hostPlatform
, icuSupport ? false
, icu
, enableShared ? !stdenv.hostPlatform.isMinGW && !stdenv.hostPlatform.isStatic
, enableShared ? stdenv.hostPlatform.libc != "msvcrt" && !stdenv.hostPlatform.isStatic
, enableStatic ? !enableShared
, gnome
}:

View File

@ -46,13 +46,7 @@ stdenv.mkDerivation rec {
];
# Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
CFLAGS =
# Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
/**/ if stdenv.isSunOS then "-D_XOPEN_SOURCE_EXTENDED"
# ucrt doesn't support X_OK to access() without this flag
else if stdenv.hostPlatform.libc == "ucrt" then "-D__USE_MINGW_ACCESS"
else "";
CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
depsBuildBuild = [
buildPackages.stdenv.cc

View File

@ -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.isMinGW && shared) ''
+ lib.optionalString (stdenv.hostPlatform.libc == "msvcrt" && 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.isMinGW) [
installFlags = lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
"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.isMinGW) [
] ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
"-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.isMinGW) {
} // lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") {
dontConfigure = true;
})

View File

@ -203,11 +203,6 @@ stdenv.mkDerivation {
inherit targetPrefix;
hasGold = enableGold;
isGNU = true;
# TODO Currently platform.linker == "gold" has no effect outside
# of building GHC. If/when that's fixed, these flags should
# probably move to the invocations of bintools-wrapper
isGold = false;
isBfd = true;
};
meta = with lib; {

View File

@ -1,99 +0,0 @@
[PATCH 2/6] [cygwin|mingw] Create UAC manifest files.
* build-aux/ltmain.in (func_emit_exe_manifest): New function.
(func_mode_link) [cygwin|mingw]: Create manifest files for wrapper
and target exe when target name matches heuristic that triggers
UAC problems for newer win32 OSs. Clean up $cwrapper.manifest on
error. Ensure manifest files have executable permission.
(func_mode_uninstall): Clean up manifest files.
Various reports by Eric Blake, Kai Tietz, and Cesar Strauss.
---
build-auxltmain.in | 50 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 0418007..1821779 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -4277,6 +4277,41 @@ EOF
}
# end: func_emit_cwrapperexe_src
+# func_emit_exe_manifest
+# emit a Win32 UAC manifest for executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_exe_manifest ()
+{
+ cat <<EOF
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0"
+EOF
+
+ case $host in
+ i?86-*-* ) echo ' processorArchitecture="x86"' ;;
+ ia64-*-* ) echo ' processorArchitecture="ia64"' ;;
+ x86_64-*-* ) echo ' processorArchitecture="amd64"' ;;
+ *) echo ' processorArchitecture="*"' ;;
+ esac
+
+ cat <<EOF
+ name="$host_os.$PROGRAM.$outputname"
+ type="win32"/>
+
+ <!-- Identify the application security requirements. -->
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>
+EOF
+}
+
# func_win32_import_lib_p ARG
# True if ARG is an import lib, as indicated by $file_magic_cmd
func_win32_import_lib_p ()
@@ -8237,7 +8272,7 @@ EOF
cwrappersource="$output_path/$objdir/lt-$output_name.c"
cwrapper="$output_path/$output_name.exe"
$RM $cwrappersource $cwrapper
- trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+ trap "$RM $cwrappersource $cwrapper $cwrapper.manifest; exit $EXIT_FAILURE" 1 2 15
func_emit_cwrapperexe_src > $cwrappersource
@@ -8257,6 +8292,16 @@ EOF
$opt_dry_run || {
# note: this script will not be executed, so do not chmod.
if test "x$build" = "x$host"; then
+ # Create the UAC manifests first if necessary (but the
+ # manifest files must have executable permission regardless).
+ case $output_name in
+ *instal*|*patch*|*setup*|*update*)
+ func_emit_exe_manifest > $cwrapper.manifest
+ func_emit_exe_manifest > $output_path/$objdir/$output_name.exe.manifest
+ chmod +x $cwrapper.manifest
+ chmod +x $output_path/$objdir/$output_name.exe.manifest
+ ;;
+ esac
$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
else
func_emit_wrapper no > $func_ltwrapper_scriptname_result
@@ -8777,8 +8822,9 @@ func_mode_uninstall ()
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
func_append rmfiles " $odir/$name $odir/${name}S.$objext"
+ func_append rmfiles " ${name}.manifest $objdir/${name}.manifest"
if test yes = "$fast_install" && test -n "$relink_command"; then
- func_append rmfiles " $odir/lt-$name"
+ func_append rmfiles " $odir/lt-$name $objdir/lt-${name}.manifest"
fi
if test "X$noexename" != "X$name"; then
func_append rmfiles " $odir/lt-$noexename.c"
--
1.7.1

View File

@ -1,24 +0,0 @@
[PATCH 5/6] Fix "seems to be moved"
* build-aux/ltmain.in (func_mode_link): Compare files by inode
to fix "seems to be moved" warning.
---
build-aux/ltmain.in | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index af46cb8..244bb5b 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -6283,7 +6283,9 @@ func_mode_link ()
eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
test -z "$libdir" && \
func_fatal_error "'$deplib' is not a valid libtool archive"
- test "$absdir" != "$libdir" && \
+ abs_inode=`ls -i "$deplib" | awk '{print $1}'`
+ lib_inode=`ls -i "$libdir/$(basename $deplib)" | awk '{print $1}'`
+ test "$abs_inode" != "$lib_inode" && \
func_warning "'$deplib' seems to be moved"
path=-L$absdir
--
1.7.0.2.msysgit.0

View File

@ -1,22 +0,0 @@
[PATCH 6/6] Fix STRICT_ANSI vs POSIX
* build-aux/ltmain.in (func_mode_link): Also check for _POSIX
as well as __STRICT_ANSI__ to avoid re-definitions.
---
build-aux/ltmain.in | 4 +++-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index af46cb8..244bb5b 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -3382,7 +3382,7 @@
/* declarations of non-ANSI functions */
#if defined __MINGW32__
-# ifdef __STRICT_ANSI__
+# if defined(__STRICT_ANSI__) && !defined(__MINGW64_VERSION_MAJOR) || defined(_POSIX_)
int _putenv (const char *);
# endif
#elif defined __CYGWIN__
--
1.7.0.2.msysgit.0

View File

@ -1,22 +0,0 @@
--- libtool-2.4.2/configure.orig 2011-10-17 10:18:58.000000000 +0000
+++ libtool-2.4.2/configure 2013-08-04 19:01:30.220494400 +0000
@@ -28825,7 +28825,7 @@
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\\r'
+ ac_cs_awk_cr='\r'
else
ac_cs_awk_cr=$ac_cr
fi
--- libtool-2.4.2/libltdl/configure.orig 2011-10-17 10:19:47.000000000 +0000
+++ libtool-2.4.2/libltdl/configure 2013-08-05 11:49:24.990792500 +0000
@@ -13574,7 +13574,7 @@
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\\r'
+ ac_cs_awk_cr='\r'
else
ac_cs_awk_cr=$ac_cr
fi

View File

@ -1,24 +0,0 @@
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 0418007..91276c2 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -4163,6 +4163,7 @@
# include <unistd.h>
# include <stdint.h>
# ifdef __CYGWIN__
+# include <process.h>
# include <io.h>
# endif
#endif
diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh
index 0418007..91276c2 100644
--- a/build-aux/ltmain.sh
+++ b/build-aux/ltmain.sh
@@ -4163,6 +4163,7 @@
# include <unistd.h>
# include <stdint.h>
# ifdef __CYGWIN__
+# include <process.h>
# include <io.h>
# endif
#endif

View File

@ -1,33 +0,0 @@
From a18473ed4e5574dab899db640b8efeff78939b54 Mon Sep 17 00:00:00 2001
From: Manoj Gupta <manojgupta@chromium.org>
Date: Wed, 10 Oct 2018 10:50:23 +0300
Subject: [PATCH 1/2] Pick up clang_rt static archives compiler internal
libraries
Libtool checks only for libraries linked as -l* when trying to
find internal compiler libraries. Clang, however uses the absolute
path to link its internal libraries e.g. compiler_rt. This patch
handles clang's statically linked libraries when finding internal
compiler libraries.
https://crbug.com/749263
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866
---
m4/libtool.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index b55a6e5..d9322d0 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -7556,7 +7556,7 @@ if AC_TRY_EVAL(ac_compile); then
for p in `eval "$output_verbose_link_cmd"`; do
case $prev$p in
- -L* | -R* | -l*)
+ -L* | -R* | -l* | */libclang_rt.*.a)
# Some compilers place space between "-{L,R}" and the path.
# Remove the space.
if test x-L = "$p" ||
--
2.7.4

View File

@ -1,83 +0,0 @@
From ec15841963ca3aab3bc88fb0932c014337284bfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Wed, 10 Oct 2018 10:47:21 +0300
Subject: [PATCH 2/2] Prefer response files over linker scripts for mingw tools
The GCC/binutils tools support response files just fine, while
lld (impersonating GNU ld) only supports response files, not
linker scripts. Using a linker script as input just to pass a
list of files is overkill for cases when a response file is enough.
---
build-aux/ltmain.in | 28 ++++++++++++++--------------
m4/libtool.m4 | 2 ++
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index e2fb263..db5d590 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -7932,20 +7932,7 @@ EOF
last_robj=
k=1
- if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
- output=$output_objdir/$output_la.lnkscript
- func_verbose "creating GNU ld script: $output"
- echo 'INPUT (' > $output
- for obj in $save_libobjs
- do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result" >> $output
- done
- echo ')' >> $output
- func_append delfiles " $output"
- func_to_tool_file "$output"
- output=$func_to_tool_file_result
- elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
+ if test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
output=$output_objdir/$output_la.lnk
func_verbose "creating linker input file list: $output"
: > $output
@@ -7964,6 +7951,19 @@ EOF
func_append delfiles " $output"
func_to_tool_file "$output"
output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+ elif test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
+ output=$output_objdir/$output_la.lnkscript
+ func_verbose "creating GNU ld script: $output"
+ echo 'INPUT (' > $output
+ for obj in $save_libobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ echo ')' >> $output
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$func_to_tool_file_result
else
if test -n "$save_libobjs"; then
func_verbose "creating reloadable object files..."
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index d9322d0..9046a84 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -5130,6 +5130,7 @@ _LT_EOF
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
_LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+ _LT_TAGVAR(file_list_spec, $1)='@'
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -6706,6 +6707,7 @@ if test yes != "$_lt_caught_CXX_error"; then
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
_LT_TAGVAR(always_export_symbols, $1)=no
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
--
2.7.4

View File

@ -1,38 +0,0 @@
From b9f77cae8cfbe850e58cac686fcb4d246b5bfc51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Mon, 19 Aug 2019 13:34:51 +0300
Subject: [PATCH] Allow statically linking compiler support libraries when
linking a library
For cases with deplibs_check_method="file_magic ..." (as it is for mingw),
there were previously no way that a static library could be accepted
here.
---
build-aux/ltmain.in | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index e2fb2633..db4d775c 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5870,8 +5870,15 @@ func_mode_link ()
fi
case $linkmode in
lib)
- # Linking convenience modules into shared libraries is allowed,
- # but linking other static libraries is non-portable.
+ # Linking convenience modules and compiler provided static libraries
+ # into shared libraries is allowed, but linking other static
+ # libraries is non-portable.
+ case $deplib in
+ */libgcc*.$libext | */libclang_rt*.$libext)
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ esac
case " $dlpreconveniencelibs " in
*" $deplib "*) ;;
*)
--
2.17.1

View File

@ -1,39 +0,0 @@
From 03dabb6a70847761e65572a2a7b770a3b1b9f123 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= <mati865@gmail.com>
Date: Mon, 12 Apr 2021 23:44:10 +0200
Subject: [PATCH] Support llvm-objdump -f output
---
build-aux/ltmain.in | 2 +-
m4/libtool.m4 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index a9f070a..4a434cc 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -3019,7 +3019,7 @@ func_win32_libid ()
*ar\ archive*) # could be an import, or static
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
- $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|coff-arm|coff-arm64|coff-i386|coff-x86-64)' >/dev/null; then
case $nm_interface in
"MS dumpbin")
if func_cygming_ms_implib_p "$1" ||
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 21a7d60..594be9c 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3473,7 +3473,7 @@ mingw* | pw32*)
lt_cv_file_magic_cmd='func_win32_libid'
else
# Keep this pattern in sync with the one in func_win32_libid.
- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|coff-arm|coff-arm64|coff-i386|coff-x86-64)'
lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
--
2.31.1

View File

@ -23,20 +23,6 @@ stdenv.mkDerivation rec {
# https://lists.gnu.org/archive/html/autotools-announce/2022-03/msg00000.html
FILECMD = "${file}/bin/file";
patches = [
# Patches from msys2 fixing various bugs with useClang platforms
# targeting Windows. Especially https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866
./0002-cygwin-mingw-Create-UAC-manifest-files.mingw.patch
./0005-Fix-seems-to-be-moved.patch
./0006-Fix-strict-ansi-vs-posix.patch
./0007-fix-cr-for-awk-in-configure.all.patch
./0010-libtool-2.4.2-include-process-h.patch
./0011-Pick-up-clang_rt-static-archives-compiler-internal-l.patch
./0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch
./0013-Allow-statically-linking-compiler-support-libraries-.patch
./0014-Support-llvm-objdump-f-output.patch
];
# Normally we'd use autoreconfHook, but that includes libtoolize.
postPatch = ''
aclocal -I m4

View File

@ -65,7 +65,6 @@ stdenv.mkDerivation {
passthru = {
inherit targetPrefix;
isCctools = true;
};
meta = {

View File

@ -1,32 +1,14 @@
{ lib, stdenv, windows, fetchurl }:
let
version = "10.0.0";
knownArches = [ "32" "64" "arm32" "arm64" ];
enabledArch =
if stdenv.targetPlatform.isAarch32
then "arm32"
else if stdenv.targetPlatform.isAarch64
then "arm64"
else if stdenv.targetPlatform.isx86_32
then "32"
else if stdenv.targetPlatform.isx86_64
then "64"
else null;
archFlags =
if enabledArch == null
then [] # maybe autoconf will save us
else map (arch: lib.enableFeature (arch == enabledArch) "lib${arch}") knownArches;
crt = stdenv.hostPlatform.libc;
version = "9.0.0";
in stdenv.mkDerivation {
pname = "mingw-w64";
inherit version;
src = fetchurl {
url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2";
sha256 = "sha256-umtDCu1yxjo3aFMfaj/8Kw/eLFejslFFDc9ImolPCJQ=";
sha256 = "10a15bi4lyfi0k0haj0klqambicwma6yi7vssgbz8prg815vja8r";
};
outputs = [ "out" "dev" ];
@ -34,8 +16,7 @@ in stdenv.mkDerivation {
configureFlags = [
"--enable-idl"
"--enable-secure-api"
"--with-default-msvcrt=${crt}"
] ++ archFlags;
];
enableParallelBuilding = true;
@ -45,6 +26,5 @@ in stdenv.mkDerivation {
meta = {
platforms = lib.platforms.windows;
broken = !(lib.elem crt [ "msvcrt" "ucrt" ]);
};
}

View File

@ -1,8 +1,6 @@
{ stdenvNoCC, mingw_w64 }:
let
crt = stdenvNoCC.hostPlatform.libc;
in stdenvNoCC.mkDerivation {
stdenvNoCC.mkDerivation {
name = "${mingw_w64.name}-headers";
inherit (mingw_w64) src meta;
@ -10,10 +8,4 @@ in stdenvNoCC.mkDerivation {
cd mingw-w64-headers
'';
configureFlags = [
"--enable-idl"
"--enable-secure-api"
"--with-default-msvcrt=${crt}"
];
}

View File

@ -17405,7 +17405,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" || libc == "ucrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers
in if libc == "msvcrt" 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;
@ -17424,7 +17424,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" || name == "ucrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
else if name == "msvcrt" 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

View File

@ -145,6 +145,7 @@ in {
inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook;
buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_12;
llvmPackages = pkgs.llvmPackages_12;
libffi = pkgs.libffi;
};
ghcjs = compiler.ghcjs810;