llvmPackages: Organize files

Always do pkg/default.nix not pkg.nix; use directories to avoid
prefixing patches and other files.
This commit is contained in:
John Ericson
2021-03-24 05:02:50 +00:00
parent 9677d30d77
commit 19a974945b
93 changed files with 116 additions and 108 deletions
@@ -51,11 +51,12 @@ stdenv.mkDerivation {
outputs = [ "out" "dev" ];
patches = [
../7/compiler-rt-glibc.patch
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional (useLLVM) ./crtbegin-and-end.patch
++ lib.optional stdenv.hostPlatform.isAarch32 ./compiler-rt-armv7l.patch;
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
@@ -28,8 +28,9 @@ let
'';
in {
llvm = callPackage ./llvm.nix { };
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
llvm = callPackage ./llvm { };
llvm-polly = callPackage ./llvm { enablePolly = true; };
clang-unwrapped = callPackage ./clang {
inherit (tools) lld;
@@ -76,9 +77,9 @@ let
extraBuildCommands = mkExtraBuildCommands cc;
};
lld = callPackage ./lld.nix {};
lld = callPackage ./lld {};
lldb = callPackage ./lldb.nix {};
lldb = callPackage ./lldb {};
# Below, is the LLVM bootstrapping logic. It handles building a
# fully LLVM toolchain from scratch. No GCC toolchain should be
@@ -162,7 +163,7 @@ let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in {
compiler-rt = callPackage ./compiler-rt.nix ({} //
compiler-rt = callPackage ./compiler-rt ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
}));
@@ -176,7 +177,7 @@ let
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
}));
libcxxabi = callPackage ./libc++abi.nix ({} //
libcxxabi = callPackage ./libc++abi ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
libunwind = libraries.libunwind;
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
"-DLIBCXXABI_ENABLE_SHARED=OFF"
];
patches = [ ./libcxxabi-no-threads.patch ];
patches = [ ./no-threads.patch ];
postUnpack = ''
unpackFile ${libcxx.src}
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
patch -p1 -d $(ls -d llvm-*) -i ${./libcxxabi-wasm.patch}
patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
'';
installPhase = if stdenv.isDarwin
@@ -71,15 +71,15 @@ in stdenv.mkDerivation ({
''
# Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch
substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./outputs.patch
'' + ''
# FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \
--replace "Path.cpp" ""
rm unittests/Support/Path.cpp
'' + optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch}
patch -p1 -i ${../../TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp