llvmPackages_9: remove due to age

This commit is contained in:
Tristan Ross 2024-04-08 21:43:21 -07:00
parent 886dd8d2fa
commit b1ef46706f
No known key found for this signature in database
GPG Key ID: B09C422035669AF8
33 changed files with 21 additions and 2834 deletions

View File

@ -3,7 +3,7 @@
, cling
, fetchurl
, lib
, llvmPackages_9
, llvmPackages_13
, makeWrapper
, runCommand
, stdenv

View File

@ -5,7 +5,7 @@
, fetchFromGitHub
, gcc
, git
, llvmPackages_9
, llvmPackages_13
# Libraries
, argparse
, cling
@ -60,7 +60,7 @@ clangStdenv.mkDerivation rec {
cling.unwrapped
cppzmq
libuuid
llvmPackages_9.llvm
llvmPackages_13.llvm
ncurses
openssl
pugixml
@ -75,6 +75,15 @@ clangStdenv.mkDerivation rec {
"-DCMAKE_BUILD_TYPE=Debug"
];
postPatch = ''
substituteInPlace src/xmagics/executable.cpp \
--replace "getDataLayout" "getDataLayoutString"
substituteInPlace src/xmagics/execution.cpp \
--replace "simplisticCastAs" "castAs"
substituteInPlace src/xmime_internal.hpp \
--replace "code.str()" "code.str().str()"
'';
dontStrip = debug;
meta = {

View File

@ -562,11 +562,6 @@ stdenv.mkDerivation {
echo "-isystem ${getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
''
# can remove once LLVM9 and LLVM11 are dropped from nixpkgs
+ optionalString (libcxx.isLLVM or false && lib.versionOlder (lib.getVersion libcxx) "12" && libcxx ? cxxabi.libName) ''
echo "-isystem ${lib.getDev libcxx.cxxabi}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
echo "-l${libcxx.cxxabi.libName}" >> $out/nix-support/libcxx-ldflags
''
##
## Initial CFLAGS

View File

@ -1,80 +0,0 @@
From 7147e9774c74abcd1d6db24e24d0fd989c2b97dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Holger=20W=C3=BCnsche?= <holger.o.wuensche@t-online.de>
Date: Tue, 21 Jan 2020 19:52:04 +0100
Subject: [PATCH] [HIP] use GetProgramPath for executable discovery
This change replaces the manual building of executable paths
using llvm::sys::path::append with GetProgramPath.
This enables adding other paths in case executables reside
in different directories and makes the code easier to read.
Differential Revision: https://reviews.llvm.org/D72903
---
clang/lib/Driver/ToolChains/HIP.cpp | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/lib/Driver/ToolChains/HIP.cpp b/lib/Driver/ToolChains/HIP.cpp
index 2ec97e798fd..735c302debb 100644
--- a/lib/Driver/ToolChains/HIP.cpp
+++ b/lib/Driver/ToolChains/HIP.cpp
@@ -66,9 +66,8 @@ const char *AMDGCN::Linker::constructLLVMLinkCommand(
const char *OutputFileName =
C.addTempFile(C.getArgs().MakeArgString(TmpName));
CmdArgs.push_back(OutputFileName);
- SmallString<128> ExecPath(C.getDriver().Dir);
- llvm::sys::path::append(ExecPath, "llvm-link");
- const char *Exec = Args.MakeArgString(ExecPath);
+ const char *Exec =
+ Args.MakeArgString(getToolChain().GetProgramPath("llvm-link"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
return OutputFileName;
}
@@ -114,9 +113,8 @@ const char *AMDGCN::Linker::constructOptCommand(
const char *OutputFileName =
C.addTempFile(C.getArgs().MakeArgString(TmpFileName));
OptArgs.push_back(OutputFileName);
- SmallString<128> OptPath(C.getDriver().Dir);
- llvm::sys::path::append(OptPath, "opt");
- const char *OptExec = Args.MakeArgString(OptPath);
+ const char *OptExec =
+ Args.MakeArgString(getToolChain().GetProgramPath("opt"));
C.addCommand(llvm::make_unique<Command>(JA, *this, OptExec, OptArgs, Inputs));
return OutputFileName;
}
@@ -156,9 +154,7 @@ const char *AMDGCN::Linker::constructLlcCommand(
const char *LlcOutputFile =
C.addTempFile(C.getArgs().MakeArgString(LlcOutputFileName));
LlcArgs.push_back(LlcOutputFile);
- SmallString<128> LlcPath(C.getDriver().Dir);
- llvm::sys::path::append(LlcPath, "llc");
- const char *Llc = Args.MakeArgString(LlcPath);
+ const char *Llc = Args.MakeArgString(getToolChain().GetProgramPath("llc"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Llc, LlcArgs, Inputs));
return LlcOutputFile;
}
@@ -172,9 +168,7 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
// The output from ld.lld is an HSA code object file.
ArgStringList LldArgs{
"-flavor", "gnu", "-shared", "-o", Output.getFilename(), InputFileName};
- SmallString<128> LldPath(C.getDriver().Dir);
- llvm::sys::path::append(LldPath, "lld");
- const char *Lld = Args.MakeArgString(LldPath);
+ const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
C.addCommand(llvm::make_unique<Command>(JA, *this, Lld, LldArgs, Inputs));
}
@@ -206,9 +200,8 @@ void AMDGCN::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
Args.MakeArgString(std::string("-outputs=").append(OutputFileName));
BundlerArgs.push_back(BundlerOutputArg);
- SmallString<128> BundlerPath(C.getDriver().Dir);
- llvm::sys::path::append(BundlerPath, "clang-offload-bundler");
- const char *Bundler = Args.MakeArgString(BundlerPath);
+ const char *Bundler = Args.MakeArgString(
+ T.getToolChain().GetProgramPath("clang-offload-bundler"));
C.addCommand(llvm::make_unique<Command>(JA, T, Bundler, BundlerArgs, Inputs));
}
--
2.23.1

View File

@ -1,53 +0,0 @@
Index: lib/Driver/ToolChains/BareMetal.cpp
===================================================================
--- a/lib/Driver/ToolChains/BareMetal.cpp
+++ b/lib/Driver/ToolChains/BareMetal.cpp
@@ -157,7 +157,7 @@
void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
ArgStringList &CmdArgs) const {
CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
- getTriple().getArchName() + ".a"));
+ getTriple().getArchName()));
}
void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
Index: test/Driver/baremetal.cpp
===================================================================
--- a/test/Driver/baremetal.cpp
+++ b/test/Driver/baremetal.cpp
@@ -13,7 +13,7 @@
// CHECK-V6M-C-NEXT: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
// CHECK-V6M-C-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
// CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
-// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-C-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
// CHECK-V6M-C-SAME: "-o" "{{.*}}.o"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -35,7 +35,7 @@
// CHECK-V6M-DEFAULTCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
// CHECK-V6M-DEFAULTCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
// CHECK-V6M-DEFAULTCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-DEFAULTCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
// CHECK-V6M-DEFAULTCXX-SAME: "-o" "{{.*}}.o"
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -48,7 +48,7 @@
// CHECK-V6M-LIBCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
// CHECK-V6M-LIBCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
// CHECK-V6M-LIBCXX-SAME: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
// CHECK-V6M-LIBCXX-SAME: "-o" "{{.*}}.o"
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -61,7 +61,7 @@
// CHECK-V6M-LIBSTDCXX: "{{[^"]*}}ld{{(\.(lld|bfd|gold))?}}{{(\.exe)?}}" "{{.*}}.o" "-Bstatic"
// CHECK-V6M-LIBSTDCXX-SAME: "-L{{[^"]*}}{{[/\\]+}}lib{{(64)?}}{{[/\\]+}}clang{{[/\\]+}}{{.*}}{{[/\\]+}}lib{{[/\\]+}}baremetal"
// CHECK-V6M-LIBSTDCXX-SAME: "-lstdc++" "-lsupc++" "-lunwind"
-// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m.a"
+// CHECK-V6M-LIBSTDCXX-SAME: "-lc" "-lm" "-lclang_rt.builtins-armv6m"
// CHECK-V6M-LIBSTDCXX-SAME: "-o" "{{.*}}.o"
// RUN: %clangxx -no-canonical-prefixes %s -### -o %t.o 2>&1 \

View File

@ -1,140 +0,0 @@
{ lib, stdenv, llvm_meta, fetch, substituteAll, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
, buildLlvmTools
, fixDarwinDylibNames
, enableManpages ? false
, enablePolly ? false # TODO: get this info from llvm (passthru?)
}:
let
self = stdenv.mkDerivation ({
pname = "clang";
inherit version;
src = fetch "clang" "0ls2h3iv4finqyflyhry21qhc9cm9ga7g1zq21020p065qmm2y2p";
unpackPhase = ''
unpackFile $src
mv clang-${version}* clang
sourceRoot=$PWD/clang
unpackFile ${clang-tools-extra_src}
mv clang-tools-extra-* $sourceRoot/tools/extra
'';
nativeBuildInputs = [ cmake python3 ]
++ lib.optional enableManpages python3.pkgs.sphinx
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ libxml2 libllvm ];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
"-DCLANGD_BUILD_XPC=OFF"
"-DLLVM_ENABLE_RTTI=ON"
] ++ lib.optionals enableManpages [
"-DCLANG_INCLUDE_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
"-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
] ++ lib.optionals enablePolly [
"-DWITH_POLLY=ON"
"-DLINK_POLLY_INTO_TOOLS=ON"
];
patches = [
./purity.patch
# https://reviews.llvm.org/D51899
./compiler-rt-baremetal.patch
# make clang -xhip use $PATH to find executables
./HIP-use-PATH-9.patch
./gnu-install-dirs.patch
(substituteAll {
src = ../../common/clang/clang-6-10-LLVMgold-path.patch;
libllvmLibdir = "${libllvm.lib}/lib";
})
];
postPatch = ''
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
-e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
lib/Driver/ToolChains/*.cpp
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace tools/extra/clangd/CMakeLists.txt \
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
'';
outputs = [ "out" "lib" "dev" "python" ];
postInstall = ''
ln -sv $out/bin/clang $out/bin/cpp
# Move libclang to 'lib' output
moveToOutput "lib/libclang.*" "$lib"
moveToOutput "lib/libclang-cpp.*" "$lib"
substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
--replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." \
--replace "\''${_IMPORT_PREFIX}/lib/libclang-cpp." "$lib/lib/libclang-cpp."
mkdir -p $python/bin $python/share/{clang,scan-view}
mv $out/bin/{git-clang-format,scan-view} $python/bin
if [ -e $out/bin/set-xcode-analyzer ]; then
mv $out/bin/set-xcode-analyzer $python/bin
fi
mv $out/share/clang/*.py $python/share/clang
mv $out/share/scan-view/*.py $python/share/scan-view
rm $out/bin/c-index-test
patchShebangs $python/bin
mkdir -p $dev/bin
cp bin/clang-tblgen $dev/bin
'';
passthru = {
inherit libllvm;
isClang = true;
hardeningUnsupportedFlags = [ "fortify3" "zerocallusedregs" ];
};
meta = llvm_meta // {
homepage = "https://clang.llvm.org/";
description = "A C language family frontend for LLVM";
longDescription = ''
The Clang project provides a language front-end and tooling
infrastructure for languages in the C language family (C, C++, Objective
C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project.
It aims to deliver amazingly fast compiles, extremely useful error and
warning messages and to provide a platform for building great source
level tools. The Clang Static Analyzer and clang-tidy are tools that
automatically find bugs in your code, and are great examples of the sort
of tools that can be built using the Clang frontend as a library to
parse C/C++ code.
'';
mainProgram = "clang";
};
} // lib.optionalAttrs enableManpages {
pname = "clang-manpages";
buildPhase = ''
make docs-clang-man
'';
installPhase = ''
mkdir -p $out/share/man/man1
# Manually install clang manpage
cp docs/man/*.1 $out/share/man/man1/
'';
outputs = [ "out" ];
doCheck = false;
meta = llvm_meta // {
description = "man page for Clang ${version}";
};
});
in self

View File

@ -1,278 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 60937aa9db38..45522ff32998 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,8 @@ endif()
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
project(Clang)
+ include(GNUInstallDirs)
+
# Rely on llvm-config.
set(CONFIG_OUTPUT)
if(LLVM_CONFIG)
@@ -413,7 +415,7 @@ include_directories(BEFORE
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/clang include/clang-c
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT clang-headers
FILES_MATCHING
PATTERN "*.def"
@@ -423,7 +425,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT clang-headers
FILES_MATCHING
PATTERN "CMakeFiles" EXCLUDE
@@ -442,7 +444,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
endif()
install(PROGRAMS utils/bash-autocomplete.sh
- DESTINATION share/clang
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
)
endif()
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
index cbd618e18afb..63ba43f18e64 100644
--- a/cmake/modules/AddClang.cmake
+++ b/cmake/modules/AddClang.cmake
@@ -109,9 +109,9 @@ macro(add_clang_library name)
install(TARGETS ${name}
COMPONENT ${name}
${export_to_clangtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- RUNTIME DESTINATION bin)
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
@@ -155,7 +155,7 @@ macro(add_clang_tool name)
install(TARGETS ${name}
${export_to_clangtargets}
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT ${name})
if(NOT LLVM_ENABLE_IDE)
@@ -170,7 +170,7 @@ endmacro()
macro(add_clang_symlink name dest)
add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
# Always generate install targets
- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
+ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
endmacro()
function(clang_target_link_libraries target type)
diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
index a3c0b08fa364..aa4215c0999c 100644
--- a/lib/Headers/CMakeLists.txt
+++ b/lib/Headers/CMakeLists.txt
@@ -185,7 +185,7 @@ set_target_properties(clang-resource-headers PROPERTIES
FOLDER "Misc"
RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
install(
FILES ${files} ${generated_files}
diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
index ceef4b08637c..8efad5520ca4 100644
--- a/tools/c-index-test/CMakeLists.txt
+++ b/tools/c-index-test/CMakeLists.txt
@@ -54,7 +54,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH
"@executable_path/../../lib")
else()
- set(INSTALL_DESTINATION bin)
+ set(INSTALL_DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
install(TARGETS c-index-test
diff --git a/tools/clang-check/CMakeLists.txt b/tools/clang-check/CMakeLists.txt
index 4576d78bcfb4..7c3b302d8d59 100644
--- a/tools/clang-check/CMakeLists.txt
+++ b/tools/clang-check/CMakeLists.txt
@@ -21,4 +21,4 @@ clang_target_link_libraries(clang-check
)
install(TARGETS clang-check
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/tools/clang-extdef-mapping/CMakeLists.txt b/tools/clang-extdef-mapping/CMakeLists.txt
index 4798bdb71ad0..02d07b9982ac 100644
--- a/tools/clang-extdef-mapping/CMakeLists.txt
+++ b/tools/clang-extdef-mapping/CMakeLists.txt
@@ -18,4 +18,4 @@ clang_target_link_libraries(clang-extdef-mapping
)
install(TARGETS clang-extdef-mapping
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
index 35ecdb11253c..d77d75de0094 100644
--- a/tools/clang-format/CMakeLists.txt
+++ b/tools/clang-format/CMakeLists.txt
@@ -21,20 +21,20 @@ if( LLVM_LIB_FUZZING_ENGINE OR LLVM_USE_SANITIZE_COVERAGE )
endif()
install(PROGRAMS clang-format-bbedit.applescript
- DESTINATION share/clang
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
COMPONENT clang-format)
install(PROGRAMS clang-format-diff.py
- DESTINATION share/clang
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
COMPONENT clang-format)
install(PROGRAMS clang-format-sublime.py
- DESTINATION share/clang
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
COMPONENT clang-format)
install(PROGRAMS clang-format.el
- DESTINATION share/clang
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
COMPONENT clang-format)
install(PROGRAMS clang-format.py
- DESTINATION share/clang
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
COMPONENT clang-format)
install(PROGRAMS git-clang-format
- DESTINATION bin
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT clang-format)
diff --git a/tools/clang-offload-bundler/CMakeLists.txt b/tools/clang-offload-bundler/CMakeLists.txt
index 465bef040a6c..729369ed9429 100644
--- a/tools/clang-offload-bundler/CMakeLists.txt
+++ b/tools/clang-offload-bundler/CMakeLists.txt
@@ -22,4 +22,4 @@ clang_target_link_libraries(clang-offload-bundler
${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
)
-install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
+install(TARGETS clang-offload-bundler RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
index cda8e29ec5b1..0134d8ccd70b 100644
--- a/tools/clang-rename/CMakeLists.txt
+++ b/tools/clang-rename/CMakeLists.txt
@@ -19,8 +19,8 @@ clang_target_link_libraries(clang-rename
)
install(PROGRAMS clang-rename.py
- DESTINATION share/clang
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
COMPONENT clang-rename)
install(PROGRAMS clang-rename.el
- DESTINATION share/clang
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
COMPONENT clang-rename)
diff --git a/tools/diagtool/CMakeLists.txt b/tools/diagtool/CMakeLists.txt
index a95444be40ee..136d96d9bf5b 100644
--- a/tools/diagtool/CMakeLists.txt
+++ b/tools/diagtool/CMakeLists.txt
@@ -21,7 +21,7 @@ clang_target_link_libraries(diagtool
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(TARGETS diagtool
COMPONENT diagtool
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-diagtool
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index 613ead1a36b6..e5c7bf27f739 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -137,7 +137,7 @@ endif()
if(INTERNAL_INSTALL_PREFIX)
set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include")
else()
- set(LIBCLANG_HEADERS_INSTALL_DESTINATION include)
+ set(LIBCLANG_HEADERS_INSTALL_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
install(DIRECTORY ../../include/clang-c
@@ -168,7 +168,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
COMPONENT
libclang-python-bindings
DESTINATION
- "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
endforeach()
if(NOT LLVM_ENABLE_IDE)
add_custom_target(libclang-python-bindings)
diff --git a/tools/scan-build/CMakeLists.txt b/tools/scan-build/CMakeLists.txt
index 380379300b09..adfd58ed5f7d 100644
--- a/tools/scan-build/CMakeLists.txt
+++ b/tools/scan-build/CMakeLists.txt
@@ -41,7 +41,7 @@ if(CLANG_INSTALL_SCANBUILD)
${CMAKE_BINARY_DIR}/bin/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
- install(PROGRAMS bin/${BinFile} DESTINATION bin)
+ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
endforeach()
foreach(LibexecFile ${LibexecFiles})
@@ -53,7 +53,7 @@ if(CLANG_INSTALL_SCANBUILD)
${CMAKE_BINARY_DIR}/libexec/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
- install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
+ install(PROGRAMS libexec/${LibexecFile} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
endforeach()
foreach(ManPage ${ManPages})
@@ -77,7 +77,7 @@ if(CLANG_INSTALL_SCANBUILD)
${CMAKE_BINARY_DIR}/share/scan-build/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
- install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
+ install(FILES share/scan-build/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build)
endforeach()
add_custom_target(scan-build ALL DEPENDS ${Depends})
diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
index b305ca562a72..554bcb379061 100644
--- a/tools/scan-view/CMakeLists.txt
+++ b/tools/scan-view/CMakeLists.txt
@@ -21,7 +21,7 @@ if(CLANG_INSTALL_SCANVIEW)
${CMAKE_BINARY_DIR}/bin/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
- install(PROGRAMS bin/${BinFile} DESTINATION bin)
+ install(PROGRAMS bin/${BinFile} DESTINATION ${CMAKE_INSTALL_BINDIR})
endforeach()
foreach(ShareFile ${ShareFiles})
@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
${CMAKE_BINARY_DIR}/share/scan-view/
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile})
- install(FILES share/${ShareFile} DESTINATION share/scan-view)
+ install(FILES share/${ShareFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view)
endforeach()
add_custom_target(scan-view ALL DEPENDS ${Depends})
diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
index 5573009d343a..24b3a90f233f 100644
--- a/utils/hmaptool/CMakeLists.txt
+++ b/utils/hmaptool/CMakeLists.txt
@@ -9,7 +9,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CLANG_HMAPTOOL})
list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
-install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION bin)
+install(PROGRAMS ${CLANG_HMAPTOOL} DESTINATION ${CMAKE_INSTALL_BINDIR})
add_custom_target(hmaptool ALL DEPENDS ${Depends})
set_target_properties(hmaptool PROPERTIES FOLDER "Utils")

View File

@ -1,30 +0,0 @@
From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Thu, 18 May 2017 11:56:12 -0500
Subject: [PATCH] "purity" patch for 5.0
---
lib/Driver/ToolChains/Gnu.cpp | 7 -------
1 file changed, 7 deletions(-)
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index fe3c0191bb..c6a482bece 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (!IsStatic) {
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
-
- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
- const std::string Loader =
- D.DyldPrefix + ToolChain.getDynamicLinker(Args);
- CmdArgs.push_back("-dynamic-linker");
- CmdArgs.push_back(Args.MakeArgString(Loader));
- }
}
CmdArgs.push_back("-o");
--
2.11.0

View File

@ -1,38 +0,0 @@
diff -ur compiler-rt-7.1.0.src/cmake/builtin-config-ix.cmake compiler-rt-7.1.0.src-patched/cmake/builtin-config-ix.cmake
--- compiler-rt-7.1.0.src/cmake/builtin-config-ix.cmake 2018-05-25 06:36:27.000000000 +0900
+++ compiler-rt-7.1.0.src-patched/cmake/builtin-config-ix.cmake 2020-05-09 20:26:33.030608692 +0900
@@ -24,7 +24,7 @@
set(ARM64 aarch64)
-set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k)
+set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l)
set(HEXAGON hexagon)
set(X86 i386)
set(X86_64 x86_64)
diff -ur compiler-rt-7.1.0.src/lib/builtins/CMakeLists.txt compiler-rt-7.1.0.src-patched/lib/builtins/CMakeLists.txt
--- compiler-rt-7.1.0.src/lib/builtins/CMakeLists.txt 2018-07-31 03:18:59.000000000 +0900
+++ compiler-rt-7.1.0.src-patched/lib/builtins/CMakeLists.txt 2020-05-09 20:27:38.893409318 +0900
@@ -453,6 +453,7 @@
set(armv7_SOURCES ${arm_SOURCES})
set(armv7s_SOURCES ${arm_SOURCES})
set(armv7k_SOURCES ${arm_SOURCES})
+set(armv7l_SOURCES ${arm_SOURCES})
set(arm64_SOURCES ${aarch64_SOURCES})
# macho_embedded archs
@@ -563,12 +564,12 @@
set(_arch ${arch})
if("${arch}" STREQUAL "armv6m")
set(_arch "arm|armv6m")
- elseif("${arch}" MATCHES "^(armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
+ elseif("${arch}" MATCHES "^(armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em)$")
set(_arch "arm")
endif()
# For ARM archs, exclude any VFP builtins if VFP is not supported
- if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
+ if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em)$")
string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
if(NOT COMPILER_RT_HAS_${arch}_VFP)

View File

@ -1,123 +0,0 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:
let
useLLVM = stdenv.hostPlatform.useLLVM or false;
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
haveLibc = stdenv.cc.libc != null;
inherit (stdenv.hostPlatform) isMusl;
in
stdenv.mkDerivation {
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
inherit version;
src = fetch "compiler-rt" "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2";
nativeBuildInputs = [ cmake python3 libllvm.dev ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
env.NIX_CFLAGS_COMPILE = toString [
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
];
cmakeFlags = [
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
"-DCOMPILER_RT_BUILD_XRAY=OFF"
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
] ++ lib.optionals (useLLVM || bareMetal) [
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
] ++ lib.optionals (useLLVM) [
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
] ++ lib.optionals (bareMetal) [
"-DCOMPILER_RT_OS_DIR=baremetal"
] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
# The compiler-rt build infrastructure sniffs supported platforms on Darwin
# and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails
# when it tries to use libc++ and libc++api for i386.
"-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
];
outputs = [ "out" "dev" ];
patches = [
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
../../common/compiler-rt/glibc.patch
../../common/compiler-rt/7-12-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
./gnu-install-dirs.patch
../../common/compiler-rt/libsanitizer-no-cyclades-9.patch
# Fix build on armv6l
../../common/compiler-rt/armv6-mcr-dmb.patch
../../common/compiler-rt/armv6-sync-ops-no-thumb.patch
../../common/compiler-rt/armv6-no-ldrexd-strexd.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
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
# a flag and turn the flag off during the stdenv build.
postPatch = lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace cmake/config-ix.cmake \
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
'' + lib.optionalString (useLLVM) ''
substituteInPlace lib/builtins/int_util.c \
--replace "#include <stdlib.h>" ""
substituteInPlace lib/builtins/clear_cache.c \
--replace "#include <assert.h>" ""
substituteInPlace lib/builtins/cpu_model.c \
--replace "#include <assert.h>" ""
'';
preConfigure = lib.optionalString (useLLVM && !haveLibc) ''
cmakeFlagsArray+=(-DCMAKE_C_FLAGS="-nodefaultlibs -ffreestanding")
'';
# Hack around weird upsream RPATH bug
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
ln -s "$out/lib"/*/* "$out/lib"
'' + lib.optionalString (useLLVM) ''
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';
meta = llvm_meta // {
homepage = "https://compiler-rt.llvm.org/";
description = "Compiler runtime libraries";
longDescription = ''
The compiler-rt project provides highly tuned implementations of the
low-level code generator support routines like "__fixunsdfdi" and other
calls generated when a target doesn't have a short sequence of native
instructions to implement a core IR operation. It also provides
implementations of run-time libraries for dynamic testing tools such as
AddressSanitizer, ThreadSanitizer, MemorySanitizer, and DataFlowSanitizer.
'';
# "All of the code in the compiler-rt project is dual licensed under the MIT
# license and the UIUC License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
broken = stdenv.hostPlatform.system == "aarch64-darwin"
# compiler-rt requires a Clang stdenv on 32-bit RISC-V:
# https://reviews.llvm.org/D43106#1019077
|| (stdenv.hostPlatform.isRiscV32 && !stdenv.cc.isClang);
};
}

View File

@ -1,117 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f26ae25ada30..8ba536afdccc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@ endif()
# Check if compiler-rt is built as a standalone project.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
project(CompilerRT C CXX ASM)
+ include(GNUInstallDirs)
set(COMPILER_RT_STANDALONE_BUILD TRUE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
index f7ee932f214f..ef94a97c4be9 100644
--- a/cmake/Modules/AddCompilerRT.cmake
+++ b/cmake/Modules/AddCompilerRT.cmake
@@ -488,7 +488,7 @@ macro(add_compiler_rt_resource_file target_name file_name component)
add_custom_target(${target_name} DEPENDS ${dst_file})
# Install in Clang resource directory.
install(FILES ${file_name}
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR}
COMPONENT ${component})
add_dependencies(${component} ${target_name})
@@ -505,7 +505,7 @@ macro(add_compiler_rt_script name)
add_custom_target(${name} DEPENDS ${dst})
install(FILES ${dst}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_BINDIR})
endmacro(add_compiler_rt_script src name)
# Builds custom version of libc++ and installs it in <prefix>.
diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
index b50d55b56940..7e5729ad9c8e 100644
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -386,7 +386,7 @@ macro(darwin_add_embedded_builtin_libraries)
set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
- ${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
+ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/macho_embedded)
set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
set(CFLAGS_i386 "-march=pentium")
diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake
index 6e672b1e1818..64999709958e 100644
--- a/cmake/Modules/CompilerRTUtils.cmake
+++ b/cmake/Modules/CompilerRTUtils.cmake
@@ -371,7 +371,7 @@ endfunction()
function(get_compiler_rt_install_dir arch install_dir)
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
get_compiler_rt_target(${arch} target)
- set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/lib/${target} PARENT_SCOPE)
+ set(${install_dir} ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${target} PARENT_SCOPE)
else()
set(${install_dir} ${COMPILER_RT_LIBRARY_INSTALL_DIR} PARENT_SCOPE)
endif()
diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
index cef0e0d73d87..db33fb028287 100644
--- a/cmake/base-config-ix.cmake
+++ b/cmake/base-config-ix.cmake
@@ -55,11 +55,11 @@ if (LLVM_TREE_AVAILABLE)
else()
# Take output dir and install path from the user.
set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
- "Path where built compiler-rt libraries should be stored.")
+ "Path where built compiler-rt build artifacts should be stored.")
set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
"Path where built compiler-rt executables should be stored.")
- set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
- "Path where built compiler-rt libraries should be installed.")
+ set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
+ "Prefix where built compiler-rt artifacts should be installed, comes before CMAKE_INSTALL_PREFIX.")
option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
# Use a host compiler to compile/link tests.
@@ -87,7 +87,7 @@ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
set(COMPILER_RT_LIBRARY_OUTPUT_DIR
${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
set(COMPILER_RT_LIBRARY_INSTALL_DIR
- ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
+ ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_LIBDIR}/${COMPILER_RT_OS_DIR})
endif()
if(APPLE)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 38bd6e41a912..2092d0d08247 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -50,12 +50,12 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
install(FILES ${SANITIZER_HEADERS}
COMPONENT compiler-rt-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/sanitizer)
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/sanitizer)
# Install xray headers.
install(FILES ${XRAY_HEADERS}
COMPONENT compiler-rt-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/xray)
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/xray)
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDEs.
add_custom_target(install-compiler-rt-headers
diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
index b3ae713cf02c..52b364b900f5 100644
--- a/lib/dfsan/CMakeLists.txt
+++ b/lib/dfsan/CMakeLists.txt
@@ -54,4 +54,4 @@ add_custom_command(OUTPUT ${dfsan_abilist_filename}
DEPENDS done_abilist.txt libc_ubuntu1404_abilist.txt)
add_dependencies(dfsan dfsan_abilist)
install(FILES ${dfsan_abilist_filename}
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/share)
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_DATADIR})

View File

@ -1,273 +0,0 @@
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
, preLibcCrossHeaders
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
, buildLlvmTools # tools, but from the previous stage, for cross
, targetLlvmLibraries # libraries, but from the next stage, for cross
, targetLlvm
# This is the default binutils, but with *this* version of LLD rather
# than the default LLVM version's, if LLD is the choice. We use these for
# the `useLLVM` bootstrapping below.
, bootBintoolsNoLibc ?
if stdenv.targetPlatform.linker == "lld"
then null
else pkgs.bintoolsNoLibc
, bootBintools ?
if stdenv.targetPlatform.linker == "lld"
then null
else pkgs.bintools
}:
let
release_version = "9.0.1";
version = release_version; # differentiating these is important for rc's
fetch = name: sha256: fetchurl {
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
inherit sha256;
};
clang-tools-extra_src = fetch "clang-tools-extra" "01vgzd4k1q93nfs8gyl83mjlc4x0qsgfqw32lacbjzdxg0mdfvxj";
inherit (import ../common/common-let.nix { inherit lib release_version; }) llvm_meta;
tools = lib.makeExtensible (tools: let
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
mkExtraBuildCommands0 = cc: ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
'';
bintoolsNoLibc' =
if bootBintoolsNoLibc == null
then tools.bintoolsNoLibc
else bootBintoolsNoLibc;
bintools' =
if bootBintools == null
then tools.bintools
else bootBintools;
in {
libllvm = callPackage ./llvm {
inherit llvm_meta;
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm;
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang;
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;
inherit clang-tools-extra_src;
libllvm = tools.libllvm-polly;
enablePolly = true;
};
# disabled until recommonmark supports sphinx 3
#llvm-manpages = lowPrio (tools.libllvm.override {
# enableManpages = true;
# python3 = pkgs.python3; # don't use python-boot
#});
clang-manpages = lowPrio (tools.libclang.override {
enableManpages = true;
python3 = pkgs.python3; # don't use python-boot
});
# pick clang appropriate for package set we are targeting
clang =
/**/ if stdenv.targetPlatform.libc == null then tools.clangNoLibc
else if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
else tools.libcxxClang;
libstdcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;
# libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
libcxx = null;
extraPackages = [
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
};
libcxxClang = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
extraPackages = [
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = mkExtraBuildCommands cc;
};
lld = callPackage ./lld {
inherit llvm_meta;
};
lldb = callPackage ./lldb {
inherit llvm_meta;
};
# Below, is the LLVM bootstrapping logic. It handles building a
# fully LLVM toolchain from scratch. No GCC toolchain should be
# pulled in. As a consequence, it is very quick to build different
# targets provided by LLVM and we can also build for what GCC
# doesnt support like LLVM. Probably we should move to some other
# file.
bintools-unwrapped = callPackage ../common/bintools.nix { };
bintoolsNoLibc = wrapBintoolsWith {
bintools = tools.bintools-unwrapped;
libc = preLibcCrossHeaders;
};
bintools = wrapBintoolsWith {
bintools = tools.bintools-unwrapped;
};
clangUseLLVM = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = targetLlvmLibraries.libcxx;
bintools = bintools';
extraPackages = [
libcxx.cxxabi
targetLlvmLibraries.compiler-rt
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
targetLlvmLibraries.libunwind
];
extraBuildCommands = ''
echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
echo "-lunwind" >> $out/nix-support/cc-ldflags
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
};
clangNoLibcxx = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = bintools';
extraPackages = [
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = ''
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
echo "-nostdlib++" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
};
clangNoLibc = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = bintoolsNoLibc';
extraPackages = [
targetLlvmLibraries.compiler-rt
];
extraBuildCommands = ''
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands cc;
};
clangNoCompilerRt = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = bintoolsNoLibc';
extraPackages = [ ];
extraBuildCommands = ''
echo "-nostartfiles" >> $out/nix-support/cc-cflags
'' + mkExtraBuildCommands0 cc;
};
clangNoCompilerRtWithLibc = wrapCCWith rec {
cc = tools.clang-unwrapped;
libcxx = null;
bintools = bintools';
extraPackages = [ ];
extraBuildCommands = mkExtraBuildCommands0 cc;
};
});
libraries = lib.makeExtensible (libraries: let
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
in {
compiler-rt-libc = callPackage ./compiler-rt {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
else stdenv;
};
compiler-rt-no-libc = callPackage ./compiler-rt {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
else stdenv;
};
# N.B. condition is safe because without useLLVM both are the same.
compiler-rt = if stdenv.hostPlatform.isAndroid
then libraries.compiler-rt-libc
else libraries.compiler-rt-no-libc;
stdenv = overrideCC stdenv buildLlvmTools.clang;
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
libcxx = callPackage ./libcxx {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
else stdenv;
};
libcxxabi = callPackage ./libcxxabi {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
else stdenv;
};
libunwind = callPackage ./libunwind {
inherit llvm_meta;
stdenv = if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
else stdenv;
};
openmp = callPackage ./openmp {
inherit llvm_meta targetLlvm;
};
});
noExtend = extensible: lib.attrsets.removeAttrs extensible [ "extend" ];
in { inherit tools libraries release_version; } // (noExtend libraries) // (noExtend tools)

View File

@ -1,88 +0,0 @@
{ lib, stdenv, llvm_meta, fetch, cmake, python3, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else libcxxabi
, libcxxabi, libcxxrt
, enableShared ? !stdenv.hostPlatform.isStatic
}:
assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";
stdenv.mkDerivation {
pname = "libcxx";
inherit version;
src = fetch "libcxx" "0d2bj5i6mk4caq7skd5nsdmz8c2m5w5anximl5wz3x32p08zz089";
postUnpack = ''
unpackFile ${libcxxabi.src}
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
'';
outputs = [ "out" "dev" ];
patches = [
./gnu-install-dirs.patch
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../common/libcxx/libcxx-0001-musl-hacks.patch
];
# Prevent errors like "error: 'foo' is unavailable: introduced in macOS yy.zz"
postPatch = ''
substituteInPlace include/__config \
--replace "# define _LIBCPP_USE_AVAILABILITY_APPLE" ""
'';
preConfigure = ''
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
patchShebangs utils/cat_files.py
'';
nativeBuildInputs = [ cmake ]
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ cxxabi ];
cmakeFlags = [
"-DLIBCXX_LIBCPPABI_VERSION=2"
"-DLIBCXX_CXX_ABI=${cxxabi.pname}"
] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
++ lib.optional (cxxabi.pname == "libcxxabi") "-DLIBCXX_LIBCXXABI_LIB_PATH=${cxxabi}/lib"
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
++ lib.optionals stdenv.hostPlatform.isWasm [
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
preInstall = lib.optionalString (stdenv.isDarwin) ''
for file in lib/*.dylib; do
if [ -L "$file" ]; then continue; fi
baseName=$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))
installName="$out/lib/$baseName"
abiName=$(echo "$baseName" | sed -e 's/libc++/libc++abi/')
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other ${cxxabi}/lib/$abiName $file
done
done
'';
passthru = {
isLLVM = true;
inherit cxxabi;
};
meta = llvm_meta // {
homepage = "https://libcxx.llvm.org/";
description = "C++ standard library";
longDescription = ''
libc++ is an implementation of the C++ standard library, targeting C++11,
C++14 and above.
'';
# "All of the code in libc++ is dual licensed under the MIT license and the
# UIUC License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
};
}

View File

@ -1,99 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec1869ddc7ae..a1c040235c8d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,8 @@ set(CMAKE_MODULE_PATH
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD)
project(libcxx CXX C)
+ include(GNUInstallDirs)
+
set(PACKAGE_NAME libcxx)
set(PACKAGE_VERSION 9.0.1)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
@@ -416,7 +418,7 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
if(LIBCXX_LIBDIR_SUBDIR)
string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
string(APPEND LIBCXX_INSTALL_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
@@ -424,10 +426,10 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR})
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
else()
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX})
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX})
endif()
file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
index 10f100f7f0fb..95ed3978ab73 100644
--- a/cmake/Modules/HandleLibCXXABI.cmake
+++ b/cmake/Modules/HandleLibCXXABI.cmake
@@ -61,7 +61,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
if (LIBCXX_INSTALL_HEADERS)
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
COMPONENT cxx-headers
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 7cbf82caa81f..7cbde7accd78 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -243,7 +243,7 @@ if (LIBCXX_INSTALL_HEADERS)
foreach(file ${files})
get_filename_component(dir ${file} DIRECTORY)
install(FILES ${file}
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dir}
COMPONENT ${CXX_HEADER_TARGET}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
@@ -252,7 +252,7 @@ if (LIBCXX_INSTALL_HEADERS)
if (LIBCXX_NEEDS_SITE_CONFIG)
# Install the generated header as __config.
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
- DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
+ DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
RENAME __config
COMPONENT ${CXX_HEADER_TARGET})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 31cd24333a5e..a419cef662b0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -437,21 +437,21 @@ if (LIBCXX_INSTALL_LIBRARY)
install(TARGETS cxx_shared
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
endif()
if (LIBCXX_INSTALL_STATIC_LIBRARY)
install(TARGETS cxx_static
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
endif()
if(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib}
LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${LIBCXX_INSTALL_LIBRARY_DIR} COMPONENT cxx
- RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}bin COMPONENT cxx)
+ RUNTIME DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_BINDIR} COMPONENT cxx)
endif()
# NOTE: This install command must go after the cxx install command otherwise

View File

@ -1,85 +0,0 @@
{ lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation {
pname = "libcxxabi";
inherit version;
src = fetch "libcxxabi" "1b4aiaa8cirx52vk2p5kfk57qmbqf1ipb4nqnjhdgqps9jm7iyg8";
outputs = [ "out" "dev" ];
postUnpack = ''
unpackFile ${libcxx.src}
unpackFile ${llvm.src}
cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
'' + lib.optionalString stdenv.isDarwin ''
export TRIPLE=x86_64-apple-darwin
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
patch -p1 -d $(ls -d libcxx-*) -i ${../../common/libcxx/libcxx-0001-musl-hacks.patch}
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
patch -p1 -d $(ls -d llvm-*) -i ${../../common/libcxxabi/wasm.patch}
'';
patches = [
../../common/libcxxabi/no-threads.patch
./gnu-install-dirs.patch
];
nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;
cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
] ++ lib.optionals stdenv.hostPlatform.isWasm [
"-DLIBCXXABI_ENABLE_THREADS=OFF"
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals (!enableShared) [
"-DLIBCXXABI_ENABLE_SHARED=OFF"
];
preInstall = lib.optionalString stdenv.isDarwin ''
for file in lib/*.dylib; do
if [ -L "$file" ]; then continue; fi
# Fix up the install name. Preserve the basename, just replace the path.
installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
# this should be done in CMake, but having trouble figuring out
# the magic combination of necessary CMake variables
# if you fancy a try, take a look at
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
# cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
# libcxxabi to sometimes link against a different version of itself.
# Here we simply make that second reference point to ourselves.
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
done
done
'';
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'';
passthru = {
libName = "c++abi";
};
meta = llvm_meta // {
homepage = "https://libcxxabi.llvm.org/";
description = "Provides C++ standard library support";
longDescription = ''
libc++abi is a new implementation of low level support for a standard C++ library.
'';
# "All of the code in libc++abi is dual licensed under the MIT license and
# the UIUC License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
};
}

View File

@ -1,34 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa0b124fc3c4..d74373f465c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXXABI_STANDALONE_BUILD)
project(libcxxabi CXX C)
+ include(GNUInstallDirs)
+
set(PACKAGE_NAME libcxxabi)
set(PACKAGE_VERSION 9.0.1)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
@@ -181,17 +183,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
if(LIBCXX_LIBDIR_SUBDIR)
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
string(APPEND LIBCXXABI_INSTALL_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
endif()
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
else()
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX})
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX})
endif()
set(LIBCXXABI_INSTALL_PREFIX "" CACHE STRING "Define libc++abi destination prefix.")

View File

@ -1,31 +0,0 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "libunwind";
inherit version;
src = fetch pname "1wb02ha3gl6p0a321hwpll74pz5qvjr11xmjqx62g288f1m10njk";
patches = [
./gnu-install-dirs.patch
];
outputs = [ "out" "dev" ];
nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
meta = llvm_meta // {
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst
homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library";
description = "LLVM's unwinder library";
longDescription = ''
The unwind library provides a family of _Unwind_* functions implementing
the language-neutral stack unwinding portion of the Itanium C++ ABI (Level
I). It is a dependency of the C++ ABI library, and sometimes is a
dependency of other runtimes.
'';
};
}

View File

@ -1,34 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index df68491d686e..3b53267ae464 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
project(libunwind)
+ include(GNUInstallDirs)
+
# Rely on llvm-config.
set(CONFIG_OUTPUT)
if(NOT LLVM_CONFIG_PATH)
@@ -189,17 +191,17 @@ string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
+ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++)
if(LIBCXX_LIBDIR_SUBDIR)
string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
endif()
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
+ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
else()
set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX})
+ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX})
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBUNWIND_LIBRARY_DIR})

View File

@ -1,46 +0,0 @@
{ lib, stdenv, llvm_meta
, buildLlvmTools
, fetch
, cmake
, libxml2
, libllvm
, version
}:
stdenv.mkDerivation rec {
pname = "lld";
inherit version;
src = fetch pname "10hckfxpapfnh6y9apjiya2jpw9nmbbmh8ayijx89mrg7snjn9l6";
patches = [
./gnu-install-dirs.patch
];
nativeBuildInputs = [ cmake ];
buildInputs = [ libllvm libxml2 ];
cmakeFlags = [
"-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
];
# Musl's default stack size is too small for lld to be able to link Firefox.
LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-Wl,-z,stack-size=2097152";
outputs = [ "out" "lib" "dev" ];
meta = llvm_meta // {
homepage = "https://lld.llvm.org/";
description = "The LLVM linker (unwrapped)";
longDescription = ''
LLD is a linker from the LLVM project that is a drop-in replacement for
system linkers and runs much faster than them. It also provides features
that are useful for toolchain developers.
The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
WebAssembly in descending order of completeness. Internally, LLD consists
of several different linkers.
'';
};
}

View File

@ -1,68 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 641f71c114ae..9d44c1463aff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(LLD_BUILT_STANDALONE TRUE)
+ include(GNUInstallDirs)
+
find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
if(NOT LLVM_CONFIG_PATH)
message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
@@ -202,7 +204,7 @@ include_directories(BEFORE
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
index fa48b428d26b..e7967aad3ceb 100644
--- a/cmake/modules/AddLLD.cmake
+++ b/cmake/modules/AddLLD.cmake
@@ -20,9 +20,9 @@ macro(add_lld_library name)
install(TARGETS ${name}
COMPONENT ${name}
${export_to_lldtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- RUNTIME DESTINATION bin)
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
add_llvm_install_targets(install-${name}
@@ -54,7 +54,7 @@ macro(add_lld_tool name)
install(TARGETS ${name}
${export_to_lldtargets}
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT ${name})
if(NOT CMAKE_CONFIGURATION_TYPES)
@@ -69,5 +69,5 @@ endmacro()
macro(add_lld_symlink name dest)
add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
# Always generate install targets
- llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
+ llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
endmacro()
diff --git a/tools/lld/CMakeLists.txt b/tools/lld/CMakeLists.txt
index a15e296e31df..654c2cfdb9c0 100644
--- a/tools/lld/CMakeLists.txt
+++ b/tools/lld/CMakeLists.txt
@@ -17,7 +17,7 @@ target_link_libraries(lld
)
install(TARGETS lld
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(NOT LLD_SYMLINKS_TO_CREATE)
set(LLD_SYMLINKS_TO_CREATE lld-link ld.lld ld64.lld wasm-ld)

View File

@ -1,117 +0,0 @@
{ lib, stdenv, llvm_meta
, fetch
, fetchpatch
, cmake
, zlib
, ncurses
, swig
, which
, libedit
, libxml2
, libllvm
, libclang
, python3
, version
, darwin
, makeWrapper
, perl
, lit
}:
stdenv.mkDerivation rec {
pname = "lldb";
inherit version;
src = fetch pname "02gb3fbz09kyw8n71218v5v77ip559x3gqbcp8y3w6n3jpbryywa";
patches = [
./procfs.patch
./gnu-install-dirs.patch
# Fix darwin build
(fetchpatch {
name = "lldb-use-system-debugserver-fix.patch";
url = "https://github.com/llvm-mirror/lldb/commit/be770754cc43da22eacdb70c6203f4582eeb011f.diff";
sha256 = "sha256-tKkk6sn//0Hu0nlzoKWs5fXMWc+O2JAWOEJ1ZnaLuVU=";
excludes = [ "packages/*" ];
postFetch = ''
substituteInPlace "$out" --replace add_lldb_tool_subdirectory add_subdirectory
'';
})
./lldb-gdb-remote-no-libcompress.patch
];
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [
cmake python3 which swig lit makeWrapper
] ++ lib.optionals stdenv.isDarwin [
# for scripts/generate-vers.pl
perl
];
buildInputs = [
ncurses zlib libedit libxml2 libllvm
] ++ lib.optionals stdenv.isDarwin [
darwin.libobjc
darwin.apple_sdk.libs.xpc
darwin.apple_sdk.frameworks.Foundation
darwin.bootstrap_cmds
darwin.apple_sdk.frameworks.Carbon
darwin.apple_sdk.frameworks.Cocoa
darwin.apple_sdk.frameworks.DebugSymbols
];
CXXFLAGS = "-fno-rtti";
hardeningDisable = [ "format" ];
cmakeFlags = [
"-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
"-DClang_DIR=${libclang.dev}/lib/cmake"
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
] ++ lib.optionals stdenv.isDarwin [
# Building debugserver requires the proprietary libcompression
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
] ++ lib.optionals doCheck [
"-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
"-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
];
doCheck = false;
doInstallCheck = true;
installCheckPhase = ''
if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
echo "ERROR: python files not installed where expected!";
return 1;
fi
'';
postInstall = ''
wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
# man page
mkdir -p $out/share/man/man1
install ../docs/lldb.1 -t $out/share/man/man1/
# Editor support
# vscode:
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
ln -s $out/bin/llvm-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
'';
meta = llvm_meta // {
broken = stdenv.isDarwin && stdenv.isAarch64;
homepage = "https://lldb.llvm.org/";
description = "A next-generation high-performance debugger";
longDescription = ''
LLDB is a next generation, high-performance debugger. It is built as a set
of reusable components which highly leverage existing libraries in the
larger LLVM Project, such as the Clang expression parser and LLVM
disassembler.
'';
};
}

View File

@ -1,105 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5d52f6450657..a05130cf80b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,8 @@ set(CMAKE_MODULE_PATH
# If we are not building as part of LLVM, build LLDB as a standalone project,
# using LLVM as an external library.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ include(GNUInstallDirs)
+
include(LLDBStandalone)
endif()
diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
index 4c99278c583b..36d3640a6afc 100644
--- a/cmake/modules/AddLLDB.cmake
+++ b/cmake/modules/AddLLDB.cmake
@@ -94,13 +94,13 @@ function(add_lldb_library name)
endif()
if(PARAM_SHARED)
- set(install_dest lib${LLVM_LIBDIR_SUFFIX})
+ set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
if(PARAM_INSTALL_PREFIX)
set(install_dest ${PARAM_INSTALL_PREFIX})
endif()
# RUNTIME is relevant for DLL platforms, FRAMEWORK for macOS
install(TARGETS ${name} COMPONENT ${name}
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${install_dest}
ARCHIVE DESTINATION ${install_dest}
FRAMEWORK DESTINATION ${install_dest})
diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
index e1a133709ff2..357b4bb4492a 100644
--- a/cmake/modules/LLDBConfig.cmake
+++ b/cmake/modules/LLDBConfig.cmake
@@ -335,7 +335,7 @@ include_directories(BEFORE
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/
COMPONENT lldb-headers
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
@@ -345,7 +345,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
COMPONENT lldb-headers
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
index b5316540fdf3..3c3c882d503f 100644
--- a/tools/intel-features/CMakeLists.txt
+++ b/tools/intel-features/CMakeLists.txt
@@ -64,4 +64,4 @@ if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
endif()
install(TARGETS lldbIntelFeatures
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cdf22c4..d56fc6a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,7 +146,7 @@ if (NOT LLDB_DISABLE_PYTHON)
--cfgBldDir=${lldb_scripts_dir}
--prefix=${CMAKE_BINARY_DIR}
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
- --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
+ --lldbLibDir=${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
${use_python_wrapper_from_src_dir}
${use_six_py_from_system}
VERBATIM
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake
index b726797..1f057ac 100644
--- a/cmake/modules/LLDBStandalone.cmake
+++ b/cmake/modules/LLDBStandalone.cmake
@@ -95,7 +95,7 @@ include_directories(
"${CLANG_INCLUDE_DIRS}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/lib${LLVM_LIBDIR_SUFFIX})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
set(LLDB_BUILT_STANDALONE 1)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 7de7973..b70aecc 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -50,7 +50,8 @@ if(NOT LLDB_BUILD_FRAMEWORK)
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${PYTHON_EXECUTABLE}
- -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))"
+ -c "import distutils.sysconfig, sys; print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
+ ${CMAKE_INSTALL_LIBDIR}/../
OUTPUT_VARIABLE SWIG_INSTALL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)

View File

@ -1,17 +0,0 @@
diff -ru a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 2019-12-11 14:15:30.000000000 -0500
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 2021-11-26 23:44:28.000000000 -0500
@@ -36,13 +36,6 @@
#include "llvm/ADT/StringSwitch.h"
-#if defined(__APPLE__)
-#ifndef HAVE_LIBCOMPRESSION
-#define HAVE_LIBCOMPRESSION
-#endif
-#include <compression.h>
-#endif
-
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::process_gdb_remote;

View File

@ -1,31 +0,0 @@
--- a/source/Plugins/Process/Linux/Procfs.h
+++ b/source/Plugins/Process/Linux/Procfs.h
@@ -11,21 +11,12 @@
// sys/procfs.h on Android/Linux for all supported architectures.
#include <sys/ptrace.h>
+#include <asm/ptrace.h>
-#ifdef __ANDROID__
-#if defined(__arm64__) || defined(__aarch64__)
-typedef unsigned long elf_greg_t;
-typedef elf_greg_t
- elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
-typedef struct user_fpsimd_state elf_fpregset_t;
-#ifndef NT_FPREGSET
-#define NT_FPREGSET NT_PRFPREG
-#endif // NT_FPREGSET
-#elif defined(__mips__)
-#ifndef NT_FPREGSET
-#define NT_FPREGSET NT_PRFPREG
-#endif // NT_FPREGSET
-#endif
-#else // __ANDROID__
+#if !defined(__GLIBC__) && defined(__powerpc__)
+#define pt_regs musl_pt_regs
+#include <sys/procfs.h>
+#undef pt_regs
+#else
#include <sys/procfs.h>
-#endif // __ANDROID__
+#endif

View File

@ -1,346 +0,0 @@
{ lib, stdenv, llvm_meta
, pkgsBuildBuild
, fetch
, fetchpatch
, cmake
, python3
, libffi
, enableGoldPlugin ? libbfd.hasPluginAPI
, libbfd
, libpfm
, libxml2
, ncurses
, version
, release_version
, zlib
, buildLlvmTools
, debugVersion ? false
, doCheck ? stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isRiscV)
&& (stdenv.hostPlatform == stdenv.buildPlatform)
, enableManpages ? false
, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
# broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
# broken for the armv7l builder
, enablePFM ? stdenv.isLinux && !stdenv.hostPlatform.isAarch
, enablePolly ? false
}:
let
inherit (lib) optional optionals optionalString;
# Used when creating a version-suffixed symlink of libLLVM.dylib
shortVersion = with lib;
concatStringsSep "." (take 1 (splitString "." release_version));
# Ordinarily we would just the `doCheck` and `checkDeps` functionality
# `mkDerivation` gives us to manage our test dependencies (instead of breaking
# out `doCheck` as a package level attribute).
#
# Unfortunately `lit` does not forward `$PYTHONPATH` to children processes, in
# particular the children it uses to do feature detection.
#
# This means that python deps we add to `checkDeps` (which the python
# interpreter is made aware of via `$PYTHONPATH` populated by the python
# setup hook) are not picked up by `lit` which causes it to skip tests.
#
# Adding `python3.withPackages (ps: [ ... ])` to `checkDeps` also doesn't work
# because this package is shadowed in `$PATH` by the regular `python3`
# package.
#
# So, we "manually" assemble one python derivation for the package to depend
# on, taking into account whether checks are enabled or not:
python = if doCheck then
let
checkDeps = ps: with ps; [ psutil ];
in python3.withPackages checkDeps
else python3;
in stdenv.mkDerivation (rec {
pname = "llvm";
inherit version;
src = fetch pname "16hwp3qa54c3a3v7h8nlw0fh5criqh0hlr1skybyk0cz70gyx880";
polly_src = fetch "polly" "1kqg0isv0kicnylrdp5iajlgd6alc0zx1l3cxc9hs8r3z6fwcjls";
unpackPhase = ''
unpackFile $src
mv llvm-${version}* llvm
sourceRoot=$PWD/llvm
'' + optionalString enablePolly ''
unpackFile $polly_src
mv polly-* $sourceRoot/tools/polly
'';
outputs = [ "out" "lib" "dev" "python" ];
nativeBuildInputs = [ cmake python ]
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
buildInputs = [ libxml2 libffi ]
++ optional enablePFM libpfm; # exegesis
propagatedBuildInputs = [ ncurses zlib ];
patches = [
# When cross-compiling we configure llvm-config-native with an approximation
# of the flags used for the normal LLVM build. To avoid the need for building
# a native libLLVM.so (which would fail) we force llvm-config to be linked
# statically against the necessary LLVM components always.
../../common/llvm/llvm-config-link-static.patch
./gnu-install-dirs.patch
# Force a test to evaluate the saved benchmark for a CPU for which LLVM has
# an execution model. See NixOS/nixpkgs#119673.
./exegesis-force-bdver2.patch
# Fix missing includes for GCC 11
(fetchpatch {
name = "headers-gcc-11.patch";
url = "https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1.patch";
sha256 = "0nh123kld0dgz2h941lng331dkj3wbm5lfxm375k1f569gv83hlk";
stripLen = 1;
})
# Fix invalid std::string(nullptr) for GCC 12
(fetchpatch {
name = "nvptx-gcc-12.patch";
url = "https://github.com/llvm/llvm-project/commit/99e64623ec9b31def9375753491cc6093c831809.patch";
sha256 = "0zjfjgavqzi2ypqwqnlvy6flyvdz8hi1anwv0ybwnm2zqixg7za3";
stripLen = 1;
})
# Fix musl build.
(fetchpatch {
url = "https://github.com/llvm/llvm-project/commit/5cd554303ead0f8891eee3cd6d25cb07f5a7bf67.patch";
relative = "llvm";
hash = "sha256-XPbvNJ45SzjMGlNUgt/IgEvM2dHQpDOe6woUJY+nUYA=";
})
] ++ lib.optionals enablePolly [
./gnu-install-dirs-polly.patch
# Add missing isl header includess required to build LLVM 9 + Polly with clang 16.
(fetchpatch {
name = "polly-ppcg-isl-headers.patch";
url = "https://repo.or.cz/ppcg.git/patch/098ba285306114dc71497f7b51c357f69c9b4472";
hash = "sha256-c9L30rDROYAMbUSuaK9U/ixyFMlH/Sa1n+VgLODzSCQ=";
extraPrefix = "tools/polly/lib/External/ppcg/";
stripLen = 1;
})
];
postPatch = optionalString stdenv.isDarwin ''
substituteInPlace cmake/modules/AddLLVM.cmake \
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
'' + ''
# 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 ${../../common/llvm/TLI-musl.patch}
substituteInPlace unittests/Support/CMakeLists.txt \
--replace "add_subdirectory(DynamicLibrary)" ""
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
# valgrind unhappy with musl or glibc, but fails w/musl only
rm test/CodeGen/AArch64/wineh4.mir
'' + optionalString stdenv.hostPlatform.isAarch32 ''
# skip failing X86 test cases on 32-bit ARM
rm test/DebugInfo/X86/convert-debugloc.ll
rm test/DebugInfo/X86/convert-inlined.ll
rm test/DebugInfo/X86/convert-linked.ll
rm test/tools/dsymutil/X86/op-convert.test
'' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
# Seems to require certain floating point hardware (NEON?)
rm test/ExecutionEngine/frem.ll
'' + ''
patchShebangs test/BugPoint/compile-custom.ll.py
# Fix test so that no extra locale files are needed
substituteInPlace test/tools/llvm-ar/mri-utf8.test \
--replace en_US.UTF-8 C.UTF-8
# Fix x86 gold test on non-x86 platforms
# (similar fix made to others in this directory previously, FWIW)
patch -p1 -i ${./fix-test-on-non-x86-like-others.patch}
'' + ''
# Tweak tests to ignore namespace part of type to support
# gcc-12: https://gcc.gnu.org/PR103598.
# The change below mangles strings like:
# CHECK-NEXT: Starting llvm::Function pass manager run.
# to:
# CHECK-NEXT: Starting {{.*}}Function pass manager run.
for f in \
test/Other/new-pass-manager.ll \
test/Other/new-pm-defaults.ll \
test/Other/new-pm-lto-defaults.ll \
test/Other/new-pm-thinlto-defaults.ll \
test/Other/pass-pipeline-parsing.ll \
test/Transforms/Inline/cgscc-incremental-invalidate.ll \
test/Transforms/Inline/clear-analyses.ll \
test/Transforms/LoopUnroll/unroll-loop-invalidation.ll \
test/Transforms/SCCP/ipsccp-preserve-analysis.ll \
test/Transforms/SCCP/preserve-analysis.ll \
test/Transforms/SROA/dead-inst.ll \
test/tools/gold/X86/new-pm.ll \
; do
echo "PATCH: $f"
substituteInPlace $f \
--replace 'Starting llvm::' 'Starting {{.*}}' \
--replace 'Finished llvm::' 'Finished {{.*}}'
done
'';
preConfigure = ''
# Workaround for configure flags that need to have spaces
cmakeFlagsArray+=(
-DLLVM_LIT_ARGS='-svj''${NIX_BUILD_CORES} --no-progress-bar'
)
'';
# hacky fix: created binaries need to be run before installation
preBuild = ''
mkdir -p $out/
ln -sv $PWD/lib $out
'';
hardeningDisable = [ "trivialautovarinit" ];
cmakeBuildType = if debugVersion then "Debug" else "Release";
cmakeFlags = with stdenv; let
# These flags influence llvm-config's BuildVariables.inc in addition to the
# general build. We need to make sure these are also passed via
# CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
# will return different results from the cross llvm-config.
#
# Some flags don't need to be repassed because LLVM already does so (like
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
flagsForLlvmConfig = [
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
"-DLLVM_ENABLE_RTTI=ON"
] ++ optionals enableSharedLibraries [
"-DLLVM_LINK_LLVM_DYLIB=ON"
];
in flagsForLlvmConfig ++ [
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
"-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals enableManpages [
"-DLLVM_BUILD_DOCS=ON"
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_OUTPUT_HTML=OFF"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ++ optionals (enableGoldPlugin) [
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
] ++ optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false"
] ++ optionals ((stdenv.hostPlatform != stdenv.buildPlatform) && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) [
"-DCMAKE_CROSSCOMPILING=True"
"-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
(
let
nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
nativeBintools = nativeCC.bintools.bintools;
nativeToolchainFlags = [
"-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
"-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
"-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
"-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
"-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
];
# We need to repass the custom GNUInstallDirs values, otherwise CMake
# will choose them for us, leading to wrong results in llvm-config-native
nativeInstallFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
"-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
];
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+ lib.concatStringsSep ";" (lib.concatLists [
flagsForLlvmConfig
nativeToolchainFlags
nativeInstallFlags
])
)
];
postBuild = ''
rm -fR $out
'';
preCheck = ''
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
'';
postInstall = ''
mkdir -p $python/share
mv $out/share/opt-viewer $python/share/opt-viewer
moveToOutput "bin/llvm-config*" "$dev"
substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
--replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
--replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
''
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
''
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
'';
inherit doCheck;
checkTarget = "check-all";
requiredSystemFeatures = [ "big-parallel" ];
meta = llvm_meta // {
homepage = "https://llvm.org/";
description = "A collection of modular and reusable compiler and toolchain technologies";
longDescription = ''
The LLVM Project is a collection of modular and reusable compiler and
toolchain technologies. Despite its name, LLVM has little to do with
traditional virtual machines. The name "LLVM" itself is not an acronym; it
is the full name of the project.
LLVM began as a research project at the University of Illinois, with the
goal of providing a modern, SSA-based compilation strategy capable of
supporting both static and dynamic compilation of arbitrary programming
languages. Since then, LLVM has grown to be an umbrella project consisting
of a number of subprojects, many of which are being used in production by
a wide variety of commercial and open source projects as well as being
widely used in academic research. Code in the LLVM project is licensed
under the "Apache 2.0 License with LLVM exceptions".
'';
};
} // lib.optionalAttrs enableManpages {
pname = "llvm-manpages";
buildPhase = ''
make docs-llvm-man
'';
propagatedBuildInputs = [];
installPhase = ''
make -C docs install
'';
postPatch = null;
postInstall = null;
outputs = [ "out" ];
doCheck = false;
meta = llvm_meta // {
description = "man pages for LLVM ${version}";
};
})

View File

@ -1,11 +0,0 @@
diff --git a/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s b/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s
index 3fc1f31d54dc..a4c9bdd92131 100644
--- a/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s
+++ b/test/tools/llvm-exegesis/X86/uops-CMOV16rm-noreg.s
@@ -1,5 +1,6 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=CMOV16rm -benchmarks-file=%t.CMOV16rm-uops.yaml
# RUN: FileCheck -check-prefixes=CHECK-YAML -input-file=%t.CMOV16rm-uops.yaml %s
+# RUN: sed -i 's,cpu_name:.*,cpu_name: bdver2,g' %t.CMOV16rm-uops.yaml
# RUN: llvm-exegesis -mcpu=bdver2 -mode=analysis -benchmarks-file=%t.CMOV16rm-uops.yaml -analysis-clusters-output-file=- -analysis-clustering-epsilon=0.1 -analysis-inconsistency-epsilon=0.1 -analysis-numpoints=1 -analysis-clustering=naive | FileCheck -check-prefixes=CHECK-CLUSTERS %s
# https://bugs.llvm.org/show_bug.cgi?id=41448

View File

@ -1,23 +0,0 @@
Index: test/tools/gold/X86/linkonce_odr_unnamed_addr.ll
===================================================================
diff --git a/test/tools/gold/X86/linkonce_odr_unnamed_addr.ll b/llvm/trunk/test/tools/gold/X86/linkonce_odr_unnamed_addr.ll
--- a/test/tools/gold/X86/linkonce_odr_unnamed_addr.ll (revision 372333)
+++ b/test/tools/gold/X86/linkonce_odr_unnamed_addr.ll (working copy)
@@ -3,7 +3,7 @@
; RUN: opt -module-summary %s -o %t.o
; RUN: opt -module-summary %p/Inputs/linkonce_odr_unnamed_addr.ll -o %t2.o
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: --plugin-opt=save-temps \
; RUN: %t.o %t2.o -o %t3.o
; RUN: llvm-dis %t.o.1.promote.bc -o - | FileCheck %s
@@ -11,7 +11,7 @@
; Now test when one module is a native object. In that case we must be
; conservative and not auto hide.
; RUN: llc %p/Inputs/linkonce_odr_unnamed_addr.ll -o %t2native.o -filetype=obj
-; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: --plugin-opt=save-temps \
; RUN: %t.o %t2native.o -o %t3.o
; RUN: llvm-dis %t.o.1.promote.bc -o - | FileCheck %s --check-prefix=NOSUMMARY

View File

@ -1,106 +0,0 @@
diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
index 9939097f743e..8cc538da912a 100644
--- a/tools/polly/CMakeLists.txt
+++ b/tools/polly/CMakeLists.txt
@@ -2,7 +2,11 @@
if (NOT DEFINED LLVM_MAIN_SRC_DIR)
project(Polly)
cmake_minimum_required(VERSION 3.4.3)
+endif()
+
+include(GNUInstallDirs)
+if (NOT DEFINED LLVM_MAIN_SRC_DIR)
# Where is LLVM installed?
find_package(LLVM CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
@@ -145,14 +149,14 @@ include_directories(
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
install(DIRECTORY ${POLLY_BINARY_DIR}/include/
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING
PATTERN "*.h"
PATTERN "CMakeFiles" EXCLUDE
diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
index 211f95512717..f9e04a4844b6 100644
--- a/tools/polly/cmake/CMakeLists.txt
+++ b/tools/polly/cmake/CMakeLists.txt
@@ -79,18 +79,18 @@ file(GENERATE
# Generate PollyConfig.cmake for the install tree.
unset(POLLY_EXPORTS)
-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
+set(POLLY_INSTALL_PREFIX "")
set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
+set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
if (POLLY_BUNDLED_ISL)
set(POLLY_CONFIG_INCLUDE_DIRS
- "${POLLY_INSTALL_PREFIX}/include"
- "${POLLY_INSTALL_PREFIX}/include/polly"
+ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
+ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
)
else()
set(POLLY_CONFIG_INCLUDE_DIRS
- "${POLLY_INSTALL_PREFIX}/include"
+ "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
${ISL_INCLUDE_DIRS}
)
endif()
@@ -100,12 +100,12 @@ endif()
foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
get_target_property(tgt_type ${tgt} TYPE)
if (tgt_type STREQUAL "EXECUTABLE")
- set(tgt_prefix "bin/")
+ set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
else()
- set(tgt_prefix "lib/")
+ set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
endif()
- set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
+ set(tgt_path "${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
index e48203871884..5bc8a2a52541 100644
--- a/tools/polly/cmake/polly_macros.cmake
+++ b/tools/polly/cmake/polly_macros.cmake
@@ -44,8 +44,8 @@ macro(add_polly_library name)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
install(TARGETS ${name}
EXPORT LLVMExports
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endmacro(add_polly_library)
diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
index 8ffd984e542b..261cc19f3238 100644
--- a/tools/polly/lib/External/CMakeLists.txt
+++ b/tools/polly/lib/External/CMakeLists.txt
@@ -274,7 +274,7 @@ if (POLLY_BUNDLED_ISL)
install(DIRECTORY
${ISL_SOURCE_DIR}/include/
${ISL_BINARY_DIR}/include/
- DESTINATION include/polly
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
FILES_MATCHING
PATTERN "*.h"
PATTERN "CMakeFiles" EXCLUDE

View File

@ -1,395 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9a10685b99f..c2750500df99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -242,15 +242,21 @@ if (CMAKE_BUILD_TYPE AND
message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif()
+include(GNUInstallDirs)
+
set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
-set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
+set(LLVM_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE STRING
+ "Path for binary subdirectory (defaults to 'bin')")
mark_as_advanced(LLVM_TOOLS_INSTALL_DIR)
set(LLVM_UTILS_INSTALL_DIR "${LLVM_TOOLS_INSTALL_DIR}" CACHE STRING
"Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
mark_as_advanced(LLVM_UTILS_INSTALL_DIR)
+set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
+ "Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
+
# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
@@ -534,9 +540,9 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
-set(LLVM_INSTALL_DOXYGEN_HTML_DIR "share/doc/llvm/doxygen-html"
+set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html"
CACHE STRING "Doxygen-generated HTML documentation install directory")
-set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "share/doc/llvm/ocaml-html"
+set(LLVM_INSTALL_OCAMLDOC_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html"
CACHE STRING "OCamldoc-generated HTML documentation install directory")
option (LLVM_BUILD_EXTERNAL_COMPILER_RT
@@ -1002,7 +1008,7 @@ endif()
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/llvm include/llvm-c
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "*.def"
@@ -1014,7 +1020,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
)
install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm ${LLVM_INCLUDE_DIR}/llvm-c
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "*.def"
@@ -1029,13 +1035,13 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
if (LLVM_INSTALL_MODULEMAPS)
install(DIRECTORY include/llvm include/llvm-c
- DESTINATION include
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "module.modulemap"
)
install(FILES include/llvm/module.install.modulemap
- DESTINATION include/llvm
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm
COMPONENT llvm-headers
RENAME "module.extern.modulemap"
)
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 619e986b8aa0..842b4f71d07e 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -697,9 +697,9 @@ macro(add_llvm_library name)
install(TARGETS ${name}
${export_to_llvmexports}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
- RUNTIME DESTINATION bin COMPONENT ${name})
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${name})
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
@@ -930,7 +930,7 @@ macro(add_llvm_example name)
endif()
add_llvm_executable(${name} ${ARGN})
if( LLVM_BUILD_EXAMPLES )
- install(TARGETS ${name} RUNTIME DESTINATION examples)
+ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endmacro(add_llvm_example name)
@@ -1485,7 +1485,7 @@ function(llvm_install_library_symlink name dest type)
set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
- set(output_dir lib${LLVM_LIBDIR_SUFFIX})
+ set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
if(WIN32 AND "${type}" STREQUAL "SHARED")
set(output_dir bin)
endif()
@@ -1501,7 +1501,7 @@ function(llvm_install_library_symlink name dest type)
endif()
endfunction()
-function(llvm_install_symlink name dest)
+function(llvm_install_symlink name dest output_dir)
cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
foreach(path ${CMAKE_MODULE_PATH})
if(EXISTS ${path}/LLVMInstallSymlink.cmake)
@@ -1524,7 +1524,7 @@ function(llvm_install_symlink name dest)
set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
install(SCRIPT ${INSTALL_SYMLINK}
- CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
+ CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
COMPONENT ${component})
if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
@@ -1606,7 +1606,8 @@ function(add_llvm_tool_symlink link_name target)
endif()
if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
- llvm_install_symlink(${link_name} ${target})
+ GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
+ llvm_install_symlink(${link_name} ${target} ${output_dir})
endif()
endif()
endfunction()
@@ -1728,9 +1729,9 @@ function(llvm_setup_rpath name)
if (APPLE)
set(_install_name_dir INSTALL_NAME_DIR "@rpath")
- set(_install_rpath "@loader_path/../lib" ${extra_libdir})
+ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}" ${extra_libdir})
elseif(UNIX)
- set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+ set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-z,origin ")
diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
index 02bab6846376..eff26adb2efc 100644
--- a/cmake/modules/AddOCaml.cmake
+++ b/cmake/modules/AddOCaml.cmake
@@ -140,9 +140,9 @@ function(add_ocaml_library name)
endforeach()
if( APPLE )
- set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
+ set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
elseif( UNIX )
- set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
+ set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
endif()
list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
index 22e3dcb776aa..ba77b9c195e2 100644
--- a/cmake/modules/AddSphinxTarget.cmake
+++ b/cmake/modules/AddSphinxTarget.cmake
@@ -73,7 +73,7 @@ function (add_sphinx_target builder project)
elseif (builder STREQUAL html)
string(TOUPPER "${project}" project_upper)
- set(${project_upper}_INSTALL_SPHINX_HTML_DIR "share/doc/${project}/html"
+ set(${project_upper}_INSTALL_SPHINX_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/${project}/html"
CACHE STRING "HTML documentation install directory for ${project}")
# '/.' indicates: copy the contents of the directory directly into
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 9cf22b436fa7..486e40010cd8 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
+set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
# First for users who use an installed LLVM, create the LLVMExports.cmake file.
@@ -96,13 +96,13 @@ foreach(p ${_count})
set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
endforeach(p)
-set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/include")
+set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
set(LLVM_CONFIG_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
set(LLVM_CONFIG_MAIN_INCLUDE_DIR "${LLVM_CONFIG_INCLUDE_DIRS}")
-set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
+set(LLVM_CONFIG_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
set(LLVM_CONFIG_CMAKE_DIR "\${LLVM_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
-set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
+set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
configure_file(
diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
index 09fed8085c23..aa79f192abf0 100644
--- a/cmake/modules/LLVMInstallSymlink.cmake
+++ b/cmake/modules/LLVMInstallSymlink.cmake
@@ -10,7 +10,7 @@ function(install_symlink name target outdir)
set(LINK_OR_COPY copy)
endif()
- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
+ set(bindir "${DESTDIR}${outdir}/")
message(STATUS "Creating ${name}")
diff --git a/docs/CMake.rst b/docs/CMake.rst
index 91fb5282206f..d2c9fd94d131 100644
--- a/docs/CMake.rst
+++ b/docs/CMake.rst
@@ -196,7 +196,7 @@ CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
**LLVM_LIBDIR_SUFFIX**:STRING
Extra suffix to append to the directory where libraries are to be
installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
- to install libraries to ``/usr/lib64``.
+ to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
**CMAKE_C_FLAGS**:STRING
Extra flags to use when compiling C source files.
@@ -492,8 +492,8 @@ LLVM-specific variables
**LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
The path to install Doxygen-generated HTML documentation to. This path can
- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
- `share/doc/llvm/doxygen-html`.
+ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
+ `${CMAKE_INSTALL_DOCDIR}/${project}/doxygen-html`.
**LLVM_ENABLE_SPHINX**:BOOL
If specified, CMake will search for the ``sphinx-build`` executable and will make
@@ -524,13 +524,33 @@ LLVM-specific variables
**LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
The path to install Sphinx-generated HTML documentation to. This path can
- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
- `share/doc/llvm/html`.
+ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
+ `${CMAKE_INSTALL_DOCDIR}/${project}/html`.
**LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
The path to install OCamldoc-generated HTML documentation to. This path can
- either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
- `share/doc/llvm/ocaml-html`.
+ either be absolute or relative to the ``CMAKE_INSTALL_PREFIX``. Defaults to
+ `${CMAKE_INSTALL_DOCDIR}/${project}/ocaml-html`.
+
+**CMAKE_INSTALL_BINDIR**:STRING
+ The path to install binary tools, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `bin`.
+
+**CMAKE_INSTALL_LIBDIR**:STRING
+ The path to install libraries, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `lib`.
+
+**CMAKE_INSTALL_INCLUDEDIR**:STRING
+ The path to install header files, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `include`.
+
+**CMAKE_INSTALL_DOCDIR**:STRING
+ The path to install documentation, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `share/doc`.
+
+**CMAKE_INSTALL_MANDIR**:STRING
+ The path to install manpage files, relative to the ``CMAKE_INSTALL_PREFIX``.
+ Defaults to `share/man`.
**LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
macOS Only: If enabled CMake will generate a target named
@@ -710,9 +730,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
This file is available in two different locations.
-* ``<INSTALL_PREFIX>/lib/cmake/llvm/LLVMConfig.cmake`` where
- ``<INSTALL_PREFIX>`` is the install prefix of an installed version of LLVM.
- On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+* ``<LLVM_INSTALL_PACKAGE_DIR>LLVMConfig.cmake`` where
+ ``<LLVM_INSTALL_PACKAGE_DIR>`` is the location where LLVM CMake modules are
+ installed as part of an installed version of LLVM. This is typically
+ ``cmake/llvm/`` within the lib directory. On Linux, this is typically
+ ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
* ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where
``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only
diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
index 1d5ca3ba92b0..026f5453c1da 100644
--- a/include/llvm/CMakeLists.txt
+++ b/include/llvm/CMakeLists.txt
@@ -4,5 +4,5 @@ add_subdirectory(Support)
# If we're doing an out-of-tree build, copy a module map for generated
# header files into the build area.
if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
- configure_file(module.modulemap.build module.modulemap COPYONLY)
+ configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
index 3a24d3e974e1..987d82c1bb97 100644
--- a/tools/llvm-config/BuildVariables.inc.in
+++ b/tools/llvm-config/BuildVariables.inc.in
@@ -23,6 +23,10 @@
#define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
#define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
+#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
+#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
+#define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
+#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
#define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
#define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
#define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 7ef7c46a2627..1f71f8b0f820 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -332,12 +332,26 @@ int main(int argc, char **argv) {
("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
} else {
ActivePrefix = CurrentExecPrefix;
- ActiveIncludeDir = ActivePrefix + "/include";
- SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
- sys::fs::make_absolute(ActivePrefix, path);
- ActiveBinDir = path.str();
- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
+ {
+ SmallString<256> path(StringRef(LLVM_INSTALL_INCLUDEDIR));
+ sys::fs::make_absolute(ActivePrefix, path);
+ ActiveIncludeDir = std::string(path.str());
+ }
+ {
+ SmallString<256> path(StringRef(LLVM_INSTALL_BINDIR));
+ sys::fs::make_absolute(ActivePrefix, path);
+ ActiveBinDir = std::string(path.str());
+ }
+ {
+ SmallString<256> path(StringRef(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX));
+ sys::fs::make_absolute(ActivePrefix, path);
+ ActiveLibDir = std::string(path.str());
+ }
+ {
+ SmallString<256> path(StringRef(LLVM_INSTALL_CMAKEDIR));
+ sys::fs::make_absolute(ActivePrefix, path);
+ ActiveCMakeDir = std::string(path.str());
+ }
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
index b86e4abd01a7..02ce5773f17d 100644
--- a/tools/lto/CMakeLists.txt
+++ b/tools/lto/CMakeLists.txt
@@ -23,7 +23,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
add_llvm_library(LTO SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES} DEPENDS intrinsics_gen)
install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
- DESTINATION include/llvm-c
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
COMPONENT LTO)
if (APPLE)
diff --git a/tools/opt-viewer/CMakeLists.txt b/tools/opt-viewer/CMakeLists.txt
index 19b606933082..27b9f71b3d79 100644
--- a/tools/opt-viewer/CMakeLists.txt
+++ b/tools/opt-viewer/CMakeLists.txt
@@ -8,6 +8,6 @@ set (files
foreach (file ${files})
install(PROGRAMS ${file}
- DESTINATION share/opt-viewer
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/opt-viewer
COMPONENT opt-viewer)
endforeach (file)
diff --git a/tools/remarks-shlib/CMakeLists.txt b/tools/remarks-shlib/CMakeLists.txt
index e948496c603a..1f4df8a98b10 100644
--- a/tools/remarks-shlib/CMakeLists.txt
+++ b/tools/remarks-shlib/CMakeLists.txt
@@ -11,7 +11,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/Remarks.exports)
add_llvm_library(Remarks SHARED INSTALL_WITH_TOOLCHAIN ${SOURCES})
install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
- DESTINATION include/llvm-c
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
COMPONENT Remarks)
if (APPLE)

View File

@ -1,37 +0,0 @@
{ lib
, stdenv
, llvm_meta
, fetch
, cmake
, llvm
, targetLlvm
, perl
, version
}:
stdenv.mkDerivation rec {
pname = "openmp";
inherit version;
src = fetch pname "1knafnpp0f7hylx8q20lkd6g1sf0flly572dayc5d5kghh7hd52w";
nativeBuildInputs = [ cmake perl ];
buildInputs = [
(if stdenv.buildPlatform == stdenv.hostPlatform then llvm else targetLlvm)
];
meta = llvm_meta // {
homepage = "https://openmp.llvm.org/";
description = "Support for the OpenMP language";
longDescription = ''
The OpenMP subproject of LLVM contains the components required to build an
executable OpenMP program that are outside the compiler itself.
Contains the code for the runtime library against which code compiled by
"clang -fopenmp" must be linked before it can run and the library that
supports offload to target devices.
'';
# "All of the code is dual licensed under the MIT license and the UIUC
# License (a BSD-like license)":
license = with lib.licenses; [ mit ncsa ];
};
}

View File

@ -16,6 +16,7 @@ with pkgs;
(filter (n: n != "llvmPackages_6"))
(filter (n: n != "llvmPackages_7"))
(filter (n: n != "llvmPackages_8"))
(filter (n: n != "llvmPackages_9"))
(filter (n: n != "llvmPackages_10"))
(filter (n: n != "llvmPackages_11"))
];

View File

@ -199,7 +199,7 @@ mapAliases ({
clang6Stdenv = throw "clang6Stdenv has been removed from nixpkgs"; # Added 2024-01-08
clang7Stdenv = throw "clang7Stdenv has been removed from nixpkgs"; # Added 2023-11-19
clang8Stdenv = throw "clang8Stdenv has been removed from nixpkgs"; # Added 2024-01-24
clang9Stdenv = lowPrio llvmPackages_9.stdenv;
clang9Stdenv = throw "clang9Stdenv has been remvoed from nixpkgs"; # Added 2024-04-08
clang10Stdenv = throw "clang10Stdenv has been removed from nixpkgs"; # Added 2024-01-26
clang11Stdenv = throw "clang11Stdenv has been removed from nixpkgs"; # Added 2023-01-24
clang12Stdenv = lowPrio llvmPackages_12.stdenv;
@ -212,11 +212,13 @@ mapAliases ({
clang-tools_6 = throw "clang-tools_6 has been removed from nixpkgs"; # Added 2024-01-08
clang-tools_7 = throw "clang-tools_7 has been removed from nixpkgs"; # Added 2023-11-19
clang-tools_8 = throw "clang-tools_8 has been removed from nixpkgs"; # Added 2024-01-24
clang-tools_9 = throw "clang-tools_9 has been removed from nixpkgs"; # Added 2024-04-08
clang-tools_10 = throw "clang-tools_10 has been removed from nixpkgs"; # Added 2023-01-26
clang-tools_11 = throw "clang-tools_11 has been removed from nixpkgs"; # Added 2023-01-24
clang_6 = throw "clang_6 has been removed from nixpkgs"; # Added 2024-01-08
clang_7 = throw "clang_7 has been removed from nixpkgs"; # Added 2023-11-19
clang_8 = throw "clang_8 has been removed from nixpkgs"; # Added 2024-01-24
clang_9 = throw "clang_9 has been removed from nixpkgs"; # Added 2024-01-08
clang_10 = throw "clang_10 has been removed from nixpkgs"; # Added 2024-01-26
clang_11 = throw "clang_11 has been removed from nixpkgs"; # Added 2023-01-24
@ -729,21 +731,25 @@ mapAliases ({
lld_6 = throw "lld_6 has been removed from nixpkgs"; # Added 2024-01-08
lld_7 = throw "lld_7 has been removed from nixpkgs"; # Added 2023-11-19
lld_8 = throw "lld_8 has been removed from nixpkgs"; # Added 2024-01-24
lld_9 = throw "lld_9 has been removed from nixpkgs"; # Added 2024-04-08
lld_10 = throw "lld_10 has been removed from nixpkgs"; # Added 2024-01-26
lld_11 = throw "lld_11 has been removed from nixpkgs"; # Added 2024-01-24
lldb_6 = throw "lldb_6 has been removed from nixpkgs"; # Added 2024-01-08
lldb_7 = throw "lldb_7 has been removed from nixpkgs"; # Added 2023-11-19
lldb_8 = throw "lldb_8 has been removed from nixpkgs"; # Added 2024-01-24
lldb_9 = throw "lldb_9 has been removed from nixpkgs"; # Added 2024-04-08
lldb_10 = throw "lldb_10 has been removed from nixpkgs"; # Added 2024-01-26
lldb_11 = throw "lldb_11 has been removed from nixpkgs"; # Added 2024-01-24
llvmPackages_6 = throw "llvmPackages_6 has been removed from nixpkgs"; # Added 2024-01-09
llvmPackages_7 = throw "llvmPackages_7 has been removed from nixpkgs"; # Added 2023-11-19
llvmPackages_8 = throw "llvmPackages_8 has been removed from nixpkgs"; # Added 2024-01-24
llvmPackages_9 = throw "llvmPackages_9 has been removed from nixpkgs"; # Added 2024-04-08
llvmPackages_10 = throw "llvmPackages_10 has been removed from nixpkgs"; # Added 2024-01-26
llvmPackages_11 = throw "llvmPackages_11 has been removed from nixpkgs"; # Added 2024-01-24
llvm_6 = throw "llvm_6 has been removed from nixpkgs"; # Added 2024-01-08
llvm_7 = throw "llvm_7 has been removed from nixpkgs"; # Added 2023-11-19
llvm_8 = throw "llvm_8 has been removed from nixpkgs"; # Added 2024-01-24
llvm_9 = throw "llvm_9 has been removed from nixpkgs"; # Added 2024-04-08
llvm_10 = throw "llvm_10 has been removed from nixpkgs"; # Added 2024-01-26
llvm_11 = throw "llvm_11 has been removed from nixpkgs"; # Added 2024-01-24

View File

@ -15444,7 +15444,6 @@ with pkgs;
};
clang = llvmPackages.clang;
clang_9 = llvmPackages_9.clang;
clang_12 = llvmPackages_12.clang;
clang_13 = llvmPackages_13.clang;
clang_14 = llvmPackages_14.clang;
@ -15454,10 +15453,6 @@ with pkgs;
clang-tools = callPackage ../development/tools/clang-tools { };
clang-tools_9 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_9;
};
clang-tools_12 = callPackage ../development/tools/clang-tools {
llvmPackages = llvmPackages_12;
};
@ -16401,7 +16396,6 @@ with pkgs;
};
lld = llvmPackages.lld;
lld_9 = llvmPackages_9.lld;
lld_12 = llvmPackages_12.lld;
lld_13 = llvmPackages_13.lld;
lld_14 = llvmPackages_14.lld;
@ -16410,7 +16404,6 @@ with pkgs;
lld_17 = llvmPackages_17.lld;
lldb = llvmPackages.lldb;
lldb_9 = llvmPackages_9.lldb;
lldb_12 = llvmPackages_12.lldb;
lldb_13 = llvmPackages_13.lldb;
lldb_14 = llvmPackages_14.lldb;
@ -16419,7 +16412,6 @@ with pkgs;
lldb_17 = llvmPackages_17.lldb;
llvm = llvmPackages.llvm;
llvm_9 = llvmPackages_9.llvm;
llvm_12 = llvmPackages_12.llvm;
llvm_13 = llvmPackages_13.llvm;
llvm_14 = llvmPackages_14.llvm;
@ -16451,14 +16443,6 @@ with pkgs;
stdenv.targetPlatform));
in pkgs.${"llvmPackages_${minSupported}"};
llvmPackages_9 = recurseIntoAttrs (callPackage ../development/compilers/llvm/9 {
inherit (stdenvAdapters) overrideCC;
buildLlvmTools = buildPackages.llvmPackages_9.tools;
targetLlvm = targetPackages.llvmPackages_9.llvm or llvmPackages_9.llvm;
targetLlvmLibraries = targetPackages.llvmPackages_9.libraries or llvmPackages_9.libraries;
stdenv = if stdenv.cc.cc.isGNU or false then gcc12Stdenv else stdenv; # does not build with gcc13
});
llvmPackages_12 = recurseIntoAttrs (callPackage ../development/compilers/llvm/12 ({
inherit (stdenvAdapters) overrideCC;
buildLlvmTools = buildPackages.llvmPackages_12.tools;
@ -19271,10 +19255,7 @@ with pkgs;
lttv = callPackage ../development/tools/misc/lttv { };
luaformatter = callPackage ../development/tools/luaformatter
(lib.optionalAttrs (stdenv.cc.isClang && lib.versionOlder stdenv.cc.version "9") {
stdenv = overrideCC stdenv llvmPackages_9.clang;
});
luaformatter = callPackage ../development/tools/luaformatter { };
lurk = callPackage ../development/tools/lurk { };