-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "Revert "Add mingwW64-llvm cross-system."" #173498
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 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@") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
{ runCommand, stdenv, llvm, lld, version }: | ||
{ runCommand, stdenv, llvm, lld, version, lib }: | ||
|
||
let | ||
prefix = | ||
if stdenv.hostPlatform != stdenv.targetPlatform | ||
then "${stdenv.targetPlatform.config}-" | ||
else ""; | ||
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' | ||
in runCommand "llvm-binutils-${version}" { | ||
preferLocalBuild = true; | ||
passthru = { | ||
isLld = true; | ||
targetPrefix = prefix; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why don't the other LLVM versions have a |
||
}; | ||
} ('' | ||
mkdir -p $out/bin | ||
for prog in ${lld}/bin/*; do | ||
ln -s $prog $out/bin/${prefix}$(basename $prog) | ||
|
@@ -26,4 +32,7 @@ in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } '' | |
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 | ||
'') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this relevant to other LLVM versions as well? Note that unless you add any changes to llvmPackages 14 and llvmPackages_git, it'll likely get lost in the future. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ lib, stdenv, llvm_meta, src, cmake, python3, fixDarwinDylibNames, version | ||
, libcxxabi | ||
, libcxxabi, libunwind | ||
, 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 ]; | ||
buildInputs = lib.optionals (!headersOnly) ([ libcxxabi ] ++ lib.optional libcxxabi.useLLVMUnwinder libunwind); | ||
|
||
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ] | ||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1" | ||
|
@@ -41,7 +41,13 @@ stdenv.mkDerivation rec { | |
"-DLIBCXX_ENABLE_THREADS=OFF" | ||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF" | ||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF" | ||
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=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"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still confused about this one… |
||
|
||
buildFlags = lib.optional headersOnly "generate-cxx-headers"; | ||
installTargets = lib.optional headersOnly "install-cxx-headers"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change the other writes to
$out/nix-support/add-local-ldflags-before.sh
to append as well? I'm a bit concerned that somebody starts overwriting additions accidentally by reordering code in here.