Merge pull request #111487 from Ericson2314/llvm-outputs-and-cross-compile-tools
llvmPackages: Clean up outputs
This commit is contained in:
commit
17305d2df0
|
@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
# needed for librocksdb-sys
|
||||
nativeBuildInputs = [ llvmPackages.clang ];
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
|
||||
cargoSha256 = "1rqpadlr9r4z2z825li6vi5a21hivc3bsn5ibxshrdrwiycyyxz8";
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
cargoSha256 = "1gm02pcfll362add8a0dcb0sk0mag8z0q23b87yb6fs870bqvhib";
|
||||
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
llvmPackages.clang
|
||||
|
|
|
@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
nativeBuildInputs = [ clang ];
|
||||
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
PROTOC = "${protobuf}/bin/protoc";
|
||||
|
||||
# NOTE: We don't build the WASM runtimes since this would require a more
|
||||
|
|
|
@ -56,8 +56,8 @@ stdenv.mkDerivation rec {
|
|||
e = "\");";
|
||||
v = lib.getVersion llvmPackages.clang;
|
||||
in
|
||||
p+llvmPackages.libcxx+"/include/c++/v1"+e
|
||||
+p+llvmPackages.clang-unwrapped+"/lib/clang/"+v+"/include/"+e
|
||||
p+llvmPackages.libcxx.dev+"/include/c++/v1"+e
|
||||
+p+llvmPackages.clang-unwrapped.lib+"/lib/clang/"+v+"/include/"+e
|
||||
+p+glibc.dev+"/include"+e;
|
||||
|
||||
preConfigure = ''
|
||||
|
|
|
@ -23,7 +23,7 @@ mkDerivation rec {
|
|||
|
||||
buildInputs = [
|
||||
kdevelop-pg-qt
|
||||
llvmPackages.llvm llvmPackages.clang-unwrapped
|
||||
llvmPackages.llvm llvmPackages.libclang
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
|
@ -37,7 +37,7 @@ mkDerivation rec {
|
|||
# https://cgit.kde.org/kdevelop.git/commit/?id=716372ae2e8dff9c51e94d33443536786e4bd85b
|
||||
# required as nixos seems to be unable to find CLANG_BUILTIN_DIR
|
||||
cmakeFlags = [
|
||||
"-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${lib.getVersion llvmPackages.clang}/include"
|
||||
"-DCLANG_BUILTIN_DIR=${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion llvmPackages.clang}/include"
|
||||
];
|
||||
|
||||
dontWrapQtApps = true;
|
||||
|
|
|
@ -7,7 +7,7 @@ index ec12a3a1ff..8c81b633ae 100644
|
|||
// we need to add in the associated libclang headers as
|
||||
// they are not discovered / used by default during compilation
|
||||
- FilePath llvmPath = s_libraryPath.parent().parent();
|
||||
+ FilePath llvmPath("@clang@");
|
||||
+ FilePath llvmPath("@libclang@");
|
||||
boost::format fmt("%1%/lib/clang/%2%/include");
|
||||
fmt % llvmPath.absolutePath() % version.asString();
|
||||
std::string includePath = fmt.str();
|
||||
|
|
|
@ -42,8 +42,8 @@ mkDerivation rec {
|
|||
postPatch = ''
|
||||
substituteInPlace src/cpp/core/r_util/REnvironmentPosix.cpp --replace '@R@' ${R}
|
||||
substituteInPlace src/cpp/core/libclang/LibClang.cpp \
|
||||
--replace '@clang@' ${llvmPackages.clang.cc} \
|
||||
--replace '@libclang.so@' ${llvmPackages.clang.cc.lib}/lib/libclang.so
|
||||
--replace '@libclang@' ${llvmPackages.libclang.lib} \
|
||||
--replace '@libclang.so@' ${llvmPackages.libclang.lib}/lib/libclang.so
|
||||
'';
|
||||
|
||||
ginSrc = fetchurl {
|
||||
|
|
|
@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
cargoSha256 = "1ffgvhkdj8wkhlgi0cj0njdm9ycxq2qda4b5qn8bmaygzr2zkwpd";
|
||||
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
|
||||
# needed for internal protobuf c wrapper library
|
||||
PROTOC = "${protobuf}/bin/protoc";
|
||||
|
|
|
@ -26,7 +26,7 @@ rustPlatform.buildRustPackage rec {
|
|||
++ lib.optional stdenv.isDarwin Security;
|
||||
checkInputs = [ gitMinimal util-linuxMinimal ];
|
||||
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
|
||||
cargoSha256 = "0n8cw70qh8g4hfwfaxwwxbrrx5hm2z037z8kdhvdpqkxljl9189x";
|
||||
|
||||
|
|
|
@ -248,8 +248,8 @@ buildStdenv.mkDerivation ({
|
|||
$(< ${buildStdenv.cc}/nix-support/libc-cflags) \
|
||||
$(< ${buildStdenv.cc}/nix-support/cc-cflags) \
|
||||
$(< ${buildStdenv.cc}/nix-support/libcxx-cxxflags) \
|
||||
${lib.optionalString buildStdenv.cc.isClang "-idirafter ${buildStdenv.cc.cc}/lib/clang/${lib.getVersion buildStdenv.cc.cc}/include"} \
|
||||
${lib.optionalString buildStdenv.cc.isGNU "-isystem ${buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc} -isystem ${buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc}/${buildStdenv.hostPlatform.config}"} \
|
||||
${lib.optionalString buildStdenv.cc.isClang "-idirafter ${buildStdenv.cc.cc.lib}/lib/clang/${lib.getVersion buildStdenv.cc.cc}/include"} \
|
||||
${lib.optionalString buildStdenv.cc.isGNU "-isystem ${lib.getDev buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc} -isystem ${buildStdenv.cc.cc}/include/c++/${lib.getVersion buildStdenv.cc.cc}/${buildStdenv.hostPlatform.config}"} \
|
||||
$NIX_CFLAGS_COMPILE"
|
||||
|
||||
echo "ac_add_options BINDGEN_CFLAGS='$BINDGEN_CFLAGS'" >> $MOZCONFIG
|
||||
|
@ -282,7 +282,7 @@ buildStdenv.mkDerivation ({
|
|||
"--disable-updater"
|
||||
"--enable-jemalloc"
|
||||
"--enable-default-toolkit=${default-toolkit}"
|
||||
"--with-libclang-path=${llvmPackages.libclang}/lib"
|
||||
"--with-libclang-path=${llvmPackages.libclang.lib}/lib"
|
||||
"--with-system-nspr"
|
||||
"--with-system-nss"
|
||||
]
|
||||
|
|
|
@ -244,7 +244,7 @@ stdenv.mkDerivation rec {
|
|||
"--enable-strip"
|
||||
]) ++ lib.optionals (!stdenv.hostPlatform.isi686) [
|
||||
# on i686-linux: --with-libclang-path is not available in this configuration
|
||||
"--with-libclang-path=${llvmPackages.libclang}/lib"
|
||||
"--with-libclang-path=${llvmPackages.libclang.lib}/lib"
|
||||
"--with-clang-path=${llvmPackages.clang}/bin/clang"
|
||||
] ++ lib.optional alsaSupport "--enable-alsa"
|
||||
++ lib.optional calendarSupport "--enable-calendar"
|
||||
|
|
|
@ -242,7 +242,7 @@ stdenv.mkDerivation rec {
|
|||
"--enable-strip"
|
||||
]) ++ lib.optionals (!stdenv.hostPlatform.isi686) [
|
||||
# on i686-linux: --with-libclang-path is not available in this configuration
|
||||
"--with-libclang-path=${llvmPackages.libclang}/lib"
|
||||
"--with-libclang-path=${llvmPackages.libclang.lib}/lib"
|
||||
"--with-clang-path=${llvmPackages.clang}/bin/clang"
|
||||
] ++ lib.optional alsaSupport "--enable-alsa"
|
||||
++ lib.optional calendarSupport "--enable-calendar"
|
||||
|
|
|
@ -69,8 +69,8 @@ stdenv.mkDerivation rec {
|
|||
--disable-R-framework
|
||||
--without-x
|
||||
OBJC="clang"
|
||||
CPPFLAGS="-isystem ${libcxx}/include/c++/v1"
|
||||
LDFLAGS="-L${libcxx}/lib"
|
||||
CPPFLAGS="-isystem ${lib.getDev libcxx}/include/c++/v1"
|
||||
LDFLAGS="-L${lib.getLib libcxx}/lib"
|
||||
'' + ''
|
||||
)
|
||||
echo >>etc/Renviron.in "TCLLIBPATH=${tk}/lib"
|
||||
|
|
|
@ -370,7 +370,7 @@ stdenv.mkDerivation {
|
|||
done
|
||||
''
|
||||
+ optionalString (libcxx.isLLVM or false) (''
|
||||
echo "-isystem ${libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem ${lib.getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isLinux ''
|
||||
echo "-lc++abi" >> $out/nix-support/libcxx-ldflags
|
||||
|
@ -404,7 +404,7 @@ stdenv.mkDerivation {
|
|||
echo "$ccLDFlags" >> $out/nix-support/cc-ldflags
|
||||
echo "$ccCFlags" >> $out/nix-support/cc-cflags
|
||||
'' + optionalString (targetPlatform.isDarwin && (libcxx != null) && (cc.isClang or false)) ''
|
||||
echo " -L${libcxx}/lib" >> $out/nix-support/cc-ldflags
|
||||
echo " -L${lib.getLib libcxx}/lib" >> $out/nix-support/cc-ldflags
|
||||
''
|
||||
|
||||
##
|
||||
|
|
|
@ -92,7 +92,7 @@ in
|
|||
nettle-sys = attrs: {
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ nettle clang ];
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
};
|
||||
|
||||
openssl = attrs: {
|
||||
|
|
|
@ -18,7 +18,7 @@ let
|
|||
inherit spirv-llvm-translator;
|
||||
};
|
||||
inherit (llvmPkgs) llvm;
|
||||
inherit (if buildWithPatches then opencl-clang else llvmPkgs) clang clang-unwrapped spirv-llvm-translator;
|
||||
inherit (if buildWithPatches then opencl-clang else llvmPkgs) clang libclang spirv-llvm-translator;
|
||||
inherit (lib) getVersion optional optionals versionOlder versions;
|
||||
in
|
||||
|
||||
|
@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
|
|||
ln -s ${clang}/bin/clang $out/
|
||||
ln -s clang $out/clang-${versions.major (getVersion clang)}
|
||||
ln -s ${opencl-clang}/lib/* $out/
|
||||
ln -s ${clang-unwrapped}/lib/clang/${getVersion clang}/include/opencl-c.h $out/
|
||||
ln -s ${lib.getLib libclang}/lib/clang/${getVersion clang}/include/opencl-c.h $out/
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
|
||||
{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
}:
|
||||
|
@ -18,28 +19,33 @@ let
|
|||
mv clang-tools-extra-* $sourceRoot/tools/extra
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 lld ]
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ lib.optional enableManpages python3.pkgs.sphinx
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = [ libxml2 llvm ];
|
||||
buildInputs = [ libxml2 libllvm ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_CXX_FLAGS=-std=c++14"
|
||||
"-DCLANGD_BUILD_XPC=OFF"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
"-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
|
||||
] ++ 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"
|
||||
];
|
||||
|
||||
patches = [
|
||||
./purity.patch
|
||||
# https://reviews.llvm.org/D51899
|
||||
./compiler-rt-baremetal.patch
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -56,12 +62,12 @@ let
|
|||
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
|
||||
'';
|
||||
|
||||
outputs = [ "out" "lib" "python" ];
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${llvm}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${llvm}/lib/LLVMgold.so $out/lib
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
@ -80,11 +86,14 @@ let
|
|||
fi
|
||||
mv $out/share/clang/*.py $python/share/clang
|
||||
rm $out/bin/c-index-test
|
||||
|
||||
mkdir -p $dev/bin
|
||||
cp bin/clang-tblgen $dev/bin
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isClang = true;
|
||||
inherit llvm;
|
||||
inherit libllvm;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -0,0 +1,248 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index dc1413f4b597..c173531e624f 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)
|
||||
@@ -417,7 +419,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"
|
||||
@@ -427,7 +429,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
|
||||
@@ -447,7 +449,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
|
||||
add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
|
||||
install(PROGRAMS utils/bash-autocomplete.sh
|
||||
- DESTINATION share/clang
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||||
COMPONENT bash-autocomplete)
|
||||
if(NOT LLVM_ENABLE_IDE)
|
||||
add_llvm_install_targets(install-bash-autocomplete
|
||||
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
|
||||
index 577cc11ab015..a4f4481d8442 100644
|
||||
--- a/cmake/modules/AddClang.cmake
|
||||
+++ b/cmake/modules/AddClang.cmake
|
||||
@@ -114,9 +114,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}
|
||||
@@ -160,7 +160,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)
|
||||
@@ -175,7 +175,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 85c3124234ad..64c48235d914 100644
|
||||
--- a/lib/Headers/CMakeLists.txt
|
||||
+++ b/lib/Headers/CMakeLists.txt
|
||||
@@ -191,7 +191,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-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-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 973655361f71..0181002e4e3b 100644
|
||||
--- a/tools/libclang/CMakeLists.txt
|
||||
+++ b/tools/libclang/CMakeLists.txt
|
||||
@@ -141,7 +141,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
|
||||
@@ -172,7 +172,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 28241245fcb7..d6b59f02fc2a 100644
|
||||
--- a/tools/scan-build/CMakeLists.txt
|
||||
+++ b/tools/scan-build/CMakeLists.txt
|
||||
@@ -42,7 +42,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
|
||||
install(PROGRAMS bin/${BinFile}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
@@ -56,7 +56,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
|
||||
install(PROGRAMS libexec/${LibexecFile}
|
||||
- DESTINATION libexec
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
@@ -84,7 +84,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
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
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
|
||||
index 22edb974bac7..9f140a9a4538 100644
|
||||
--- a/tools/scan-view/CMakeLists.txt
|
||||
+++ b/tools/scan-view/CMakeLists.txt
|
||||
@@ -22,7 +22,7 @@ if(CLANG_INSTALL_SCANVIEW)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
|
||||
install(PROGRAMS bin/${BinFile}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT scan-view)
|
||||
endforeach()
|
||||
|
||||
@@ -36,7 +36,7 @@ if(CLANG_INSTALL_SCANVIEW)
|
||||
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
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
|
||||
COMPONENT scan-view)
|
||||
endforeach()
|
||||
|
||||
diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
|
||||
index 62f2de0cb15c..6aa66825b6ec 100644
|
||||
--- a/utils/hmaptool/CMakeLists.txt
|
||||
+++ b/utils/hmaptool/CMakeLists.txt
|
||||
@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
|
||||
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
|
||||
install(PROGRAMS ${CLANG_HMAPTOOL}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT hmaptool)
|
||||
|
||||
add_custom_target(hmaptool ALL DEPENDS ${Depends})
|
|
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
|
|||
inherit version;
|
||||
src = fetch pname "1yjqjri753w0fzmxcyz687nvd97sbc9rsqrxzpq720na47hwh3fr";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm ];
|
||||
nativeBuildInputs = [ cmake python3 llvm.dev ];
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
|
@ -21,6 +21,7 @@ stdenv.mkDerivation rec {
|
|||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCOMPILER_RT_OS_DIR="
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
|
@ -54,6 +55,7 @@ stdenv.mkDerivation rec {
|
|||
patches = [
|
||||
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
./find-darwin-sdk-version.patch # don't test for macOS being >= 10.15
|
||||
./gnu-install-dirs.patch
|
||||
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
||||
|
@ -79,9 +81,7 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
postInstall = 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
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8d768a404f21..74551dc5a004 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 35a48c6af29c..e4300f256091 100644
|
||||
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -493,7 +493,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_INCLUDEDIR}
|
||||
COMPONENT ${component})
|
||||
add_dependencies(${component} ${target_name})
|
||||
|
||||
@@ -510,7 +510,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 9f501a61c4b6..f9a0d92dbca0 100644
|
||||
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
@@ -440,7 +440,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 b4b87aa53073..f1ae8668837c 100644
|
||||
--- a/cmake/base-config-ix.cmake
|
||||
+++ b/cmake/base-config-ix.cmake
|
||||
@@ -65,11 +65,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.
|
||||
@@ -97,7 +97,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 d47d7baeb118..507c8e5c713e 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -62,22 +62,22 @@ 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 fuzzer headers.
|
||||
install(FILES ${FUZZER_HEADERS}
|
||||
COMPONENT compiler-rt-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
|
||||
# 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)
|
||||
# Install profile headers.
|
||||
install(FILES ${PROFILE_HEADERS}
|
||||
COMPONENT compiler-rt-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile)
|
||||
|
||||
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 051215edbeb7..ecce1f52efb0 100644
|
||||
--- a/lib/dfsan/CMakeLists.txt
|
||||
+++ b/lib/dfsan/CMakeLists.txt
|
||||
@@ -56,4 +56,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})
|
|
@ -1,6 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildPackages
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
}:
|
||||
|
@ -18,31 +17,37 @@ let
|
|||
clang-tools-extra_src = fetch "clang-tools-extra" "06n1yp638rh24xdxv9v2df0qajxbjz4w59b7dd4ky36drwmpi4yh";
|
||||
|
||||
tools = lib.makeExtensible (tools: let
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
|
||||
mkExtraBuildCommands = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
|
||||
in {
|
||||
|
||||
llvm = callPackage ./llvm { };
|
||||
libllvm = callPackage ./llvm { };
|
||||
|
||||
clang-unwrapped = callPackage ./clang {
|
||||
inherit (tools) lld;
|
||||
# `llvm` historically had the binaries. But this migration
|
||||
# technique also impedes `lib.get*`. Perhaps we will revisit it.
|
||||
llvm = tools.libllvm.out;
|
||||
|
||||
libclang = callPackage ./clang {
|
||||
inherit clang-tools-extra_src;
|
||||
};
|
||||
|
||||
clang-unwrapped = tools.libclang.out;
|
||||
|
||||
# disabled until recommonmark supports sphinx 3
|
||||
#Llvm-manpages = lowPrio (tools.llvm.override {
|
||||
#Llvm-manpages = lowPrio (tools.libllvm.override {
|
||||
# enableManpages = true;
|
||||
# python3 = pkgs.python3; # don't use python-boot
|
||||
#});
|
||||
|
||||
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
||||
clang-manpages = lowPrio (tools.libclang.override {
|
||||
enableManpages = true;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
|
@ -53,8 +58,6 @@ let
|
|||
# python3 = pkgs.python3; # don't use python-boot
|
||||
# });
|
||||
|
||||
libclang = tools.clang-unwrapped.lib;
|
||||
|
||||
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
||||
|
||||
libstdcxxClang = wrapCCWith rec {
|
||||
|
|
|
@ -13,7 +13,11 @@ stdenv.mkDerivation {
|
|||
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
||||
'';
|
||||
|
||||
patches = lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
|
||||
|
||||
preConfigure = ''
|
||||
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 60564dc96c7b..77d832ad5a44 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 10.0.1)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -415,7 +417,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})
|
||||
@@ -423,10 +425,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 302da8a131b4..4c6ab463f564 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -244,7 +244,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
|
||||
)
|
||||
@@ -253,7 +253,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 120505fe18da..9b8456d8405a 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -341,21 +341,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
|
|
@ -8,6 +8,25 @@ stdenv.mkDerivation {
|
|||
|
||||
src = fetch "libcxxabi" "0yqs722y76cwvmfsq0lb917r9m3fci7bf5z3yzl71yz9n88ghzm9";
|
||||
|
||||
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 ${../../libcxx-0001-musl-hacks.patch}
|
||||
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./no-threads.patch
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
|
||||
|
||||
|
@ -21,20 +40,6 @@ stdenv.mkDerivation {
|
|||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
patches = [ ./no-threads.patch ];
|
||||
|
||||
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 ${../../libcxx-0001-musl-hacks.patch}
|
||||
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d $(ls -d llvm-*) -i ${./wasm.patch}
|
||||
'';
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
then ''
|
||||
for file in lib/*.dylib; do
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8f9572586b4a..bf0e41dfc751 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 10.0.1)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -214,17 +216,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.")
|
|
@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
|
|||
|
||||
src = fetch pname "09syx66idnm2pr46x2vmk0jn3iwdv0lkd04xy4zjbwmz3vn066bl";
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c033069ef1d0..e2846896eece 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})
|
|
@ -1,8 +1,9 @@
|
|||
{ lib, stdenv
|
||||
, buildLlvmTools
|
||||
, fetch
|
||||
, cmake
|
||||
, libxml2
|
||||
, llvm
|
||||
, libllvm
|
||||
, version
|
||||
}:
|
||||
|
||||
|
@ -12,15 +13,20 @@ stdenv.mkDerivation rec {
|
|||
|
||||
src = fetch pname "0ynzi35r4fckvp6842alpd43qr810j3728yfslc66fk2mbh4j52r";
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ llvm libxml2 ];
|
||||
buildInputs = [ libllvm libxml2 ];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
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"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
moveToOutput include "$dev"
|
||||
moveToOutput lib "$dev"
|
||||
'';
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
meta = {
|
||||
description = "The LLVM Linker";
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
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)
|
|
@ -7,8 +7,8 @@
|
|||
, which
|
||||
, libedit
|
||||
, libxml2
|
||||
, llvm
|
||||
, clang-unwrapped
|
||||
, libllvm
|
||||
, libclang
|
||||
, python3
|
||||
, version
|
||||
, darwin
|
||||
|
@ -22,19 +22,22 @@ stdenv.mkDerivation (rec {
|
|||
|
||||
src = fetch pname "051p5b04y6z3g730rmc2n2v71lipbw7k69riww3a6sl74myfiaq7";
|
||||
|
||||
patches = [ ./procfs.patch ];
|
||||
patches = [
|
||||
./procfs.patch
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 which swig lit ]
|
||||
++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake python3 which swig lit
|
||||
] ++ lib.optionals enableManpages [
|
||||
python3.pkgs.sphinx python3.pkgs.recommonmark
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
ncurses
|
||||
zlib
|
||||
libedit
|
||||
libxml2
|
||||
llvm
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
ncurses zlib libedit libxml2 libllvm
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
darwin.libobjc
|
||||
darwin.apple_sdk.libs.xpc
|
||||
darwin.apple_sdk.frameworks.Foundation
|
||||
|
@ -46,8 +49,9 @@ stdenv.mkDerivation (rec {
|
|||
hardeningDisable = [ "format" ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
|
||||
"-DLLVM_ENABLE_RTTI=OFF"
|
||||
"-DClang_DIR=${clang-unwrapped}/lib/cmake"
|
||||
"-DClang_DIR=${libclang.dev}/lib/cmake"
|
||||
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
|
||||
|
@ -57,33 +61,38 @@ stdenv.mkDerivation (rec {
|
|||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
] ++ 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;
|
||||
|
||||
postInstall = ''
|
||||
# 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/lldb-vscode $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 = with lib; {
|
||||
description = "A next-generation high-performance debugger";
|
||||
homepage = "https://lldb.llvm.org";
|
||||
license = licenses.ncsa;
|
||||
platforms = platforms.all;
|
||||
homepage = "https://lldb.llvm.org";
|
||||
license = licenses.ncsa;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
} // lib.optionalAttrs enableManpages {
|
||||
pname = "lldb-manpages";
|
||||
|
||||
buildPhase = ''
|
||||
make docs-lldb-man
|
||||
make docs-man
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [];
|
||||
|
||||
# manually install lldb man page
|
||||
installPhase = ''
|
||||
# manually install lldb man page
|
||||
mkdir -p $out/share/man/man1
|
||||
install docs/man/lldb.1 -t $out/share/man/man1/
|
||||
'';
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 573b8556989e..a12cc6f6ba77 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -17,6 +17,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)
|
||||
+
|
||||
project(lldb)
|
||||
include(LLDBStandalone)
|
||||
|
||||
diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
|
||||
index ecf0b66a41a3..6f2d97af7a11 100644
|
||||
--- a/cmake/modules/AddLLDB.cmake
|
||||
+++ b/cmake/modules/AddLLDB.cmake
|
||||
@@ -107,13 +107,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 4a15a343ee1d..c74bbb6878d7 100644
|
||||
--- a/cmake/modules/LLDBConfig.cmake
|
||||
+++ b/cmake/modules/LLDBConfig.cmake
|
||||
@@ -238,7 +238,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
|
||||
@@ -247,7 +247,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 aff75d7db334..98a527c5e761 100644
|
||||
--- a/tools/intel-features/CMakeLists.txt
|
||||
+++ b/tools/intel-features/CMakeLists.txt
|
||||
@@ -64,4 +64,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
|
||||
endif()
|
||||
|
||||
install(TARGETS lldbIntelFeatures
|
||||
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv
|
||||
, pkgsBuildBuild
|
||||
, fetch
|
||||
, cmake
|
||||
, python3
|
||||
|
@ -10,10 +11,10 @@
|
|||
, version
|
||||
, release_version
|
||||
, zlib
|
||||
, buildPackages
|
||||
, buildLlvmTools
|
||||
, debugVersion ? false
|
||||
, enableManpages ? false
|
||||
, enableSharedLibraries ? true
|
||||
, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
|
||||
, enablePFM ? !(stdenv.isDarwin
|
||||
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|
||||
|| stdenv.isAarch32 # broken for the armv7l builder
|
||||
|
@ -44,8 +45,7 @@ in stdenv.mkDerivation (rec {
|
|||
mv polly-* $sourceRoot/tools/polly
|
||||
'';
|
||||
|
||||
outputs = [ "out" "python" ]
|
||||
++ optional enableSharedLibraries "lib";
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||
|
@ -55,10 +55,14 @@ in stdenv.mkDerivation (rec {
|
|||
|
||||
propagatedBuildInputs = [ ncurses zlib ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
|
||||
|
||||
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/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
|
||||
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
|
||||
''
|
||||
# Patch llvm-config to return correct library path based on --link-{shared,static}.
|
||||
+ optionalString (enableSharedLibraries) ''
|
||||
|
@ -97,6 +101,7 @@ in stdenv.mkDerivation (rec {
|
|||
'';
|
||||
|
||||
cmakeFlags = with stdenv; [
|
||||
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
|
||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||
"-DLLVM_BUILD_TESTS=ON"
|
||||
|
@ -120,7 +125,20 @@ in stdenv.mkDerivation (rec {
|
|||
"-DCAN_TARGET_i386=false"
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"-DCMAKE_CROSSCOMPILING=True"
|
||||
"-DLLVM_TABLEGEN=${buildPackages.llvm_10}/bin/llvm-tblgen"
|
||||
"-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"
|
||||
];
|
||||
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
|
||||
)
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
|
@ -134,20 +152,19 @@ in stdenv.mkDerivation (rec {
|
|||
postInstall = ''
|
||||
mkdir -p $python/share
|
||||
mv $out/share/opt-viewer $python/share/opt-viewer
|
||||
''
|
||||
+ optionalString enableSharedLibraries ''
|
||||
moveToOutput "lib/libLLVM-*" "$lib"
|
||||
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
||||
''
|
||||
+ optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
||||
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) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
|
||||
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
|
||||
'';
|
||||
|
||||
doCheck = stdenv.isLinux && (!stdenv.isx86_32);
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
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 86de6f10686e..91f30891ccbe 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
|
|
@ -0,0 +1,416 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 0e85afa82c76..3e700d9c5fae 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -253,15 +253,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})
|
||||
@@ -527,9 +533,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
|
||||
@@ -993,7 +999,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"
|
||||
@@ -1005,7 +1011,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"
|
||||
@@ -1020,13 +1026,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 f5a1b0d6f238..a7387224d68f 100644
|
||||
--- a/cmake/modules/AddLLVM.cmake
|
||||
+++ b/cmake/modules/AddLLVM.cmake
|
||||
@@ -729,9 +729,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}
|
||||
@@ -934,7 +934,7 @@ function(process_llvm_pass_plugins)
|
||||
"set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
|
||||
install(FILES
|
||||
${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
|
||||
- DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
|
||||
+ DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
|
||||
COMPONENT cmake-exports)
|
||||
|
||||
set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
|
||||
@@ -1147,7 +1147,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)
|
||||
@@ -1713,7 +1713,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()
|
||||
@@ -1730,7 +1730,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)
|
||||
@@ -1753,7 +1753,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)
|
||||
@@ -1836,7 +1836,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()
|
||||
@@ -1958,9 +1959,9 @@ function(llvm_setup_rpath name)
|
||||
|
||||
if (APPLE)
|
||||
set(_install_name_dir INSTALL_NAME_DIR "@rpath")
|
||||
- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
|
||||
+ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${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 554046b20edf..4d1ad980641e 100644
|
||||
--- a/cmake/modules/AddOCaml.cmake
|
||||
+++ b/cmake/modules/AddOCaml.cmake
|
||||
@@ -144,9 +144,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 2bf654b60c44..450ee45d86e6 100644
|
||||
--- a/cmake/modules/AddSphinxTarget.cmake
|
||||
+++ b/cmake/modules/AddSphinxTarget.cmake
|
||||
@@ -78,7 +78,7 @@ function (add_sphinx_target builder project)
|
||||
endif()
|
||||
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 af757d6199a8..b0fb7e7705d1 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 a86ebb3a37bd..e720711e2b3c 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.
|
||||
@@ -516,8 +516,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
|
||||
@@ -548,13 +548,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
|
||||
@@ -740,9 +760,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/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt
|
||||
index 3206f90d0916..1822965fc35f 100644
|
||||
--- a/examples/Bye/CMakeLists.txt
|
||||
+++ b/examples/Bye/CMakeLists.txt
|
||||
@@ -9,5 +9,5 @@ add_llvm_pass_plugin(Bye
|
||||
BUILDTREE_ONLY
|
||||
)
|
||||
|
||||
-install(TARGETS ${name} RUNTIME DESTINATION examples)
|
||||
+install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
|
||||
set_target_properties(${name} PROPERTIES FOLDER "Examples")
|
||||
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 63cef75368b7..6295478b1f3d 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 fb12e29a36a8..dbb6c2b90332 100644
|
||||
--- a/tools/llvm-config/llvm-config.cpp
|
||||
+++ b/tools/llvm-config/llvm-config.cpp
|
||||
@@ -358,12 +358,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 ead73ec13a8f..250362021f17 100644
|
||||
--- a/tools/opt-viewer/CMakeLists.txt
|
||||
+++ b/tools/opt-viewer/CMakeLists.txt
|
||||
@@ -8,7 +8,7 @@ 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)
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
|
||||
{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
}:
|
||||
|
@ -19,26 +20,31 @@ let
|
|||
mv clang-tools-extra-* $sourceRoot/tools/extra
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 lld ]
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ lib.optional enableManpages python3.pkgs.sphinx
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = [ libxml2 llvm ];
|
||||
buildInputs = [ libxml2 libllvm ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_CXX_FLAGS=-std=c++14"
|
||||
"-DCLANGD_BUILD_XPC=OFF"
|
||||
"-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
|
||||
] ++ 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"
|
||||
];
|
||||
|
||||
patches = [
|
||||
./purity.patch
|
||||
# https://reviews.llvm.org/D51899
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -55,12 +61,12 @@ let
|
|||
--replace "NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB" FALSE
|
||||
'';
|
||||
|
||||
outputs = [ "out" "lib" "python" ];
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${llvm}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${llvm}/lib/LLVMgold.so $out/lib
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
@ -79,11 +85,14 @@ let
|
|||
fi
|
||||
mv $out/share/clang/*.py $python/share/clang
|
||||
rm $out/bin/c-index-test
|
||||
|
||||
mkdir -p $dev/bin
|
||||
cp bin/clang-tblgen $dev/bin
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isClang = true;
|
||||
inherit llvm;
|
||||
inherit libllvm;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -0,0 +1,235 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index bb4b801f01c8..77a8b43b22c8 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)
|
||||
+
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
set(CMAKE_CXX_EXTENSIONS NO)
|
||||
@@ -447,7 +449,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"
|
||||
@@ -457,7 +459,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
|
||||
@@ -477,7 +479,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
|
||||
add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
|
||||
install(PROGRAMS utils/bash-autocomplete.sh
|
||||
- DESTINATION share/clang
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||||
COMPONENT bash-autocomplete)
|
||||
if(NOT LLVM_ENABLE_IDE)
|
||||
add_llvm_install_targets(install-bash-autocomplete
|
||||
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
|
||||
index 704278a0e93b..d25c8d325c71 100644
|
||||
--- a/cmake/modules/AddClang.cmake
|
||||
+++ b/cmake/modules/AddClang.cmake
|
||||
@@ -123,9 +123,9 @@ macro(add_clang_library name)
|
||||
install(TARGETS ${lib}
|
||||
COMPONENT ${lib}
|
||||
${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-${lib}
|
||||
@@ -170,7 +170,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)
|
||||
@@ -185,7 +185,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 0692fe75a441..6f201e7207d0 100644
|
||||
--- a/lib/Headers/CMakeLists.txt
|
||||
+++ b/lib/Headers/CMakeLists.txt
|
||||
@@ -208,7 +208,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-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-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/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
|
||||
index 5cd9ac5cddc1..a197676fedbd 100644
|
||||
--- a/tools/libclang/CMakeLists.txt
|
||||
+++ b/tools/libclang/CMakeLists.txt
|
||||
@@ -165,7 +165,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
|
||||
@@ -196,7 +196,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 ec0702d76f18..d25d982f51da 100644
|
||||
--- a/tools/scan-build/CMakeLists.txt
|
||||
+++ b/tools/scan-build/CMakeLists.txt
|
||||
@@ -47,7 +47,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
|
||||
install(PROGRAMS bin/${BinFile}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
@@ -61,7 +61,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
|
||||
install(PROGRAMS libexec/${LibexecFile}
|
||||
- DESTINATION libexec
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
@@ -89,7 +89,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
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
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
|
||||
index 22edb974bac7..9f140a9a4538 100644
|
||||
--- a/tools/scan-view/CMakeLists.txt
|
||||
+++ b/tools/scan-view/CMakeLists.txt
|
||||
@@ -22,7 +22,7 @@ if(CLANG_INSTALL_SCANVIEW)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
|
||||
install(PROGRAMS bin/${BinFile}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT scan-view)
|
||||
endforeach()
|
||||
|
||||
@@ -36,7 +36,7 @@ if(CLANG_INSTALL_SCANVIEW)
|
||||
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
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
|
||||
COMPONENT scan-view)
|
||||
endforeach()
|
||||
|
||||
diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
|
||||
index 62f2de0cb15c..6aa66825b6ec 100644
|
||||
--- a/utils/hmaptool/CMakeLists.txt
|
||||
+++ b/utils/hmaptool/CMakeLists.txt
|
||||
@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
|
||||
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
|
||||
install(PROGRAMS ${CLANG_HMAPTOOL}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT hmaptool)
|
||||
|
||||
add_custom_target(hmaptool ALL DEPENDS ${Depends})
|
|
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
|
|||
inherit version;
|
||||
src = fetch pname "0x1j8ngf1zj63wlnns9vlibafq48qcm72p4jpaxkmkb4qw0grwfy";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm ];
|
||||
nativeBuildInputs = [ cmake python3 llvm.dev ];
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
|
@ -21,13 +21,10 @@ stdenv.mkDerivation rec {
|
|||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCOMPILER_RT_OS_DIR="
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
] ++ lib.optionals (stdenv.isDarwin) [
|
||||
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
|
||||
"-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
"-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
|
||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
|
@ -45,6 +42,10 @@ stdenv.mkDerivation rec {
|
|||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
"-DCOMPILER_RT_OS_DIR=baremetal"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
|
||||
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
|
||||
"-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
"-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
@ -52,6 +53,10 @@ stdenv.mkDerivation rec {
|
|||
patches = [
|
||||
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
|
||||
./gnu-install-dirs.patch
|
||||
# ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
|
||||
# extra `/`.
|
||||
./normalize-var.patch
|
||||
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
||||
|
@ -79,9 +84,7 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
postInstall = 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
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index fa62814b635d..6328614d829e 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 7c127a93dfa7..6a95a65b70a7 100644
|
||||
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -524,7 +524,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_INCLUDEDIR}
|
||||
COMPONENT ${component})
|
||||
add_dependencies(${component} ${target_name})
|
||||
|
||||
@@ -541,7 +541,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 be8d7e733c7a..ab256bdff26c 100644
|
||||
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
@@ -498,7 +498,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 99b9f0e4af44..c5183ffa746e 100644
|
||||
--- a/cmake/Modules/CompilerRTUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTUtils.cmake
|
||||
@@ -375,7 +375,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 964dd598f102..2acaab87d349 100644
|
||||
--- a/cmake/base-config-ix.cmake
|
||||
+++ b/cmake/base-config-ix.cmake
|
||||
@@ -66,11 +66,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.
|
||||
@@ -98,7 +98,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 d47d7baeb118..507c8e5c713e 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -62,22 +62,22 @@ 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 fuzzer headers.
|
||||
install(FILES ${FUZZER_HEADERS}
|
||||
COMPONENT compiler-rt-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
|
||||
# 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)
|
||||
# Install profile headers.
|
||||
install(FILES ${PROFILE_HEADERS}
|
||||
COMPONENT compiler-rt-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile)
|
||||
|
||||
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 051215edbeb7..ecce1f52efb0 100644
|
||||
--- a/lib/dfsan/CMakeLists.txt
|
||||
+++ b/lib/dfsan/CMakeLists.txt
|
||||
@@ -56,4 +56,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})
|
|
@ -0,0 +1,16 @@
|
|||
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
|
||||
index c5183ffa746e..e4e4a007335d 100644
|
||||
--- a/cmake/Modules/CompilerRTUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTUtils.cmake
|
||||
@@ -299,8 +299,9 @@ macro(load_llvm_config)
|
||||
# Get some LLVM variables from LLVMConfig.
|
||||
include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
|
||||
|
||||
- set(LLVM_LIBRARY_OUTPUT_INTDIR
|
||||
- ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
|
||||
+ get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR
|
||||
+ ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}
|
||||
+ REALPATH)
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildPackages
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
}:
|
||||
|
@ -20,31 +19,37 @@ let
|
|||
clang-tools-extra_src = fetch "clang-tools-extra" "18n1w1hkv931xzq02b34wglbv6zd6sd0r5kb8piwvag7klj7qw3n";
|
||||
|
||||
tools = lib.makeExtensible (tools: let
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
|
||||
mkExtraBuildCommands = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
|
||||
in {
|
||||
|
||||
llvm = callPackage ./llvm { };
|
||||
libllvm = callPackage ./llvm { };
|
||||
|
||||
clang-unwrapped = callPackage ./clang {
|
||||
inherit (tools) lld;
|
||||
# `llvm` historically had the binaries. But this migration
|
||||
# technique also impedes `lib.get*`. Perhaps we will revisit it.
|
||||
llvm = tools.libllvm.out;
|
||||
|
||||
libclang = callPackage ./clang {
|
||||
inherit clang-tools-extra_src;
|
||||
};
|
||||
|
||||
clang-unwrapped = tools.libclang.out;
|
||||
|
||||
# disabled until recommonmark supports sphinx 3
|
||||
#Llvm-manpages = lowPrio (tools.llvm.override {
|
||||
#Llvm-manpages = lowPrio (tools.libllvm.override {
|
||||
# enableManpages = true;
|
||||
# python3 = pkgs.python3; # don't use python-boot
|
||||
#});
|
||||
|
||||
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
||||
clang-manpages = lowPrio (tools.libclang.override {
|
||||
enableManpages = true;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
|
@ -55,8 +60,6 @@ let
|
|||
# python3 = pkgs.python3; # don't use python-boot
|
||||
# });
|
||||
|
||||
libclang = tools.clang-unwrapped.lib;
|
||||
|
||||
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
||||
|
||||
libstdcxxClang = wrapCCWith rec {
|
||||
|
|
|
@ -15,6 +15,8 @@ stdenv.mkDerivation {
|
|||
mv llvm-* llvm
|
||||
'';
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
# Backported from LLVM 12, avoids clashes with commonly used "block.h" header.
|
||||
|
@ -22,6 +24,7 @@ stdenv.mkDerivation {
|
|||
sha256 = "sha256-aWa66ogmPkG0xHzSfcpD0qZyZQcNKwLV44js4eiun78=";
|
||||
stripLen = 1;
|
||||
})
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 910d04b54b6d..80ef692d83eb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -31,6 +31,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 11.1.0)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -418,7 +420,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})
|
||||
@@ -426,11 +428,11 @@ 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_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
- 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 c5aa26739e36..8841c4a5252d 100644
|
||||
--- a/cmake/Modules/HandleLibCXXABI.cmake
|
||||
+++ b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
@@ -63,7 +63,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 be8141c98166..93847e5758cc 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -257,7 +257,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
|
||||
)
|
||||
@@ -265,7 +265,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
||||
|
||||
# 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 2001c09761d9..5bd11ea6b400 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -344,21 +344,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 cxx_experimental
|
||||
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
|
|
@ -8,20 +8,7 @@ stdenv.mkDerivation {
|
|||
|
||||
src = fetch "libcxxabi" "1azcf31mxw59hb1x17xncnm3dyw90ylh8rqx462lvypqh3nr6c8l";
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !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"
|
||||
];
|
||||
|
||||
patches = [ ./no-threads.patch ];
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile ${libcxx.src}
|
||||
|
@ -36,6 +23,24 @@ stdenv.mkDerivation {
|
|||
patch -p1 -d llvm -i ${./wasm.patch}
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./no-threads.patch
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !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"
|
||||
];
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
then ''
|
||||
for file in lib/*.dylib; do
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 36c6b2249e2b..a93c13ccaed9 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -24,6 +24,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 11.1.0)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -160,17 +162,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.")
|
|
@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
|
|||
|
||||
src = fetch pname "1vpqs2c358v8fbr1r8jmzkfqk12jllimjcfmgxga127ksq9b37nj";
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e44a103648f9..aaf1f9555d7f 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 LANGUAGES C CXX ASM)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
# Rely on llvm-config.
|
||||
set(CONFIG_OUTPUT)
|
||||
if(NOT LLVM_CONFIG_PATH)
|
||||
@@ -192,17 +194,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})
|
|
@ -1,8 +1,9 @@
|
|||
{ lib, stdenv
|
||||
, buildLlvmTools
|
||||
, fetch
|
||||
, cmake
|
||||
, libxml2
|
||||
, llvm
|
||||
, libllvm
|
||||
, version
|
||||
}:
|
||||
|
||||
|
@ -12,15 +13,20 @@ stdenv.mkDerivation rec {
|
|||
|
||||
src = fetch pname "1kk61i7z5bi9i11rzsd2b388d42if1c7a45zkaa4mk0yps67hyh1";
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ llvm libxml2 ];
|
||||
buildInputs = [ libllvm libxml2 ];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
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"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
moveToOutput include "$dev"
|
||||
moveToOutput lib "$dev"
|
||||
'';
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
meta = {
|
||||
description = "The LLVM Linker";
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 040bb2c8f6d7..f765f0096d97 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")
|
||||
@@ -205,7 +207,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 23df41312403..d62372c88de7 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 e6f72fcd3488..d903609e6e4f 100644
|
||||
--- a/tools/lld/CMakeLists.txt
|
||||
+++ b/tools/lld/CMakeLists.txt
|
||||
@@ -21,7 +21,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)
|
|
@ -7,8 +7,8 @@
|
|||
, which
|
||||
, libedit
|
||||
, libxml2
|
||||
, llvm
|
||||
, clang-unwrapped
|
||||
, libllvm
|
||||
, libclang
|
||||
, python3
|
||||
, version
|
||||
, darwin
|
||||
|
@ -22,19 +22,22 @@ stdenv.mkDerivation (rec {
|
|||
|
||||
src = fetch pname "1vlyg015dyng43xqb8cg2l6r9ix8klibxsajazbfnckdnh54hwxj";
|
||||
|
||||
patches = [ ./procfs.patch ];
|
||||
patches = [
|
||||
./procfs.patch
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 which swig lit ]
|
||||
++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake python3 which swig lit
|
||||
] ++ lib.optionals enableManpages [
|
||||
python3.pkgs.sphinx python3.pkgs.recommonmark
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
ncurses
|
||||
zlib
|
||||
libedit
|
||||
libxml2
|
||||
llvm
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
ncurses zlib libedit libxml2 libllvm
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
darwin.libobjc
|
||||
darwin.apple_sdk.libs.xpc
|
||||
darwin.apple_sdk.frameworks.Foundation
|
||||
|
@ -46,8 +49,9 @@ stdenv.mkDerivation (rec {
|
|||
hardeningDisable = [ "format" ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
|
||||
"-DLLVM_ENABLE_RTTI=OFF"
|
||||
"-DClang_DIR=${clang-unwrapped}/lib/cmake"
|
||||
"-DClang_DIR=${libclang.dev}/lib/cmake"
|
||||
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
|
||||
|
@ -57,33 +61,38 @@ stdenv.mkDerivation (rec {
|
|||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
] ++ 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;
|
||||
|
||||
postInstall = ''
|
||||
# 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/lldb-vscode $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 = with lib; {
|
||||
description = "A next-generation high-performance debugger";
|
||||
homepage = "https://lldb.llvm.org";
|
||||
license = licenses.ncsa;
|
||||
platforms = platforms.all;
|
||||
homepage = "https://lldb.llvm.org";
|
||||
license = licenses.ncsa;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
} // lib.optionalAttrs enableManpages {
|
||||
pname = "lldb-manpages";
|
||||
|
||||
buildPhase = ''
|
||||
make docs-lldb-man
|
||||
make docs-man
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [];
|
||||
|
||||
# manually install lldb man page
|
||||
installPhase = ''
|
||||
# manually install lldb man page
|
||||
mkdir -p $out/share/man/man1
|
||||
install docs/man/lldb.1 -t $out/share/man/man1/
|
||||
'';
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index bf748020ea40..34103d2b5e1a 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -17,6 +17,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)
|
||||
+
|
||||
project(lldb)
|
||||
include(LLDBStandalone)
|
||||
|
||||
diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
|
||||
index 4ed5c647c5d2..89f96e710d55 100644
|
||||
--- a/cmake/modules/AddLLDB.cmake
|
||||
+++ b/cmake/modules/AddLLDB.cmake
|
||||
@@ -107,13 +107,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 8465cfe3b7b7..01b7eae136e2 100644
|
||||
--- a/cmake/modules/LLDBConfig.cmake
|
||||
+++ b/cmake/modules/LLDBConfig.cmake
|
||||
@@ -245,7 +245,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
|
||||
@@ -254,7 +254,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 efba2f74904f..e08413b1dbb1 100644
|
||||
--- a/tools/intel-features/CMakeLists.txt
|
||||
+++ b/tools/intel-features/CMakeLists.txt
|
||||
@@ -65,4 +65,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
|
||||
endif()
|
||||
|
||||
install(TARGETS lldbIntelFeatures
|
||||
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv
|
||||
, pkgsBuildBuild
|
||||
, fetch
|
||||
, cmake
|
||||
, python3
|
||||
|
@ -10,15 +11,15 @@
|
|||
, version
|
||||
, release_version
|
||||
, zlib
|
||||
, buildPackages
|
||||
, buildLlvmTools
|
||||
, debugVersion ? false
|
||||
, enableManpages ? false
|
||||
, enableSharedLibraries ? true
|
||||
, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
|
||||
, enablePFM ? !(stdenv.isDarwin
|
||||
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|
||||
|| stdenv.isAarch32 # broken for the armv7l builder
|
||||
)
|
||||
, enablePolly ? false
|
||||
, enablePolly ? false # TODO should be on by default
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -44,8 +45,7 @@ in stdenv.mkDerivation (rec {
|
|||
mv polly-* $sourceRoot/tools/polly
|
||||
'';
|
||||
|
||||
outputs = [ "out" "python" ]
|
||||
++ optional enableSharedLibraries "lib";
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||
|
@ -55,10 +55,14 @@ in stdenv.mkDerivation (rec {
|
|||
|
||||
propagatedBuildInputs = [ ncurses zlib ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
|
||||
|
||||
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/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
|
||||
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
|
||||
''
|
||||
# Patch llvm-config to return correct library path based on --link-{shared,static}.
|
||||
+ optionalString (enableSharedLibraries) ''
|
||||
|
@ -99,6 +103,7 @@ in stdenv.mkDerivation (rec {
|
|||
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
|
||||
|
||||
cmakeFlags = with stdenv; [
|
||||
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
|
||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||
"-DLLVM_BUILD_TESTS=ON"
|
||||
|
@ -122,7 +127,20 @@ in stdenv.mkDerivation (rec {
|
|||
"-DCAN_TARGET_i386=false"
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"-DCMAKE_CROSSCOMPILING=True"
|
||||
"-DLLVM_TABLEGEN=${buildPackages.llvm_11}/bin/llvm-tblgen"
|
||||
"-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"
|
||||
];
|
||||
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
|
||||
)
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
|
@ -136,20 +154,19 @@ in stdenv.mkDerivation (rec {
|
|||
postInstall = ''
|
||||
mkdir -p $python/share
|
||||
mv $out/share/opt-viewer $python/share/opt-viewer
|
||||
''
|
||||
+ optionalString enableSharedLibraries ''
|
||||
moveToOutput "lib/libLLVM-*" "$lib"
|
||||
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
||||
''
|
||||
+ optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
||||
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) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
|
||||
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
|
||||
'';
|
||||
|
||||
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
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 86de6f10686e..91f30891ccbe 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 1039079cb49c..28b499ae1e9e 100644
|
||||
--- a/tools/polly/lib/External/CMakeLists.txt
|
||||
+++ b/tools/polly/lib/External/CMakeLists.txt
|
||||
@@ -275,7 +275,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
|
|
@ -0,0 +1,417 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 247ad36d3845..815e2c4ba955 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -269,15 +269,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})
|
||||
@@ -559,9 +565,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
|
||||
@@ -1107,7 +1113,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"
|
||||
@@ -1119,7 +1125,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"
|
||||
@@ -1134,13 +1140,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 b74adc11ade9..a5aa258cde30 100644
|
||||
--- a/cmake/modules/AddLLVM.cmake
|
||||
+++ b/cmake/modules/AddLLVM.cmake
|
||||
@@ -766,9 +766,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}
|
||||
@@ -981,7 +981,7 @@ function(process_llvm_pass_plugins)
|
||||
"set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
|
||||
install(FILES
|
||||
${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
|
||||
- DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
|
||||
+ DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
|
||||
COMPONENT cmake-exports)
|
||||
|
||||
set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
|
||||
@@ -1201,7 +1201,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)
|
||||
@@ -1819,7 +1819,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()
|
||||
@@ -1836,7 +1836,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)
|
||||
@@ -1859,7 +1859,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)
|
||||
@@ -1942,7 +1942,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()
|
||||
@@ -2064,9 +2065,9 @@ function(llvm_setup_rpath name)
|
||||
|
||||
if (APPLE)
|
||||
set(_install_name_dir INSTALL_NAME_DIR "@rpath")
|
||||
- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
|
||||
+ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${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 554046b20edf..4d1ad980641e 100644
|
||||
--- a/cmake/modules/AddOCaml.cmake
|
||||
+++ b/cmake/modules/AddOCaml.cmake
|
||||
@@ -144,9 +144,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 b5babb30abcf..190b1222a9f9 100644
|
||||
--- a/cmake/modules/AddSphinxTarget.cmake
|
||||
+++ b/cmake/modules/AddSphinxTarget.cmake
|
||||
@@ -84,7 +84,7 @@ function (add_sphinx_target builder project)
|
||||
endif()
|
||||
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 4b8879f65fe4..f01920bcc60f 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.
|
||||
@@ -108,13 +108,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}")
|
||||
|
||||
# Generate a default location for lit
|
||||
if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
|
||||
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 1f908d3e95b1..1315e0aa40e1 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.
|
||||
@@ -516,8 +516,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
|
||||
@@ -548,13 +548,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
|
||||
@@ -752,9 +772,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/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt
|
||||
index bb96edb4b4bf..678c22fb43c8 100644
|
||||
--- a/examples/Bye/CMakeLists.txt
|
||||
+++ b/examples/Bye/CMakeLists.txt
|
||||
@@ -14,6 +14,6 @@ if (NOT WIN32)
|
||||
BUILDTREE_ONLY
|
||||
)
|
||||
|
||||
- install(TARGETS ${name} RUNTIME DESTINATION examples)
|
||||
+ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
|
||||
set_target_properties(${name} PROPERTIES FOLDER "Examples")
|
||||
endif()
|
||||
diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
|
||||
index b46319f24fc8..2feabd1954e4 100644
|
||||
--- a/include/llvm/CMakeLists.txt
|
||||
+++ b/include/llvm/CMakeLists.txt
|
||||
@@ -5,5 +5,5 @@ add_subdirectory(Frontend)
|
||||
# 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 63cef75368b7..6295478b1f3d 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 7e74b7c90816..f185e9283f83 100644
|
||||
--- a/tools/llvm-config/llvm-config.cpp
|
||||
+++ b/tools/llvm-config/llvm-config.cpp
|
||||
@@ -358,12 +358,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 = std::string(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 2963f97cad88..69d66c9c9ca1 100644
|
||||
--- a/tools/lto/CMakeLists.txt
|
||||
+++ b/tools/lto/CMakeLists.txt
|
||||
@@ -25,7 +25,7 @@ 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 ead73ec13a8f..250362021f17 100644
|
||||
--- a/tools/opt-viewer/CMakeLists.txt
|
||||
+++ b/tools/opt-viewer/CMakeLists.txt
|
||||
@@ -8,7 +8,7 @@ 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)
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3, lld
|
||||
{ lib, stdenv, llvm_meta, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
}:
|
||||
|
@ -18,26 +19,31 @@ let
|
|||
unpackFile ${clang-tools-extra_src}
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 lld ]
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ lib.optional enableManpages python3.pkgs.sphinx
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = [ libxml2 llvm ];
|
||||
buildInputs = [ libxml2 libllvm ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_CXX_FLAGS=-std=c++14"
|
||||
"-DCLANGD_BUILD_XPC=OFF"
|
||||
"-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
|
||||
] ++ 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"
|
||||
];
|
||||
|
||||
patches = [
|
||||
./purity.patch
|
||||
# https://reviews.llvm.org/D51899
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -51,12 +57,12 @@ let
|
|||
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||
'';
|
||||
|
||||
outputs = [ "out" "lib" "python" ];
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${llvm}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${llvm}/lib/LLVMgold.so $out/lib
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
@ -75,11 +81,14 @@ let
|
|||
fi
|
||||
mv $out/share/clang/*.py $python/share/clang
|
||||
rm $out/bin/c-index-test
|
||||
|
||||
mkdir -p $dev/bin
|
||||
cp bin/clang-tblgen $dev/bin
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isClang = true;
|
||||
inherit llvm;
|
||||
inherit libllvm;
|
||||
};
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
|
|
@ -0,0 +1,235 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 9e74014134a0..976e6a1757fd 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.13.4)
|
||||
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
|
||||
project(Clang)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
set(CMAKE_CXX_EXTENSIONS NO)
|
||||
@@ -416,7 +418,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"
|
||||
@@ -425,7 +427,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
|
||||
@@ -445,7 +447,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
|
||||
add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh)
|
||||
install(PROGRAMS utils/bash-autocomplete.sh
|
||||
- DESTINATION share/clang
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/clang
|
||||
COMPONENT bash-autocomplete)
|
||||
if(NOT LLVM_ENABLE_IDE)
|
||||
add_llvm_install_targets(install-bash-autocomplete
|
||||
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
|
||||
index 704278a0e93b..d25c8d325c71 100644
|
||||
--- a/cmake/modules/AddClang.cmake
|
||||
+++ b/cmake/modules/AddClang.cmake
|
||||
@@ -123,9 +123,9 @@ macro(add_clang_library name)
|
||||
install(TARGETS ${lib}
|
||||
COMPONENT ${lib}
|
||||
${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-${lib}
|
||||
@@ -170,7 +170,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)
|
||||
@@ -185,7 +185,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 b2c0ce8dd4a0..19e5443d8c25 100644
|
||||
--- a/lib/Headers/CMakeLists.txt
|
||||
+++ b/lib/Headers/CMakeLists.txt
|
||||
@@ -215,7 +215,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-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-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/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
|
||||
index 51ff2e7e1565..1ed5f8a079a1 100644
|
||||
--- a/tools/libclang/CMakeLists.txt
|
||||
+++ b/tools/libclang/CMakeLists.txt
|
||||
@@ -166,7 +166,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
|
||||
@@ -196,7 +196,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 ec0702d76f18..d25d982f51da 100644
|
||||
--- a/tools/scan-build/CMakeLists.txt
|
||||
+++ b/tools/scan-build/CMakeLists.txt
|
||||
@@ -47,7 +47,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
|
||||
install(PROGRAMS bin/${BinFile}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
@@ -61,7 +61,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
|
||||
install(PROGRAMS libexec/${LibexecFile}
|
||||
- DESTINATION libexec
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
@@ -89,7 +89,7 @@ if(CLANG_INSTALL_SCANBUILD)
|
||||
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
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-build
|
||||
COMPONENT scan-build)
|
||||
endforeach()
|
||||
|
||||
diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
|
||||
index dd3d33439299..fea19c12ce70 100644
|
||||
--- a/tools/scan-view/CMakeLists.txt
|
||||
+++ b/tools/scan-view/CMakeLists.txt
|
||||
@@ -19,7 +19,7 @@ if(CLANG_INSTALL_SCANVIEW)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
|
||||
install(PROGRAMS bin/${BinFile}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT scan-view)
|
||||
endforeach()
|
||||
|
||||
@@ -33,7 +33,7 @@ if(CLANG_INSTALL_SCANVIEW)
|
||||
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
|
||||
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/scan-view
|
||||
COMPONENT scan-view)
|
||||
endforeach()
|
||||
|
||||
diff --git a/utils/hmaptool/CMakeLists.txt b/utils/hmaptool/CMakeLists.txt
|
||||
index 62f2de0cb15c..6aa66825b6ec 100644
|
||||
--- a/utils/hmaptool/CMakeLists.txt
|
||||
+++ b/utils/hmaptool/CMakeLists.txt
|
||||
@@ -10,7 +10,7 @@ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HM
|
||||
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL})
|
||||
install(PROGRAMS ${CLANG_HMAPTOOL}
|
||||
- DESTINATION bin
|
||||
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT hmaptool)
|
||||
|
||||
add_custom_target(hmaptool ALL DEPENDS ${Depends})
|
|
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
|
|||
inherit version;
|
||||
src = fetch pname "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm ];
|
||||
nativeBuildInputs = [ cmake python3 llvm.dev ];
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
|
@ -21,12 +21,10 @@ stdenv.mkDerivation rec {
|
|||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCOMPILER_RT_OS_DIR="
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
] ++ lib.optionals (stdenv.isDarwin) [
|
||||
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
|
||||
"-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}"
|
||||
] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
|
||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
|
@ -44,15 +42,23 @@ stdenv.mkDerivation rec {
|
|||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
"-DCOMPILER_RT_OS_DIR=baremetal"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
|
||||
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
|
||||
"-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
"-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
./compiler-rt-X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
|
||||
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
|
||||
./gnu-install-dirs.patch
|
||||
# ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
|
||||
# extra `/`.
|
||||
./normalize-var.patch
|
||||
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./compiler-rt-armv7l.patch;
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
|
@ -78,9 +84,7 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
postInstall = 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
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b44ad2c2118e..d42f5664d448 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.13.4)
|
||||
# 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 361538a58e47..f0d8d9ab80f1 100644
|
||||
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -495,7 +495,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_INCLUDEDIR}
|
||||
COMPONENT ${component})
|
||||
add_dependencies(${component} ${target_name})
|
||||
|
||||
@@ -512,7 +512,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 456a8dcda59f..7a09e74c7c79 100644
|
||||
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
@@ -508,7 +508,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 f61d487e93a0..f1f46fb9599c 100644
|
||||
--- a/cmake/Modules/CompilerRTUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTUtils.cmake
|
||||
@@ -378,7 +378,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 1edab43e7c0d..1aac6b73ff82 100644
|
||||
--- a/cmake/base-config-ix.cmake
|
||||
+++ b/cmake/base-config-ix.cmake
|
||||
@@ -65,11 +65,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.
|
||||
@@ -97,7 +97,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 b00e8caa1ddd..0fe64e4862c9 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -69,22 +69,22 @@ 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 fuzzer headers.
|
||||
install(FILES ${FUZZER_HEADERS}
|
||||
COMPONENT compiler-rt-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/fuzzer)
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/fuzzer)
|
||||
# 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)
|
||||
# Install profile headers.
|
||||
install(FILES ${PROFILE_HEADERS}
|
||||
COMPONENT compiler-rt-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION ${COMPILER_RT_INSTALL_PATH}/include/profile)
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/profile)
|
||||
|
||||
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 a29de8deff1b..d39ff01613d2 100644
|
||||
--- a/lib/dfsan/CMakeLists.txt
|
||||
+++ b/lib/dfsan/CMakeLists.txt
|
||||
@@ -57,4 +57,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})
|
|
@ -0,0 +1,16 @@
|
|||
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
|
||||
index f1f46fb9599c..6f19e69507ba 100644
|
||||
--- a/cmake/Modules/CompilerRTUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTUtils.cmake
|
||||
@@ -302,8 +302,9 @@ macro(load_llvm_config)
|
||||
# Get some LLVM variables from LLVMConfig.
|
||||
include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
|
||||
|
||||
- set(LLVM_LIBRARY_OUTPUT_INTDIR
|
||||
- ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
|
||||
+ get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR
|
||||
+ ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}
|
||||
+ REALPATH)
|
||||
endif()
|
||||
endmacro()
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildPackages
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
, darwin
|
||||
|
@ -27,11 +26,11 @@ let
|
|||
};
|
||||
|
||||
tools = lib.makeExtensible (tools: let
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
|
||||
mkExtraBuildCommands = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
|
@ -39,22 +38,27 @@ let
|
|||
|
||||
in {
|
||||
|
||||
llvm = callPackage ./llvm {
|
||||
libllvm = callPackage ./llvm {
|
||||
inherit llvm_meta;
|
||||
};
|
||||
|
||||
clang-unwrapped = callPackage ./clang {
|
||||
inherit (tools) lld;
|
||||
# `llvm` historically had the binaries. But this migration
|
||||
# technique also impedes `lib.get*`. Perhaps we will revisit it.
|
||||
llvm = tools.libllvm.out;
|
||||
|
||||
libclang = callPackage ./clang {
|
||||
inherit clang-tools-extra_src llvm_meta;
|
||||
};
|
||||
|
||||
clang-unwrapped = tools.libclang.out;
|
||||
|
||||
# disabled until recommonmark supports sphinx 3
|
||||
#Llvm-manpages = lowPrio (tools.llvm.override {
|
||||
#Llvm-manpages = lowPrio (tools.libllvm.override {
|
||||
# enableManpages = true;
|
||||
# python3 = pkgs.python3; # don't use python-boot
|
||||
#});
|
||||
|
||||
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
||||
clang-manpages = lowPrio (tools.libclang.override {
|
||||
enableManpages = true;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
|
@ -65,8 +69,6 @@ let
|
|||
# python3 = pkgs.python3; # don't use python-boot
|
||||
# });
|
||||
|
||||
libclang = tools.clang-unwrapped.lib;
|
||||
|
||||
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
||||
|
||||
libstdcxxClang = wrapCCWith rec {
|
||||
|
|
|
@ -31,7 +31,7 @@ stdenv.mkDerivation {
|
|||
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patch -p1 -d libcxx -i ${../../libcxx-0001-musl-hacks.patch}
|
||||
'' + lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d llvm -i ${./libcxxabi-wasm.patch}
|
||||
patch -p1 -d llvm -i ${./wasm.patch}
|
||||
'';
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
|
|
|
@ -15,6 +15,12 @@ stdenv.mkDerivation rec {
|
|||
mv llvm-* llvm
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 48cb8e004e08..fec8144fb95a 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -23,6 +23,8 @@ set(LIBUNWIND_LIBCXX_PATH "${CMAKE_CURRENT_LIST_DIR}/../libcxx" CACHE PATH
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_BUILD)
|
||||
project(libunwind LANGUAGES C CXX ASM)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(PACKAGE_NAME libunwind)
|
||||
set(PACKAGE_VERSION 12.0.0)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
@@ -115,17 +117,17 @@ set(CMAKE_MODULE_PATH
|
||||
|
||||
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})
|
|
@ -1,9 +1,10 @@
|
|||
{ lib, stdenv, llvm_meta
|
||||
, buildLlvmTools
|
||||
, fetch
|
||||
, libunwind
|
||||
, cmake
|
||||
, libxml2
|
||||
, llvm
|
||||
, libllvm
|
||||
, version
|
||||
}:
|
||||
|
||||
|
@ -13,8 +14,20 @@ stdenv.mkDerivation rec {
|
|||
|
||||
src = fetch pname "1zakyxk5bwnh7jarckcd4rbmzi58jgn2dbah5j5cwcyfyfbx9drc";
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ llvm libxml2 ];
|
||||
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"
|
||||
];
|
||||
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace MachO/CMakeLists.txt --replace \
|
||||
|
@ -23,13 +36,6 @@ stdenv.mkDerivation rec {
|
|||
tar -xf "${libunwind.src}" --wildcards -C libunwind/include --strip-components=2 "libunwind-*/include/"
|
||||
'';
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postInstall = ''
|
||||
moveToOutput include "$dev"
|
||||
moveToOutput lib "$dev"
|
||||
'';
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://lld.llvm.org/";
|
||||
description = "The LLVM linker";
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index d4e561b50d8f..cfa5bdd79c2a 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")
|
||||
@@ -179,7 +181,7 @@ include_directories(BEFORE
|
||||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
install(DIRECTORY include/
|
||||
- DESTINATION include
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h"
|
||||
)
|
||||
diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
|
||||
index 23df41312403..d62372c88de7 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 5cff736ff57f..64e775c771b9 100644
|
||||
--- a/tools/lld/CMakeLists.txt
|
||||
+++ b/tools/lld/CMakeLists.txt
|
||||
@@ -21,7 +21,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
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv, llvm_meta
|
||||
, runCommand
|
||||
, fetch
|
||||
, cmake
|
||||
, zlib
|
||||
|
@ -7,8 +8,8 @@
|
|||
, which
|
||||
, libedit
|
||||
, libxml2
|
||||
, llvm
|
||||
, clang-unwrapped
|
||||
, libllvm
|
||||
, libclang
|
||||
, python3
|
||||
, version
|
||||
, libobjc
|
||||
|
@ -27,17 +28,30 @@ stdenv.mkDerivation (rec {
|
|||
|
||||
src = fetch pname "1v85qyq3snk81vjmwq5q7xikyyqsfpqy2c4qmr81mps4avsw1g0l";
|
||||
|
||||
patches = [ ./lldb-procfs.patch ];
|
||||
patches = [
|
||||
./procfs.patch
|
||||
(runCommand "resource-dir.patch" {
|
||||
clangLibDir = "${libclang.lib}/lib";
|
||||
} ''
|
||||
substitute '${./resource-dir.patch}' "$out" --subst-var clangLibDir
|
||||
'')
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 which swig lit ]
|
||||
++ lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake python3 which swig lit
|
||||
] ++ lib.optionals enableManpages [
|
||||
python3.pkgs.sphinx python3.pkgs.recommonmark
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
ncurses
|
||||
zlib
|
||||
libedit
|
||||
libxml2
|
||||
llvm
|
||||
libllvm
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
libobjc
|
||||
|
@ -51,8 +65,9 @@ stdenv.mkDerivation (rec {
|
|||
hardeningDisable = [ "format" ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
|
||||
"-DLLVM_ENABLE_RTTI=OFF"
|
||||
"-DClang_DIR=${clang-unwrapped}/lib/cmake"
|
||||
"-DClang_DIR=${libclang.dev}/lib/cmake"
|
||||
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
|
||||
|
@ -62,8 +77,13 @@ stdenv.mkDerivation (rec {
|
|||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
] ++ 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;
|
||||
|
||||
postInstall = ''
|
||||
# Editor support
|
||||
# vscode:
|
||||
|
@ -90,6 +110,7 @@ stdenv.mkDerivation (rec {
|
|||
'';
|
||||
|
||||
propagatedBuildInputs = [];
|
||||
|
||||
# manually install lldb man page
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/man/man1
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b5633e21c56a..f2f1035e9238 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -10,6 +10,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)
|
||||
+
|
||||
project(lldb)
|
||||
include(LLDBStandalone)
|
||||
|
||||
diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
|
||||
index 4ed5c647c5d2..89f96e710d55 100644
|
||||
--- a/cmake/modules/AddLLDB.cmake
|
||||
+++ b/cmake/modules/AddLLDB.cmake
|
||||
@@ -107,13 +107,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 2fdf1502d055..37364341ff8b 100644
|
||||
--- a/cmake/modules/LLDBConfig.cmake
|
||||
+++ b/cmake/modules/LLDBConfig.cmake
|
||||
@@ -225,7 +225,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 ".cmake" EXCLUDE
|
||||
@@ -233,7 +233,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 ".cmake" EXCLUDE
|
||||
diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
|
||||
index 734167e51bc5..f95761b5df58 100644
|
||||
--- a/tools/intel-features/CMakeLists.txt
|
||||
+++ b/tools/intel-features/CMakeLists.txt
|
||||
@@ -65,4 +65,4 @@ if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
|
||||
endif()
|
||||
|
||||
install(TARGETS lldbIntelFeatures
|
||||
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
|
||||
index 37364341ff8b..7f74c1a3e257 100644
|
||||
--- a/cmake/modules/LLDBConfig.cmake
|
||||
+++ b/cmake/modules/LLDBConfig.cmake
|
||||
@@ -257,7 +257,7 @@ if (NOT TARGET clang-resource-headers)
|
||||
# Iterate over the possible places where the external resource directory
|
||||
# could be and pick the first that exists.
|
||||
foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
|
||||
- "${LLVM_BUILD_LIBRARY_DIR}"
|
||||
+ "${LLVM_BUILD_LIBRARY_DIR}" "@clangLibDir@"
|
||||
"${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
|
||||
# Build the resource directory path by appending 'clang/<version number>'.
|
||||
set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv, llvm_meta
|
||||
, pkgsBuildBuild
|
||||
, fetch
|
||||
, cmake
|
||||
, python3
|
||||
|
@ -10,10 +11,10 @@
|
|||
, version
|
||||
, release_version
|
||||
, zlib
|
||||
, buildPackages
|
||||
, buildLlvmTools
|
||||
, debugVersion ? false
|
||||
, enableManpages ? false
|
||||
, enableSharedLibraries ? true
|
||||
, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
|
||||
, enablePFM ? !(stdenv.isDarwin
|
||||
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|
||||
|| stdenv.isAarch32 # broken for the armv7l builder
|
||||
|
@ -44,8 +45,7 @@ in stdenv.mkDerivation (rec {
|
|||
mv polly-* $sourceRoot/tools/polly
|
||||
'';
|
||||
|
||||
outputs = [ "out" "python" ]
|
||||
++ optional enableSharedLibraries "lib";
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||
|
@ -59,17 +59,18 @@ in stdenv.mkDerivation (rec {
|
|||
# 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
|
||||
];
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
|
||||
|
||||
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/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
|
||||
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
|
||||
''
|
||||
# Patch llvm-config to return correct library path based on --link-{shared,static}.
|
||||
+ optionalString (enableSharedLibraries) ''
|
||||
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
|
||||
patch -p1 < ./llvm-outputs.patch
|
||||
substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
|
||||
patch -p1 < ./outputs.patch
|
||||
'' + ''
|
||||
# FileSystem permissions tests fail with various special bits
|
||||
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||
|
@ -108,6 +109,7 @@ in stdenv.mkDerivation (rec {
|
|||
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
|
||||
|
||||
cmakeFlags = with stdenv; [
|
||||
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
|
||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||
"-DLLVM_BUILD_TESTS=ON"
|
||||
|
@ -131,11 +133,24 @@ in stdenv.mkDerivation (rec {
|
|||
"-DCAN_TARGET_i386=false"
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"-DCMAKE_CROSSCOMPILING=True"
|
||||
"-DLLVM_TABLEGEN=${buildPackages.llvm_12}/bin/llvm-tblgen"
|
||||
"-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"
|
||||
];
|
||||
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
|
||||
)
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
rm -R $out
|
||||
rm -fR $out
|
||||
'';
|
||||
|
||||
preCheck = ''
|
||||
|
@ -145,20 +160,19 @@ in stdenv.mkDerivation (rec {
|
|||
postInstall = ''
|
||||
mkdir -p $python/share
|
||||
mv $out/share/opt-viewer $python/share/opt-viewer
|
||||
''
|
||||
+ optionalString enableSharedLibraries ''
|
||||
moveToOutput "lib/libLLVM-*" "$lib"
|
||||
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
||||
''
|
||||
+ optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
||||
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) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
|
||||
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
|
||||
'';
|
||||
|
||||
doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl);
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
|
||||
index ca7c04c565bb..6ed5db5dd4f8 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.13.4)
|
||||
+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})
|
||||
@@ -122,13 +126,13 @@ include_directories(
|
||||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
install(DIRECTORY include/
|
||||
- DESTINATION include
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h"
|
||||
)
|
||||
|
||||
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 7cc129ba2e90..137be25e4b80 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 518a09b45a42..bd9d6f5542ad 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 8991094d92c7..178d8ad606bb 100644
|
||||
--- a/tools/polly/lib/External/CMakeLists.txt
|
||||
+++ b/tools/polly/lib/External/CMakeLists.txt
|
||||
@@ -275,7 +275,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
|
|
@ -0,0 +1,417 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 277d0fe54d7b..af69c8be8745 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -256,15 +256,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})
|
||||
@@ -567,9 +573,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
|
||||
@@ -1027,7 +1033,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"
|
||||
@@ -1038,7 +1044,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"
|
||||
@@ -1052,13 +1058,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 97c9980c7de3..409e8b615f75 100644
|
||||
--- a/cmake/modules/AddLLVM.cmake
|
||||
+++ b/cmake/modules/AddLLVM.cmake
|
||||
@@ -804,9 +804,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}
|
||||
@@ -1022,7 +1022,7 @@ function(process_llvm_pass_plugins)
|
||||
"set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
|
||||
install(FILES
|
||||
${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
|
||||
- DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
|
||||
+ DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
|
||||
COMPONENT cmake-exports)
|
||||
|
||||
set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
|
||||
@@ -1242,7 +1242,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)
|
||||
@@ -1854,7 +1854,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()
|
||||
@@ -1871,7 +1871,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)
|
||||
@@ -1894,7 +1894,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)
|
||||
@@ -1977,7 +1977,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()
|
||||
@@ -2100,9 +2101,9 @@ function(llvm_setup_rpath name)
|
||||
|
||||
if (APPLE)
|
||||
set(_install_name_dir INSTALL_NAME_DIR "@rpath")
|
||||
- set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
|
||||
+ set(_install_rpath "@loader_path/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${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 554046b20edf..4d1ad980641e 100644
|
||||
--- a/cmake/modules/AddOCaml.cmake
|
||||
+++ b/cmake/modules/AddOCaml.cmake
|
||||
@@ -144,9 +144,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 e80c3b5c1cac..482f6d715ef5 100644
|
||||
--- a/cmake/modules/AddSphinxTarget.cmake
|
||||
+++ b/cmake/modules/AddSphinxTarget.cmake
|
||||
@@ -90,7 +90,7 @@ function (add_sphinx_target builder project)
|
||||
endif()
|
||||
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 505dc9a29d70..36e6c63af3f4 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.
|
||||
@@ -107,13 +107,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}")
|
||||
|
||||
# Generate a default location for lit
|
||||
if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
|
||||
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 bb821b417ad9..6a528f7c2ad3 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.
|
||||
@@ -550,8 +550,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
|
||||
@@ -582,13 +582,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
|
||||
@@ -786,9 +806,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/examples/Bye/CMakeLists.txt b/examples/Bye/CMakeLists.txt
|
||||
index bb96edb4b4bf..678c22fb43c8 100644
|
||||
--- a/examples/Bye/CMakeLists.txt
|
||||
+++ b/examples/Bye/CMakeLists.txt
|
||||
@@ -14,6 +14,6 @@ if (NOT WIN32)
|
||||
BUILDTREE_ONLY
|
||||
)
|
||||
|
||||
- install(TARGETS ${name} RUNTIME DESTINATION examples)
|
||||
+ install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
|
||||
set_target_properties(${name} PROPERTIES FOLDER "Examples")
|
||||
endif()
|
||||
diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
|
||||
index b46319f24fc8..2feabd1954e4 100644
|
||||
--- a/include/llvm/CMakeLists.txt
|
||||
+++ b/include/llvm/CMakeLists.txt
|
||||
@@ -5,5 +5,5 @@ add_subdirectory(Frontend)
|
||||
# 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 ebe5b73a5c65..70c497be12f5 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 1a2f04552d13..44fa7d3eec6b 100644
|
||||
--- a/tools/llvm-config/llvm-config.cpp
|
||||
+++ b/tools/llvm-config/llvm-config.cpp
|
||||
@@ -357,12 +357,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 = std::string(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 2963f97cad88..69d66c9c9ca1 100644
|
||||
--- a/tools/lto/CMakeLists.txt
|
||||
+++ b/tools/lto/CMakeLists.txt
|
||||
@@ -25,7 +25,7 @@ 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 ead73ec13a8f..250362021f17 100644
|
||||
--- a/tools/opt-viewer/CMakeLists.txt
|
||||
+++ b/tools/opt-viewer/CMakeLists.txt
|
||||
@@ -8,7 +8,7 @@ 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 865436247270..ce1daa62f6ab 100644
|
||||
--- a/tools/remarks-shlib/CMakeLists.txt
|
||||
+++ b/tools/remarks-shlib/CMakeLists.txt
|
||||
@@ -19,7 +19,7 @@ if(LLVM_ENABLE_PIC)
|
||||
endif()
|
||||
|
||||
install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/Remarks.h
|
||||
- DESTINATION include/llvm-c
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm-c
|
||||
COMPONENT Remarks)
|
||||
|
||||
if (APPLE)
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
}:
|
||||
|
@ -22,20 +23,27 @@ let
|
|||
++ lib.optional enableManpages python3.pkgs.sphinx
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = [ libxml2 llvm ];
|
||||
buildInputs = [ libxml2 libllvm ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_CXX_FLAGS=-std=c++11"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
"-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
|
||||
] ++ 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"
|
||||
];
|
||||
|
||||
patches = [ ./purity.patch ];
|
||||
patches = [
|
||||
./purity.patch
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
|
||||
|
@ -48,12 +56,12 @@ let
|
|||
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||
'';
|
||||
|
||||
outputs = [ "out" "lib" "python" ];
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${llvm}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${llvm}/lib/LLVMgold.so $out/lib
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
@ -70,11 +78,14 @@ let
|
|||
fi
|
||||
mv $out/share/clang/*.py $python/share/clang
|
||||
rm $out/bin/c-index-test
|
||||
|
||||
mkdir -p $dev/bin
|
||||
cp bin/clang-tblgen $dev/bin
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isClang = true;
|
||||
inherit llvm;
|
||||
inherit libllvm;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2667b1d6892e..87c5ad58738f 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.4.3)
|
||||
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
|
||||
project(Clang)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
# Rely on llvm-config.
|
||||
set(CONFIG_OUTPUT)
|
||||
find_program(LLVM_CONFIG "llvm-config")
|
||||
@@ -344,7 +346,7 @@ include_directories(BEFORE
|
||||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
install(DIRECTORY include/clang include/clang-c
|
||||
- DESTINATION include
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "*.def"
|
||||
PATTERN "*.h"
|
||||
@@ -353,7 +355,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
)
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
|
||||
- DESTINATION include
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "CMakeFiles" EXCLUDE
|
||||
PATTERN "*.inc"
|
||||
@@ -361,7 +363,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
)
|
||||
|
||||
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 e657059744a4..19da44638fe6 100644
|
||||
--- a/cmake/modules/AddClang.cmake
|
||||
+++ b/cmake/modules/AddClang.cmake
|
||||
@@ -99,9 +99,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 (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-${name}
|
||||
@@ -143,7 +143,7 @@ macro(add_clang_tool name)
|
||||
|
||||
install(TARGETS ${name}
|
||||
${export_to_clangtargets}
|
||||
- RUNTIME DESTINATION bin
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT ${name})
|
||||
|
||||
if(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@@ -160,5 +160,5 @@ 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()
|
||||
diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
|
||||
index a621c02644e3..e140efc9c83c 100644
|
||||
--- a/lib/Headers/CMakeLists.txt
|
||||
+++ b/lib/Headers/CMakeLists.txt
|
||||
@@ -129,13 +129,13 @@ install(
|
||||
FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
|
||||
COMPONENT clang-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||||
|
||||
install(
|
||||
FILES ${cuda_wrapper_files}
|
||||
COMPONENT clang-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
|
||||
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
|
||||
add_custom_target(install-clang-headers
|
||||
diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
|
||||
index ad990e010eef..92e52d05afb9 100644
|
||||
--- a/tools/c-index-test/CMakeLists.txt
|
||||
+++ b/tools/c-index-test/CMakeLists.txt
|
||||
@@ -48,7 +48,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 04151a8e0331..13918d91c4ba 100644
|
||||
--- a/tools/clang-check/CMakeLists.txt
|
||||
+++ b/tools/clang-check/CMakeLists.txt
|
||||
@@ -19,4 +19,4 @@ target_link_libraries(clang-check
|
||||
)
|
||||
|
||||
install(TARGETS clang-check
|
||||
- RUNTIME DESTINATION bin)
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
|
||||
index a13633eaefc4..9b0094783690 100644
|
||||
--- a/tools/clang-format/CMakeLists.txt
|
||||
+++ b/tools/clang-format/CMakeLists.txt
|
||||
@@ -20,20 +20,20 @@ if( 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 6161d08ae587..a003292d1676 100644
|
||||
--- a/tools/clang-offload-bundler/CMakeLists.txt
|
||||
+++ b/tools/clang-offload-bundler/CMakeLists.txt
|
||||
@@ -21,4 +21,4 @@ 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 771e3bdea6f0..d1396e62b28f 100644
|
||||
--- a/tools/clang-rename/CMakeLists.txt
|
||||
+++ b/tools/clang-rename/CMakeLists.txt
|
||||
@@ -14,11 +14,11 @@ target_link_libraries(clang-rename
|
||||
clangToolingRefactor
|
||||
)
|
||||
|
||||
-install(TARGETS clang-rename RUNTIME DESTINATION bin)
|
||||
+install(TARGETS clang-rename RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
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/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
|
||||
index 2dd670307636..1fe576f77ddb 100644
|
||||
--- a/tools/libclang/CMakeLists.txt
|
||||
+++ b/tools/libclang/CMakeLists.txt
|
||||
@@ -121,7 +121,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
|
||||
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})
|
|
@ -13,7 +13,7 @@ stdenv.mkDerivation {
|
|||
inherit version;
|
||||
src = fetch "compiler-rt" "0ipd4jdxpczgr2w6lzrabymz6dhzj69ywmyybjjc1q397zgrvziy";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm ];
|
||||
nativeBuildInputs = [ cmake python3 llvm.dev ];
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
|
@ -21,6 +21,7 @@ stdenv.mkDerivation {
|
|||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCOMPILER_RT_OS_DIR="
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
|
@ -54,6 +55,7 @@ stdenv.mkDerivation {
|
|||
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
|
||||
../../common/compiler-rt/glibc.patch
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional (stdenv.hostPlatform.libc == "glibc") ./sys-ustat.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
@ -76,9 +78,7 @@ stdenv.mkDerivation {
|
|||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
postInstall = lib.optionalString (useLLVM) ''
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/linux/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f997c53410c1..ac079d89b57b 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -12,6 +12,7 @@ cmake_minimum_required(VERSION 3.4.3)
|
||||
# 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)
|
||||
endif()
|
||||
|
||||
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
|
||||
index bc5fb9ff722b..91fb79d1980c 100644
|
||||
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -344,7 +344,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}
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_PREFIX}
|
||||
COMPONENT ${component})
|
||||
add_dependencies(${component} ${target_name})
|
||||
|
||||
@@ -361,7 +361,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 f646975475bb..75885bf305b8 100644
|
||||
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
@@ -391,7 +391,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/base-config-ix.cmake b/cmake/base-config-ix.cmake
|
||||
index b38c6ca96fac..a4580414cbc8 100644
|
||||
--- a/cmake/base-config-ix.cmake
|
||||
+++ b/cmake/base-config-ix.cmake
|
||||
@@ -43,11 +43,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.
|
||||
@@ -67,9 +67,9 @@ if(NOT DEFINED COMPILER_RT_OS_DIR)
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
|
||||
endif()
|
||||
set(COMPILER_RT_LIBRARY_OUTPUT_DIR
|
||||
- ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
|
||||
+ ${COMPILER_RT_OUTPUT_DIR}/${CMAKE_INSTALL_FULL_LIBDIR}/${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})
|
||||
|
||||
if(APPLE)
|
||||
# On Darwin if /usr/include doesn't exist, the user probably has Xcode but not
|
||||
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
||||
index ec3bf40b95e6..af119f10ee2b 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -44,8 +44,8 @@ set_target_properties(compiler-rt-headers PROPERTIES FOLDER "Compiler-RT Misc")
|
||||
# Install sanitizer headers.
|
||||
install(FILES ${SANITIZER_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}
|
||||
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)
|
||||
diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt
|
||||
index 2c486bff821b..0ee715da95f8 100644
|
||||
--- a/lib/dfsan/CMakeLists.txt
|
||||
+++ b/lib/dfsan/CMakeLists.txt
|
||||
@@ -44,4 +44,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})
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_PREFIX})
|
|
@ -1,6 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith
|
||||
, buildPackages
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
}:
|
||||
|
@ -18,34 +17,43 @@ let
|
|||
clang-tools-extra_src = fetch "clang-tools-extra" "018b3fiwah8f8br5i26qmzh6sjvzchpn358sn8v079m49f2jldm3";
|
||||
|
||||
tools = lib.makeExtensible (tools: let
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
|
||||
mkExtraBuildCommands = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
|
||||
in {
|
||||
|
||||
llvm = callPackage ./llvm { };
|
||||
libllvm = callPackage ./llvm { };
|
||||
|
||||
clang-unwrapped = callPackage ./clang {
|
||||
# `llvm` historically had the binaries. But this migration
|
||||
# technique also impedes `lib.get*`. Perhaps we will revisit it.
|
||||
llvm = tools.libllvm.out;
|
||||
|
||||
libllvm-polly = callPackage ./llvm { enablePolly = true; };
|
||||
|
||||
llvm-polly = tools.libllvm-polly.lib;
|
||||
|
||||
libclang = callPackage ./clang {
|
||||
inherit clang-tools-extra_src;
|
||||
};
|
||||
|
||||
llvm-manpages = lowPrio (tools.llvm.override {
|
||||
clang-unwrapped = tools.libclang.out;
|
||||
|
||||
llvm-manpages = lowPrio (tools.libllvm.override {
|
||||
enableManpages = true;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
|
||||
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
||||
clang-manpages = lowPrio (tools.libclang.override {
|
||||
enableManpages = true;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
|
||||
libclang = tools.clang-unwrapped.lib;
|
||||
|
||||
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
||||
|
||||
libstdcxxClang = wrapCCWith rec {
|
||||
|
|
|
@ -11,7 +11,11 @@ stdenv.mkDerivation {
|
|||
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
||||
'';
|
||||
|
||||
patches = lib.optionals stdenv.hostPlatform.isMusl [
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optionals stdenv.hostPlatform.isMusl [
|
||||
../../libcxx-0001-musl-hacks.patch
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ca5afba86d19..ed69e4043c3d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -22,6 +22,8 @@ set(CMAKE_MODULE_PATH
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
project(libcxx CXX C)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION 5.0.0)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
index b1f6bee8f945..1b455fceed7f 100644
|
||||
--- a/cmake/Modules/HandleLibCXXABI.cmake
|
||||
+++ b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
@@ -55,7 +55,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
)
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
|
||||
- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
|
||||
+ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}
|
||||
COMPONENT libcxx
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
||||
index 5a1b2ccdc426..106d3d6c1d3c 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -20,7 +20,7 @@ endif()
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(DIRECTORY .
|
||||
- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
|
||||
+ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
|
||||
COMPONENT cxx-headers
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
@@ -44,7 +44,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
||||
set(generated_config_deps generate_config_header)
|
||||
# Install the generated header as __config.
|
||||
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
|
||||
- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
|
||||
+ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
RENAME __config
|
||||
COMPONENT cxx-headers)
|
||||
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
||||
index 578651423f3b..277befd631ac 100644
|
||||
--- a/lib/CMakeLists.txt
|
||||
+++ b/lib/CMakeLists.txt
|
||||
@@ -355,8 +355,8 @@ if (LIBCXX_INSTALL_LIBRARY)
|
||||
set(experimental_lib cxx_experimental)
|
||||
endif()
|
||||
install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
|
||||
- LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
||||
- ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
||||
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
||||
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
||||
)
|
||||
# NOTE: This install command must go after the cxx install command otherwise
|
||||
# it will not be executed after the library symlinks are installed.
|
||||
@@ -364,7 +364,7 @@ if (LIBCXX_INSTALL_LIBRARY)
|
||||
# Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx>
|
||||
# after we required CMake 3.0.
|
||||
install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||
- DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
|
||||
+ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}
|
||||
COMPONENT libcxx)
|
||||
endif()
|
||||
endif()
|
|
@ -6,8 +6,7 @@ stdenv.mkDerivation {
|
|||
|
||||
src = fetch "libcxxabi" "12lp799rskr4fc2xr64qn4jfkjnfd8b1aymvsxyn4k9ar7r9pgqv";
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile ${libcxx.src}
|
||||
|
@ -19,6 +18,13 @@ stdenv.mkDerivation {
|
|||
patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
then ''
|
||||
for file in lib/*.dylib; do
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 4db3328deb9c..74b39acfe588 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -20,6 +20,8 @@ set(CMAKE_MODULE_PATH
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
project(libcxxabi CXX C)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(PACKAGE_NAME libcxxabi)
|
||||
set(PACKAGE_VERSION 5.0.0)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index adcc412880c9..71758665af05 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -174,8 +174,8 @@ endif()
|
||||
add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
|
||||
|
||||
install(TARGETS ${LIBCXXABI_TARGETS}
|
||||
- LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
|
||||
- ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
|
||||
+ LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
|
||||
+ ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
|
||||
)
|
||||
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
|
@ -1,7 +1,8 @@
|
|||
{ lib, stdenv
|
||||
, buildLlvmTools
|
||||
, fetch
|
||||
, cmake
|
||||
, llvm
|
||||
, libllvm
|
||||
, version
|
||||
}:
|
||||
|
||||
|
@ -11,15 +12,20 @@ stdenv.mkDerivation {
|
|||
|
||||
src = fetch "lld" "1ah75rjly6747jk1zbwca3z0svr9b09ylgxd4x9ns721xir6sia6";
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ llvm ];
|
||||
buildInputs = [ libllvm ];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
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"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
moveToOutput include "$dev"
|
||||
moveToOutput lib "$dev"
|
||||
'';
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
meta = {
|
||||
description = "The LLVM Linker";
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e2ab0e35f1ab..f68e23d2a70d 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")
|
||||
@@ -203,7 +205,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 fd1d44199ca6..2ec1831ed8f6 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_custom_target(install-${name}
|
||||
@@ -56,7 +56,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)
|
||||
@@ -73,5 +73,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 2df10697ff66..94aa8d092220 100644
|
||||
--- a/tools/lld/CMakeLists.txt
|
||||
+++ b/tools/lld/CMakeLists.txt
|
||||
@@ -13,7 +13,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)
|
|
@ -8,14 +8,14 @@
|
|||
, which
|
||||
, libedit
|
||||
, libxml2
|
||||
, llvm
|
||||
, clang-unwrapped
|
||||
, libllvm
|
||||
, libclang
|
||||
, python3
|
||||
, version
|
||||
, darwin
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lldb";
|
||||
inherit version;
|
||||
|
||||
|
@ -28,29 +28,46 @@ stdenv.mkDerivation {
|
|||
sha256 = "1zbx4m0m8kbg0wq6740jcw151vb2pb1p25p401wiq8diqqagkjps";
|
||||
stripLen = 1;
|
||||
})
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Fix up various paths that assume llvm and clang are installed in the same place
|
||||
sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
|
||||
sed -i 's,".*ClangConfig.cmake","${libclang.dev}/lib/cmake/clang/ClangConfig.cmake",' \
|
||||
cmake/modules/LLDBStandalone.cmake
|
||||
sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
|
||||
sed -i 's,".*tools/clang/include","${libclang.dev}/include",' \
|
||||
cmake/modules/LLDBStandalone.cmake
|
||||
sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
|
||||
sed -i 's,"$.LLVM_LIBRARY_DIR.",${libllvm.lib}/lib ${libclang.lib}/lib,' \
|
||||
cmake/modules/LLDBStandalone.cmake
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 which swig ];
|
||||
buildInputs = [ ncurses zlib libedit libxml2 llvm ]
|
||||
++ 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 ];
|
||||
outputs = [ "out" "lib" "dev" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake python3 which swig
|
||||
];
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
CXXFLAGS = "-fno-rtti";
|
||||
hardeningDisable = [ "format" ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
|
||||
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
|
||||
] ++ 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;
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/share/man/man1
|
||||
cp ../docs/lldb.1 $out/share/man/man1/
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ada293811b3e..6c2149309f65 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -7,6 +7,8 @@ set(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
||||
)
|
||||
|
||||
+include(GNUInstallDirs)
|
||||
+
|
||||
include(LLDBStandalone)
|
||||
include(LLDBConfig)
|
||||
include(AddLLDB)
|
||||
diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
|
||||
index 4c6f1efd673d..179a12b49cce 100644
|
||||
--- a/cmake/modules/AddLLDB.cmake
|
||||
+++ b/cmake/modules/AddLLDB.cmake
|
||||
@@ -54,14 +54,14 @@ function(add_lldb_library name)
|
||||
endif()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
- RUNTIME DESTINATION bin
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${out_dir}
|
||||
ARCHIVE DESTINATION ${out_dir})
|
||||
else()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
- 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()
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-${name}
|
||||
@@ -126,7 +126,7 @@ function(add_lldb_executable name)
|
||||
if(ARG_GENERATE_INSTALL AND NOT (ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK ))
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
- RUNTIME DESTINATION bin)
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-${name}
|
||||
DEPENDS ${name}
|
||||
diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
|
||||
index 726552675f47..f1f769f34446 100644
|
||||
--- a/cmake/modules/LLDBConfig.cmake
|
||||
+++ b/cmake/modules/LLDBConfig.cmake
|
||||
@@ -276,7 +276,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
|
||||
@@ -286,7 +286,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-mpx/CMakeLists.txt b/tools/intel-mpx/CMakeLists.txt
|
||||
index 29ba9a1cacec..30e2f9334b95 100644
|
||||
--- a/tools/intel-mpx/CMakeLists.txt
|
||||
+++ b/tools/intel-mpx/CMakeLists.txt
|
||||
@@ -12,4 +12,4 @@ target_link_libraries(lldb-intel-mpxtable
|
||||
PUBLIC liblldb LLVMSupport)
|
||||
|
||||
install(TARGETS lldb-intel-mpxtable
|
||||
- LIBRARY DESTINATION bin)
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv
|
||||
, pkgsBuildBuild
|
||||
, fetch
|
||||
, fetchpatch
|
||||
, cmake
|
||||
|
@ -10,9 +11,11 @@
|
|||
, version
|
||||
, release_version
|
||||
, zlib
|
||||
, buildLlvmTools
|
||||
, debugVersion ? false
|
||||
, enableManpages ? false
|
||||
, enableSharedLibraries ? !enableManpages
|
||||
, enablePolly ? false
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -29,15 +32,18 @@ stdenv.mkDerivation ({
|
|||
inherit version;
|
||||
|
||||
src = fetch "llvm" "0g1bbj2n6xv4p1n6hh17vj3vpvg56wacipc81dgwga9mg2lys8nm";
|
||||
polly_src = fetch "polly" "1f4i1qsw7ywx25v262p8syz339zcbvfkx295xz26hmqrn944xa6x";
|
||||
|
||||
unpackPhase = ''
|
||||
unpackFile $src
|
||||
mv llvm-${version}* llvm
|
||||
sourceRoot=$PWD/llvm
|
||||
'' + optionalString enablePolly ''
|
||||
unpackFile $polly_src
|
||||
mv polly-* $sourceRoot/tools/polly
|
||||
'';
|
||||
|
||||
outputs = [ "out" "python" ]
|
||||
++ optional enableSharedLibraries "lib";
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ]
|
||||
++ optional enableManpages python3.pkgs.sphinx;
|
||||
|
@ -59,11 +65,13 @@ stdenv.mkDerivation ({
|
|||
# sha256 = "0injj1hqgrbcbihhwp2nbal88jfykad30r54f2cdcx7gws2fcy8i";
|
||||
# stripLen = 1;
|
||||
#})
|
||||
];
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
|
||||
|
||||
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/../lib" ''${extra_libdir})' ""
|
||||
--replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}" ''${extra_libdir})' ""
|
||||
''
|
||||
# Patch llvm-config to return correct library path based on --link-{shared,static}.
|
||||
+ optionalString (enableSharedLibraries) ''
|
||||
|
@ -90,6 +98,7 @@ stdenv.mkDerivation ({
|
|||
'';
|
||||
|
||||
cmakeFlags = with stdenv; [
|
||||
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
|
||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||
"-DLLVM_BUILD_TESTS=ON"
|
||||
|
@ -100,20 +109,36 @@ stdenv.mkDerivation ({
|
|||
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
|
||||
"-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
|
||||
]
|
||||
++ optional enableSharedLibraries
|
||||
++ lib.optional enableSharedLibraries
|
||||
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
||||
++ optionals enableManpages [
|
||||
++ lib.optionals enableManpages [
|
||||
"-DLLVM_BUILD_DOCS=ON"
|
||||
"-DLLVM_ENABLE_SPHINX=ON"
|
||||
"-DSPHINX_OUTPUT_MAN=ON"
|
||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||
]
|
||||
++ optional (!isDarwin)
|
||||
++ lib.optional (!isDarwin)
|
||||
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
|
||||
++ optionals (isDarwin) [
|
||||
++ lib.optionals (isDarwin) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
"-DCAN_TARGET_i386=false"
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"-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"
|
||||
];
|
||||
in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
|
||||
)
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
|
@ -127,21 +152,20 @@ stdenv.mkDerivation ({
|
|||
postInstall = ''
|
||||
mkdir -p $python/share
|
||||
mv $out/share/opt-viewer $python/share/opt-viewer
|
||||
''
|
||||
+ optionalString enableSharedLibraries ''
|
||||
moveToOutput "lib/libLLVM-*" "$lib"
|
||||
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
||||
moveToOutput "lib/libLTO${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
||||
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) ''
|
||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libLTO.dylib" "$lib/lib/libLTO.dylib"
|
||||
${lib.concatMapStringsSep "\n" (v: ''
|
||||
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
|
||||
'') versionSuffixes}
|
||||
''
|
||||
+ optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
|
||||
cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
|
||||
'';
|
||||
|
||||
doCheck = stdenv.isLinux && (!stdenv.isi686);
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
|
||||
index 9ddc0f7ff81d..7ca45f286d47 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})
|
||||
@@ -157,14 +161,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 969292cd6b00..d7aea77bdd20 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 32bed50bb060..cca5bfff4970 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 286c04fba287..07905e68f595 100644
|
||||
--- a/tools/polly/lib/External/CMakeLists.txt
|
||||
+++ b/tools/polly/lib/External/CMakeLists.txt
|
||||
@@ -268,7 +268,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
|
|
@ -0,0 +1,386 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c1e03aed4809..8b8bbb8c403e 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -279,15 +279,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 "bin" CACHE STRING
|
||||
"Path to install LLVM utilities (enabled by LLVM_INSTALL_UTILS=ON) (defaults to LLVM_TOOLS_INSTALL_DIR)")
|
||||
mark_as_advanced(LLVM_TOOLS_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})
|
||||
@@ -512,9 +518,9 @@ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OF
|
||||
option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
|
||||
option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." 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
|
||||
@@ -945,7 +951,7 @@ add_subdirectory(cmake/modules)
|
||||
|
||||
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"
|
||||
@@ -957,7 +963,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
)
|
||||
|
||||
install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm
|
||||
- DESTINATION include
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
COMPONENT llvm-headers
|
||||
FILES_MATCHING
|
||||
PATTERN "*.def"
|
||||
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
|
||||
index 1c922651b133..d555fd627a4f 100644
|
||||
--- a/cmake/modules/AddLLVM.cmake
|
||||
+++ b/cmake/modules/AddLLVM.cmake
|
||||
@@ -589,11 +589,11 @@ macro(add_llvm_library name)
|
||||
else()
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" OR
|
||||
(LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
|
||||
- set(install_dir lib${LLVM_LIBDIR_SUFFIX})
|
||||
+ set(install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
|
||||
if(ARG_SHARED OR BUILD_SHARED_LIBS)
|
||||
if(WIN32 OR CYGWIN OR MINGW)
|
||||
set(install_type RUNTIME)
|
||||
- set(install_dir bin)
|
||||
+ set(install_dir ${CMAKE_INSTALL_BINDIR})
|
||||
else()
|
||||
set(install_type LIBRARY)
|
||||
endif()
|
||||
@@ -637,9 +637,9 @@ macro(add_llvm_loadable_module name)
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
if(WIN32 OR CYGWIN)
|
||||
# DLL platform
|
||||
- set(dlldir "bin")
|
||||
+ set(dlldir "${CMAKE_INSTALL_BINDIR}")
|
||||
else()
|
||||
- set(dlldir "lib${LLVM_LIBDIR_SUFFIX}")
|
||||
+ set(dlldir "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
|
||||
@@ -651,7 +651,7 @@ macro(add_llvm_loadable_module name)
|
||||
install(TARGETS ${name}
|
||||
${export_to_llvmexports}
|
||||
LIBRARY DESTINATION ${dlldir}
|
||||
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
|
||||
endif()
|
||||
@@ -864,7 +864,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)
|
||||
@@ -1275,7 +1275,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()
|
||||
@@ -1293,7 +1293,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)
|
||||
@@ -1316,7 +1316,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 CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
|
||||
@@ -1400,7 +1400,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()
|
||||
@@ -1452,9 +1453,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 1d8094cc505f..afdbe6e6d19c 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 4540c5c36c8e..4cefb17fbd55 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 ac4b0b7c0304..21a6a3da8667 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.
|
||||
@@ -84,11 +84,11 @@ 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_LIBRARY_DIRS "\${LLVM_INSTALL_PREFIX}/lib\${LLVM_LIBDIR_SUFFIX}")
|
||||
+set(LLVM_CONFIG_INCLUDE_DIRS "\${LLVM_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+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 482697b06baf..af2ac1e6c979 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("Creating ${name}")
|
||||
|
||||
diff --git a/docs/CMake.rst b/docs/CMake.rst
|
||||
index b6ebf37adc92..34c73d2869e0 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.
|
||||
@@ -461,8 +461,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
|
||||
@@ -493,13 +493,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
|
||||
OS X Only: If enabled CMake will generate a target named
|
||||
@@ -651,9 +671,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 f201e1f7bff0..4582ed556a02 100644
|
||||
--- a/tools/llvm-config/BuildVariables.inc.in
|
||||
+++ b/tools/llvm-config/BuildVariables.inc.in
|
||||
@@ -24,6 +24,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 08b096afb052..2deae0dcfacc 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 6e913519a809..85641eef721f 100644
|
||||
--- a/tools/lto/CMakeLists.txt
|
||||
+++ b/tools/lto/CMakeLists.txt
|
||||
@@ -19,7 +19,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
|
||||
add_llvm_library(LTO SHARED ${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)
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python3
|
||||
{ lib, stdenv, fetch, cmake, libxml2, libllvm, version, clang-tools-extra_src, python3
|
||||
, buildLlvmTools
|
||||
, fixDarwinDylibNames
|
||||
, enableManpages ? false
|
||||
}:
|
||||
|
@ -22,20 +23,27 @@ let
|
|||
++ lib.optional enableManpages python3.pkgs.sphinx
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = [ libxml2 llvm ];
|
||||
buildInputs = [ libxml2 libllvm ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_CXX_FLAGS=-std=c++11"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
"-DLLVM_CONFIG_PATH=${libllvm.dev}/bin/llvm-config${lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) "-native"}"
|
||||
] ++ 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"
|
||||
];
|
||||
|
||||
patches = [ ./purity.patch ];
|
||||
patches = [
|
||||
./purity.patch
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
|
||||
|
@ -48,12 +56,12 @@ let
|
|||
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||
'';
|
||||
|
||||
outputs = [ "out" "lib" "python" ];
|
||||
outputs = [ "out" "lib" "dev" "python" ];
|
||||
|
||||
# Clang expects to find LLVMgold in its own prefix
|
||||
postInstall = ''
|
||||
if [ -e ${llvm}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${llvm}/lib/LLVMgold.so $out/lib
|
||||
if [ -e ${libllvm.lib}/lib/LLVMgold.so ]; then
|
||||
ln -sv ${libllvm.lib}/lib/LLVMgold.so $lib/lib
|
||||
fi
|
||||
|
||||
ln -sv $out/bin/clang $out/bin/cpp
|
||||
|
@ -70,11 +78,14 @@ let
|
|||
fi
|
||||
mv $out/share/clang/*.py $python/share/clang
|
||||
rm $out/bin/c-index-test
|
||||
|
||||
mkdir -p $dev/bin
|
||||
cp bin/clang-tblgen $dev/bin
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isClang = true;
|
||||
inherit llvm;
|
||||
inherit libllvm;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -0,0 +1,258 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2eee8e6148f7..63efc7d2fdd0 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.4.3)
|
||||
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
|
||||
project(Clang)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
# Rely on llvm-config.
|
||||
set(CONFIG_OUTPUT)
|
||||
find_program(LLVM_CONFIG "llvm-config")
|
||||
@@ -365,7 +367,7 @@ include_directories(BEFORE
|
||||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
install(DIRECTORY include/clang include/clang-c
|
||||
- DESTINATION include
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "*.def"
|
||||
PATTERN "*.h"
|
||||
@@ -374,7 +376,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
)
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
|
||||
- DESTINATION include
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "CMakeFiles" EXCLUDE
|
||||
PATTERN "*.inc"
|
||||
@@ -382,7 +384,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
)
|
||||
|
||||
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 c09a8423f9f6..39f37e0097eb 100644
|
||||
--- a/cmake/modules/AddClang.cmake
|
||||
+++ b/cmake/modules/AddClang.cmake
|
||||
@@ -99,9 +99,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 (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_llvm_install_targets(install-${name}
|
||||
@@ -141,7 +141,7 @@ macro(add_clang_tool name)
|
||||
|
||||
install(TARGETS ${name}
|
||||
${export_to_clangtargets}
|
||||
- RUNTIME DESTINATION bin
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT ${name})
|
||||
|
||||
if(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@@ -156,5 +156,5 @@ 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()
|
||||
diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
|
||||
index 97ba3edea1c5..9d2bc5714af5 100644
|
||||
--- a/lib/Headers/CMakeLists.txt
|
||||
+++ b/lib/Headers/CMakeLists.txt
|
||||
@@ -142,13 +142,13 @@ install(
|
||||
FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h
|
||||
COMPONENT clang-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
|
||||
|
||||
install(
|
||||
FILES ${cuda_wrapper_files}
|
||||
COMPONENT clang-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include/cuda_wrappers)
|
||||
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES) # don't add this for IDE's.
|
||||
add_llvm_install_targets(install-clang-headers
|
||||
diff --git a/tools/c-index-test/CMakeLists.txt b/tools/c-index-test/CMakeLists.txt
|
||||
index d38c7bb28709..c9b5499cb756 100644
|
||||
--- a/tools/c-index-test/CMakeLists.txt
|
||||
+++ b/tools/c-index-test/CMakeLists.txt
|
||||
@@ -50,7 +50,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 c5ace26c2914..97bdfca7d896 100644
|
||||
--- a/tools/clang-check/CMakeLists.txt
|
||||
+++ b/tools/clang-check/CMakeLists.txt
|
||||
@@ -20,4 +20,4 @@ target_link_libraries(clang-check
|
||||
)
|
||||
|
||||
install(TARGETS clang-check
|
||||
- RUNTIME DESTINATION bin)
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
diff --git a/tools/clang-format/CMakeLists.txt b/tools/clang-format/CMakeLists.txt
|
||||
index a295e8cd0b2a..1973ff82c7f6 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-func-mapping/CMakeLists.txt b/tools/clang-func-mapping/CMakeLists.txt
|
||||
index ae28e28d532d..8ecb2e37a8f7 100644
|
||||
--- a/tools/clang-func-mapping/CMakeLists.txt
|
||||
+++ b/tools/clang-func-mapping/CMakeLists.txt
|
||||
@@ -20,4 +20,4 @@ target_link_libraries(clang-func-mapping
|
||||
)
|
||||
|
||||
install(TARGETS clang-func-mapping
|
||||
- RUNTIME DESTINATION bin)
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
diff --git a/tools/clang-offload-bundler/CMakeLists.txt b/tools/clang-offload-bundler/CMakeLists.txt
|
||||
index 8718015be76a..7a038f39622e 100644
|
||||
--- a/tools/clang-offload-bundler/CMakeLists.txt
|
||||
+++ b/tools/clang-offload-bundler/CMakeLists.txt
|
||||
@@ -22,4 +22,4 @@ 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-refactor/CMakeLists.txt b/tools/clang-refactor/CMakeLists.txt
|
||||
index d2029066b9b7..9bc152a675af 100644
|
||||
--- a/tools/clang-refactor/CMakeLists.txt
|
||||
+++ b/tools/clang-refactor/CMakeLists.txt
|
||||
@@ -21,4 +21,4 @@ target_link_libraries(clang-refactor
|
||||
clangToolingRefactor
|
||||
)
|
||||
|
||||
-install(TARGETS clang-refactor RUNTIME DESTINATION bin)
|
||||
+install(TARGETS clang-refactor RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
diff --git a/tools/clang-rename/CMakeLists.txt b/tools/clang-rename/CMakeLists.txt
|
||||
index 9689e1c6804d..6087716510a9 100644
|
||||
--- a/tools/clang-rename/CMakeLists.txt
|
||||
+++ b/tools/clang-rename/CMakeLists.txt
|
||||
@@ -16,8 +16,8 @@ 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/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
|
||||
index 44406378207b..3b64b18ad4a5 100644
|
||||
--- a/tools/libclang/CMakeLists.txt
|
||||
+++ b/tools/libclang/CMakeLists.txt
|
||||
@@ -130,7 +130,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
|
||||
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})
|
|
@ -13,7 +13,7 @@ stdenv.mkDerivation {
|
|||
inherit version;
|
||||
src = fetch "compiler-rt" "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm ];
|
||||
nativeBuildInputs = [ cmake python3 llvm.dev ];
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
|
@ -21,6 +21,7 @@ stdenv.mkDerivation {
|
|||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCOMPILER_RT_OS_DIR="
|
||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||
|
@ -54,6 +55,7 @@ stdenv.mkDerivation {
|
|||
./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||
# https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
|
||||
../../common/compiler-rt/glibc.patch
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
||||
|
@ -78,9 +80,7 @@ stdenv.mkDerivation {
|
|||
'';
|
||||
|
||||
# Hack around weird upsream RPATH bug
|
||||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
postInstall = lib.optionalString (useLLVM) ''
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/linux/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 4b953b212829..a10b69aa67dc 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 3.4.3)
|
||||
# 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)
|
||||
endif()
|
||||
|
||||
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
|
||||
index 139b6140011c..502354a37d67 100644
|
||||
--- a/cmake/Modules/AddCompilerRT.cmake
|
||||
+++ b/cmake/Modules/AddCompilerRT.cmake
|
||||
@@ -439,7 +439,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}
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_PREFIX}
|
||||
COMPONENT ${component})
|
||||
add_dependencies(${component} ${target_name})
|
||||
|
||||
@@ -456,7 +456,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 a25540bf46d1..77ea739fea74 100644
|
||||
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||
@@ -375,7 +375,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/base-config-ix.cmake b/cmake/base-config-ix.cmake
|
||||
index b208f0852408..cacf4e8fb69d 100644
|
||||
--- a/cmake/base-config-ix.cmake
|
||||
+++ b/cmake/base-config-ix.cmake
|
||||
@@ -46,11 +46,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.
|
||||
@@ -70,9 +70,9 @@ if(NOT DEFINED COMPILER_RT_OS_DIR)
|
||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
|
||||
endif()
|
||||
set(COMPILER_RT_LIBRARY_OUTPUT_DIR
|
||||
- ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
|
||||
+ ${COMPILER_RT_OUTPUT_DIR}/${CMAKE_INSTALL_FULL_LIBDIR}/${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})
|
||||
|
||||
if(APPLE)
|
||||
# On Darwin if /usr/include doesn't exist, the user probably has Xcode but not
|
||||
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
||||
index f7efb102ab63..ab8a94d9ff40 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -47,12 +47,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 2c486bff821b..0ee715da95f8 100644
|
||||
--- a/lib/dfsan/CMakeLists.txt
|
||||
+++ b/lib/dfsan/CMakeLists.txt
|
||||
@@ -44,4 +44,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})
|
||||
+ DESTINATION ${COMPILER_RT_INSTALL_PATH}/${CMAKE_INSTALL_PREFIX})
|
|
@ -1,6 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith
|
||||
, buildPackages
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
}:
|
||||
|
@ -18,35 +17,44 @@ let
|
|||
clang-tools-extra_src = fetch "clang-tools-extra" "1w8ml7fyn4vyxmy59n2qm4r1k1kgwgwkaldp6m45fdv4g0kkfbhd";
|
||||
|
||||
tools = lib.makeExtensible (tools: let
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch buildLlvmTools; });
|
||||
mkExtraBuildCommands = cc: ''
|
||||
rsrc="$out/resource-root"
|
||||
mkdir "$rsrc"
|
||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
|
||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
|
||||
in {
|
||||
|
||||
llvm = callPackage ./llvm { };
|
||||
libllvm = callPackage ./llvm { };
|
||||
|
||||
clang-unwrapped = callPackage ./clang {
|
||||
# `llvm` historically had the binaries. But this migration
|
||||
# technique also impedes `lib.get*`. Perhaps we will revisit it.
|
||||
llvm = tools.libllvm.out;
|
||||
|
||||
libllvm-polly = callPackage ./llvm { enablePolly = true; };
|
||||
|
||||
llvm-polly = tools.libllvm-polly.lib;
|
||||
|
||||
libclang = callPackage ./clang {
|
||||
inherit clang-tools-extra_src;
|
||||
};
|
||||
|
||||
llvm-manpages = lowPrio (tools.llvm.override {
|
||||
clang-unwrapped = tools.libclang.out;
|
||||
|
||||
llvm-manpages = lowPrio (tools.libllvm.override {
|
||||
enableManpages = true;
|
||||
enableSharedLibraries = false;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
|
||||
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
||||
clang-manpages = lowPrio (tools.libclang.override {
|
||||
enableManpages = true;
|
||||
python3 = pkgs.python3; # don't use python-boot
|
||||
});
|
||||
|
||||
libclang = tools.clang-unwrapped.lib;
|
||||
|
||||
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
||||
|
||||
libstdcxxClang = wrapCCWith rec {
|
||||
|
|
|
@ -11,7 +11,11 @@ stdenv.mkDerivation {
|
|||
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
||||
'';
|
||||
|
||||
patches = lib.optionals stdenv.hostPlatform.isMusl [
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optionals stdenv.hostPlatform.isMusl [
|
||||
../../libcxx-0001-musl-hacks.patch
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 9e8e9d5e3d9b..e1d6d2392b92 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -22,6 +22,8 @@ set(CMAKE_MODULE_PATH
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
project(libcxx CXX C)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
set(PACKAGE_NAME libcxx)
|
||||
set(PACKAGE_VERSION 6.0.0)
|
||||
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
|
||||
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
index 558e11ba2cc1..c6a99cec0191 100644
|
||||
--- a/cmake/Modules/HandleLibCXXABI.cmake
|
||||
+++ b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
@@ -55,7 +55,7 @@ macro(setup_abi_lib abidefines abilib abifiles abidirs)
|
||||
)
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
|
||||
- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
|
||||
+ DESTINATION ${LIBCXX_INSTALL_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 b98e09260ca1..c920f48697bc 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -20,7 +20,7 @@ endif()
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(DIRECTORY .
|
||||
- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
|
||||
+ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
|
||||
COMPONENT cxx-headers
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
@@ -44,7 +44,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
||||
set(generated_config_deps generate_config_header)
|
||||
# Install the generated header as __config.
|
||||
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
|
||||
- DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
|
||||
+ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_INCLUDEDIR}/c++/v1
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
RENAME __config
|
||||
COMPONENT cxx-headers)
|
||||
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
||||
index aa5ebf1568ec..36d85b94c3ba 100644
|
||||
--- a/lib/CMakeLists.txt
|
||||
+++ b/lib/CMakeLists.txt
|
||||
@@ -357,8 +357,8 @@ if (LIBCXX_INSTALL_LIBRARY)
|
||||
set(experimental_lib cxx_experimental)
|
||||
endif()
|
||||
install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
|
||||
- LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
||||
- ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
||||
+ LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
||||
+ ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} COMPONENT cxx
|
||||
)
|
||||
# NOTE: This install command must go after the cxx install command otherwise
|
||||
# it will not be executed after the library symlinks are installed.
|
||||
@@ -366,7 +366,7 @@ if (LIBCXX_INSTALL_LIBRARY)
|
||||
# Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx>
|
||||
# after we required CMake 3.0.
|
||||
install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||
- DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX}
|
||||
+ DESTINATION ${LIBCXX_INSTALL_PREFIX}${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX}
|
||||
COMPONENT libcxx)
|
||||
endif()
|
||||
endif()
|
|
@ -6,8 +6,7 @@ stdenv.mkDerivation {
|
|||
|
||||
src = fetch "libcxxabi" "0prqvdj317qrc8nddaq1hh2ag9algkd9wbkj3y4mr5588k12x7r0";
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
postUnpack = ''
|
||||
unpackFile ${libcxx.src}
|
||||
|
@ -19,6 +18,13 @@ stdenv.mkDerivation {
|
|||
patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
then ''
|
||||
for file in lib/*.dylib; do
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue