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 01:40:33 +00:00
parent 9677d30d77
commit 19a974945b
93 changed files with 116 additions and 108 deletions

View File

@ -52,10 +52,10 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
patches = [ patches = [
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory ./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
./find-darwin-sdk-version.patch # don't test for macOS being >= 10.15 ./find-darwin-sdk-version.patch # don't test for macOS being >= 10.15
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch ]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.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 # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks

View File

@ -29,7 +29,7 @@ let
''; '';
in { in {
llvm = callPackage ./llvm.nix { }; llvm = callPackage ./llvm { };
clang-unwrapped = callPackage ./clang { clang-unwrapped = callPackage ./clang {
inherit (tools) lld; inherit (tools) lld;
@ -77,9 +77,9 @@ let
extraBuildCommands = mkExtraBuildCommands cc; 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 # Below, is the LLVM bootstrapping logic. It handles building a
# fully LLVM toolchain from scratch. No GCC toolchain should be # fully LLVM toolchain from scratch. No GCC toolchain should be
@ -163,7 +163,7 @@ let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; }); callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in { in {
compiler-rt = callPackage ./compiler-rt.nix ({} // compiler-rt = callPackage ./compiler-rt ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
})); }));
@ -177,7 +177,7 @@ let
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
})); }));
libcxxabi = callPackage ./libc++abi.nix ({} // libcxxabi = callPackage ./libc++abi ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
libunwind = libraries.libunwind; libunwind = libraries.libunwind;

View File

@ -21,7 +21,7 @@ stdenv.mkDerivation {
"-DLIBCXXABI_ENABLE_SHARED=OFF" "-DLIBCXXABI_ENABLE_SHARED=OFF"
]; ];
patches = [ ./libcxxabi-no-threads.patch ]; patches = [ ./no-threads.patch ];
postUnpack = '' postUnpack = ''
unpackFile ${libcxx.src} unpackFile ${libcxx.src}
@ -32,7 +32,7 @@ stdenv.mkDerivation {
'' + lib.optionalString stdenv.hostPlatform.isMusl '' '' + lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch} patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
'' + lib.optionalString stdenv.hostPlatform.isWasm '' '' + 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 installPhase = if stdenv.isDarwin

View File

@ -22,7 +22,7 @@ stdenv.mkDerivation (rec {
src = fetch pname "051p5b04y6z3g730rmc2n2v71lipbw7k69riww3a6sl74myfiaq7"; src = fetch pname "051p5b04y6z3g730rmc2n2v71lipbw7k69riww3a6sl74myfiaq7";
patches = [ ./lldb-procfs.patch ]; patches = [ ./procfs.patch ];
nativeBuildInputs = [ cmake python3 which swig lit ] nativeBuildInputs = [ cmake python3 which swig lit ]
++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ]; ++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];

View File

@ -62,15 +62,15 @@ in stdenv.mkDerivation (rec {
'' ''
# Patch llvm-config to return correct library path based on --link-{shared,static}. # Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) '' + optionalString (enableSharedLibraries) ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch patch -p1 < ./outputs.patch
'' + '' '' + ''
# FileSystem permissions tests fail with various special bits # FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "Path.cpp" "" --replace "Path.cpp" ""
rm unittests/Support/Path.cpp rm unittests/Support/Path.cpp
'' + optionalString stdenv.hostPlatform.isMusl '' '' + optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch} patch -p1 -i ${../../TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" "" --replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp

View File

@ -50,10 +50,10 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
patches = [ patches = [
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory ./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
./compiler-rt-X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config ./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch ]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.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 # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks

View File

@ -31,7 +31,7 @@ let
''; '';
in { in {
llvm = callPackage ./llvm.nix { }; llvm = callPackage ./llvm { };
clang-unwrapped = callPackage ./clang { clang-unwrapped = callPackage ./clang {
inherit (tools) lld; inherit (tools) lld;
@ -79,9 +79,9 @@ let
extraBuildCommands = mkExtraBuildCommands cc; 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 # Below, is the LLVM bootstrapping logic. It handles building a
# fully LLVM toolchain from scratch. No GCC toolchain should be # fully LLVM toolchain from scratch. No GCC toolchain should be
@ -165,7 +165,7 @@ let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; }); callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in { in {
compiler-rt = callPackage ./compiler-rt.nix ({} // compiler-rt = callPackage ./compiler-rt ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
})); }));
@ -179,7 +179,7 @@ let
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
})); }));
libcxxabi = callPackage ./libc++abi.nix ({} // libcxxabi = callPackage ./libc++abi ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
libunwind = libraries.libunwind; libunwind = libraries.libunwind;

View File

@ -21,7 +21,7 @@ stdenv.mkDerivation {
"-DLIBCXXABI_ENABLE_SHARED=OFF" "-DLIBCXXABI_ENABLE_SHARED=OFF"
]; ];
patches = [ ./libcxxabi-no-threads.patch ]; patches = [ ./no-threads.patch ];
postUnpack = '' postUnpack = ''
unpackFile ${libcxx.src} unpackFile ${libcxx.src}
@ -33,7 +33,7 @@ stdenv.mkDerivation {
'' + lib.optionalString stdenv.hostPlatform.isMusl '' '' + lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d libcxx -i ${../libcxx-0001-musl-hacks.patch} patch -p1 -d libcxx -i ${../libcxx-0001-musl-hacks.patch}
'' + lib.optionalString stdenv.hostPlatform.isWasm '' '' + lib.optionalString stdenv.hostPlatform.isWasm ''
patch -p1 -d llvm -i ${./libcxxabi-wasm.patch} patch -p1 -d llvm -i ${./wasm.patch}
''; '';
installPhase = if stdenv.isDarwin installPhase = if stdenv.isDarwin

View File

@ -22,7 +22,7 @@ stdenv.mkDerivation (rec {
src = fetch pname "1vlyg015dyng43xqb8cg2l6r9ix8klibxsajazbfnckdnh54hwxj"; src = fetch pname "1vlyg015dyng43xqb8cg2l6r9ix8klibxsajazbfnckdnh54hwxj";
patches = [ ./lldb-procfs.patch ]; patches = [ ./procfs.patch ];
nativeBuildInputs = [ cmake python3 which swig lit ] nativeBuildInputs = [ cmake python3 which swig lit ]
++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ]; ++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];

View File

@ -62,8 +62,8 @@ in stdenv.mkDerivation (rec {
'' ''
# Patch llvm-config to return correct library path based on --link-{shared,static}. # Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) '' + optionalString (enableSharedLibraries) ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch patch -p1 < ./outputs.patch
'' + '' '' + ''
# FileSystem permissions tests fail with various special bits # FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \

View File

@ -51,11 +51,12 @@ stdenv.mkDerivation {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
patches = [ patches = [
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory ./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
../7/compiler-rt-glibc.patch # https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch ] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional (stdenv.hostPlatform.libc == "glibc") ./compiler-rt-sys-ustat.patch ++ lib.optional (stdenv.hostPlatform.libc == "glibc") ./sys-ustat.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 # 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 # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra

View File

@ -28,7 +28,7 @@ let
''; '';
in { in {
llvm = callPackage ./llvm.nix { }; llvm = callPackage ./llvm { };
clang-unwrapped = callPackage ./clang { clang-unwrapped = callPackage ./clang {
inherit clang-tools-extra_src; inherit clang-tools-extra_src;
@ -68,16 +68,16 @@ let
extraBuildCommands = mkExtraBuildCommands cc; extraBuildCommands = mkExtraBuildCommands cc;
}; };
lld = callPackage ./lld.nix {}; lld = callPackage ./lld {};
lldb = callPackage ./lldb.nix {}; lldb = callPackage ./lldb {};
}); });
libraries = lib.makeExtensible (libraries: let libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; }); callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in { in {
compiler-rt = callPackage ./compiler-rt.nix {}; compiler-rt = callPackage ./compiler-rt {};
stdenv = overrideCC stdenv buildLlvmTools.clang; stdenv = overrideCC stdenv buildLlvmTools.clang;
@ -85,7 +85,7 @@ let
libcxx = callPackage ./libc++ {}; libcxx = callPackage ./libc++ {};
libcxxabi = callPackage ./libc++abi.nix {}; libcxxabi = callPackage ./libc++abi {};
openmp = callPackage ./openmp.nix {}; openmp = callPackage ./openmp.nix {};
}); });

View File

@ -16,6 +16,8 @@
}: }:
let let
inherit (lib) optional optionals optionalString;
# Used when creating a versioned symlinks of libLLVM.dylib # Used when creating a versioned symlinks of libLLVM.dylib
versionSuffixes = with lib; versionSuffixes = with lib;
let parts = splitVersion release_version; in let parts = splitVersion release_version; in
@ -35,10 +37,10 @@ stdenv.mkDerivation ({
''; '';
outputs = [ "out" "python" ] outputs = [ "out" "python" ]
++ lib.optional enableSharedLibraries "lib"; ++ optional enableSharedLibraries "lib";
nativeBuildInputs = [ cmake python3 ] nativeBuildInputs = [ cmake python3 ]
++ lib.optional enableManpages python3.pkgs.sphinx; ++ optional enableManpages python3.pkgs.sphinx;
buildInputs = [ libxml2 libffi ]; buildInputs = [ libxml2 libffi ];
@ -58,24 +60,24 @@ stdenv.mkDerivation ({
# stripLen = 1; # stripLen = 1;
#}) #})
]; ];
postPatch = lib.optionalString stdenv.isDarwin '' postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \ substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \ --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' "" --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
'' ''
# Patch llvm-config to return correct library path based on --link-{shared,static}. # Patch llvm-config to return correct library path based on --link-{shared,static}.
+ lib.optionalString (enableSharedLibraries) '' + optionalString (enableSharedLibraries) ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch patch -p1 < ./outputs.patch
'' + '' '' + ''
# FileSystem permissions tests fail with various special bits # FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "Path.cpp" "" --replace "Path.cpp" ""
rm unittests/Support/Path.cpp rm unittests/Support/Path.cpp
'' + lib.optionalString stdenv.isAarch64 '' '' + optionalString stdenv.isAarch64 ''
patch -p0 < ${../aarch64.patch} patch -p0 < ${../../aarch64.patch}
'' + lib.optionalString stdenv.hostPlatform.isMusl '' '' + optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch} patch -p1 -i ${../../TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" "" --replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
@ -98,18 +100,18 @@ stdenv.mkDerivation ({
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DTARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
] ]
++ lib.optional enableSharedLibraries ++ optional enableSharedLibraries
"-DLLVM_LINK_LLVM_DYLIB=ON" "-DLLVM_LINK_LLVM_DYLIB=ON"
++ lib.optionals enableManpages [ ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON" "-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON" "-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ]
++ lib.optional (!isDarwin) ++ optional (!isDarwin)
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include" "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
++ lib.optionals (isDarwin) [ ++ optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON" "-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false" "-DCAN_TARGET_i386=false"
]; ];
@ -126,14 +128,14 @@ stdenv.mkDerivation ({
mkdir -p $python/share mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer mv $out/share/opt-viewer $python/share/opt-viewer
'' ''
+ lib.optionalString enableSharedLibraries '' + optionalString enableSharedLibraries ''
moveToOutput "lib/libLLVM-*" "$lib" moveToOutput "lib/libLLVM-*" "$lib"
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib" moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
moveToOutput "lib/libLTO${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib" moveToOutput "lib/libLTO${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-" --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
'' ''
+ lib.optionalString (stdenv.isDarwin && enableSharedLibraries) '' + optionalString (stdenv.isDarwin && enableSharedLibraries) ''
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \ substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" \ --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" \
--replace "\''${_IMPORT_PREFIX}/lib/libLTO.dylib" "$lib/lib/libLTO.dylib" --replace "\''${_IMPORT_PREFIX}/lib/libLTO.dylib" "$lib/lib/libLTO.dylib"

View File

@ -51,10 +51,11 @@ stdenv.mkDerivation {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
patches = [ patches = [
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory ./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
../7/compiler-rt-glibc.patch # https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch ] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.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 # 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 # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra

View File

@ -28,7 +28,7 @@ let
''; '';
in { in {
llvm = callPackage ./llvm.nix { }; llvm = callPackage ./llvm { };
clang-unwrapped = callPackage ./clang { clang-unwrapped = callPackage ./clang {
inherit clang-tools-extra_src; inherit clang-tools-extra_src;
@ -68,16 +68,16 @@ let
extraBuildCommands = mkExtraBuildCommands cc; extraBuildCommands = mkExtraBuildCommands cc;
}; };
lld = callPackage ./lld.nix {}; lld = callPackage ./lld {};
lldb = callPackage ./lldb.nix {}; lldb = callPackage ./lldb {};
}); });
libraries = lib.makeExtensible (libraries: let libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; }); callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in { in {
compiler-rt = callPackage ./compiler-rt.nix {}; compiler-rt = callPackage ./compiler-rt {};
stdenv = overrideCC stdenv buildLlvmTools.clang; stdenv = overrideCC stdenv buildLlvmTools.clang;
@ -85,7 +85,7 @@ let
libcxx = callPackage ./libc++ {}; libcxx = callPackage ./libc++ {};
libcxxabi = callPackage ./libc++abi.nix {}; libcxxabi = callPackage ./libc++abi {};
openmp = callPackage ./openmp.nix {}; openmp = callPackage ./openmp.nix {};
}); });

View File

@ -67,15 +67,15 @@ stdenv.mkDerivation ({
'' ''
# Patch llvm-config to return correct library path based on --link-{shared,static}. # Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) '' + optionalString (enableSharedLibraries) ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch patch -p1 < ./outputs.patch
'' + '' '' + ''
# FileSystem permissions tests fail with various special bits # FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "Path.cpp" "" --replace "Path.cpp" ""
rm unittests/Support/Path.cpp rm unittests/Support/Path.cpp
'' + optionalString stdenv.hostPlatform.isMusl '' '' + optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch} patch -p1 -i ${../../TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" "" --replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp

View File

@ -52,12 +52,11 @@ stdenv.mkDerivation {
patches = [ patches = [
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce # https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
./compiler-rt-glibc.patch ../../common/compiler-rt/glibc.patch
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
] ++ lib.optional (useLLVM) ./crtbegin-and-end.patch ] ++ lib.optional (useLLVM) ./crtbegin-and-end.patch
++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.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 # 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 # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra

View File

@ -28,8 +28,9 @@ let
''; '';
in { in {
llvm = callPackage ./llvm.nix { }; llvm = callPackage ./llvm { };
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
llvm-polly = callPackage ./llvm { enablePolly = true; };
clang-unwrapped = callPackage ./clang { clang-unwrapped = callPackage ./clang {
inherit (tools) lld; inherit (tools) lld;
@ -75,9 +76,9 @@ let
extraBuildCommands = mkExtraBuildCommands cc; 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 # Below, is the LLVM bootstrapping logic. It handles building a
# fully LLVM toolchain from scratch. No GCC toolchain should be # fully LLVM toolchain from scratch. No GCC toolchain should be
@ -159,7 +160,7 @@ let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; }); callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in { in {
compiler-rt = callPackage ./compiler-rt.nix { compiler-rt = callPackage ./compiler-rt {
stdenv = if stdenv.hostPlatform.useLLVM or false stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
else stdenv; else stdenv;
@ -174,7 +175,7 @@ let
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
})); }));
libcxxabi = callPackage ./libc++abi.nix ({} // libcxxabi = callPackage ./libc++abi ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
libunwind = libraries.libunwind; libunwind = libraries.libunwind;

View File

@ -76,15 +76,15 @@ in stdenv.mkDerivation ({
'' ''
# Patch llvm-config to return correct library path based on --link-{shared,static}. # Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) '' + optionalString (enableSharedLibraries) ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch patch -p1 < ./outputs.patch
'' + '' '' + ''
# FileSystem permissions tests fail with various special bits # FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "Path.cpp" "" --replace "Path.cpp" ""
rm unittests/Support/Path.cpp rm unittests/Support/Path.cpp
'' + optionalString stdenv.hostPlatform.isMusl '' '' + optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch} patch -p1 -i ${../../TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" "" --replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp

View File

@ -51,11 +51,12 @@ stdenv.mkDerivation {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
patches = [ patches = [
../7/compiler-rt-glibc.patch # https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory ../../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 stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
++ lib.optional (useLLVM) ./crtbegin-and-end.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 # 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 # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra

View File

@ -28,8 +28,9 @@ let
''; '';
in { in {
llvm = callPackage ./llvm.nix { }; llvm = callPackage ./llvm { };
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
llvm-polly = callPackage ./llvm { enablePolly = true; };
clang-unwrapped = callPackage ./clang { clang-unwrapped = callPackage ./clang {
inherit (tools) lld; inherit (tools) lld;
@ -76,9 +77,9 @@ let
extraBuildCommands = mkExtraBuildCommands cc; 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 # Below, is the LLVM bootstrapping logic. It handles building a
# fully LLVM toolchain from scratch. No GCC toolchain should be # 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; }); callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in { in {
compiler-rt = callPackage ./compiler-rt.nix ({} // compiler-rt = callPackage ./compiler-rt ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
})); }));
@ -176,7 +177,7 @@ let
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
})); }));
libcxxabi = callPackage ./libc++abi.nix ({} // libcxxabi = callPackage ./libc++abi ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
libunwind = libraries.libunwind; libunwind = libraries.libunwind;

View File

@ -21,7 +21,7 @@ stdenv.mkDerivation {
"-DLIBCXXABI_ENABLE_SHARED=OFF" "-DLIBCXXABI_ENABLE_SHARED=OFF"
]; ];
patches = [ ./libcxxabi-no-threads.patch ]; patches = [ ./no-threads.patch ];
postUnpack = '' postUnpack = ''
unpackFile ${libcxx.src} unpackFile ${libcxx.src}
@ -32,7 +32,7 @@ stdenv.mkDerivation {
'' + lib.optionalString stdenv.hostPlatform.isMusl '' '' + lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch} patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
'' + lib.optionalString stdenv.hostPlatform.isWasm '' '' + 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 installPhase = if stdenv.isDarwin

View File

@ -71,15 +71,15 @@ in stdenv.mkDerivation ({
'' ''
# Patch llvm-config to return correct library path based on --link-{shared,static}. # Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) '' + optionalString (enableSharedLibraries) ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch patch -p1 < ./outputs.patch
'' + '' '' + ''
# FileSystem permissions tests fail with various special bits # FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "Path.cpp" "" --replace "Path.cpp" ""
rm unittests/Support/Path.cpp rm unittests/Support/Path.cpp
'' + optionalString stdenv.hostPlatform.isMusl '' '' + optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch} patch -p1 -i ${../../TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" "" --replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp

View File

@ -51,10 +51,11 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
patches = [ patches = [
../7/compiler-rt-glibc.patch # https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory ../../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 stdenv.hostPlatform.isMusl ./sanitizers-nongnu.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 # 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 # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra

View File

@ -28,8 +28,9 @@ let
''; '';
in { in {
llvm = callPackage ./llvm.nix { }; llvm = callPackage ./llvm { };
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
llvm-polly = callPackage ./llvm { enablePolly = true; };
clang-unwrapped = callPackage ./clang { clang-unwrapped = callPackage ./clang {
inherit (tools) lld; inherit (tools) lld;
@ -76,9 +77,9 @@ let
extraBuildCommands = mkExtraBuildCommands cc; 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 # Below, is the LLVM bootstrapping logic. It handles building a
# fully LLVM toolchain from scratch. No GCC toolchain should be # 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; }); callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in { in {
compiler-rt = callPackage ./compiler-rt.nix ({} // compiler-rt = callPackage ./compiler-rt ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
})); }));
@ -176,7 +177,7 @@ let
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
})); }));
libcxxabi = callPackage ./libc++abi.nix ({} // libcxxabi = callPackage ./libc++abi ({} //
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx; stdenv = overrideCC stdenv buildLlvmTools.lldClangNoLibcxx;
libunwind = libraries.libunwind; libunwind = libraries.libunwind;

View File

@ -21,7 +21,7 @@ stdenv.mkDerivation {
"-DLIBCXXABI_ENABLE_SHARED=OFF" "-DLIBCXXABI_ENABLE_SHARED=OFF"
]; ];
patches = [ ./libcxxabi-no-threads.patch ]; patches = [ ./no-threads.patch ];
postUnpack = '' postUnpack = ''
unpackFile ${libcxx.src} unpackFile ${libcxx.src}
@ -32,7 +32,7 @@ stdenv.mkDerivation {
'' + lib.optionalString stdenv.hostPlatform.isMusl '' '' + lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch} patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
'' + lib.optionalString stdenv.hostPlatform.isWasm '' '' + 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 installPhase = if stdenv.isDarwin

View File

@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
src = fetch pname "02gb3fbz09kyw8n71218v5v77ip559x3gqbcp8y3w6n3jpbryywa"; src = fetch pname "02gb3fbz09kyw8n71218v5v77ip559x3gqbcp8y3w6n3jpbryywa";
patches = [ ./lldb-procfs.patch ]; patches = [ ./procfs.patch ];
nativeBuildInputs = [ cmake python3 which swig lit ]; nativeBuildInputs = [ cmake python3 which swig lit ];
buildInputs = [ buildInputs = [

View File

@ -62,15 +62,15 @@ in stdenv.mkDerivation (rec {
'' ''
# Patch llvm-config to return correct library path based on --link-{shared,static}. # Patch llvm-config to return correct library path based on --link-{shared,static}.
+ optionalString (enableSharedLibraries) '' + optionalString (enableSharedLibraries) ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch patch -p1 < ./outputs.patch
'' + '' '' + ''
# FileSystem permissions tests fail with various special bits # FileSystem permissions tests fail with various special bits
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "Path.cpp" "" --replace "Path.cpp" ""
rm unittests/Support/Path.cpp rm unittests/Support/Path.cpp
'' + optionalString stdenv.hostPlatform.isMusl '' '' + optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -i ${../TLI-musl.patch} patch -p1 -i ${../../TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \ substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" "" --replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp

View File

@ -28,12 +28,12 @@ in rec {
src = "${src}/clang"; src = "${src}/clang";
}; };
lld = callPackage ./lld.nix { lld = callPackage ./lld {
inherit llvm version; inherit llvm version;
src = "${src}/lld"; src = "${src}/lld";
}; };
llvm = callPackage ./llvm.nix { llvm = callPackage ./llvm {
inherit version; inherit version;
src = "${src}/llvm"; src = "${src}/llvm";
}; };

View File

@ -57,8 +57,8 @@ in stdenv.mkDerivation rec {
]; ];
postPatch = '' postPatch = ''
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch patch -p1 < ./outputs.patch
''; '';
# hacky fix: created binaries need to be run before installation # hacky fix: created binaries need to be run before installation