mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 15:56:50 +01:00
Merge pull request #182840 from doyougnu/bump_llvm_git
llvmPackages_git: 2022-01-07 -> 2022-25-07, add README
This commit is contained in:
commit
ede46e4f84
26 changed files with 448 additions and 740 deletions
79
pkgs/development/compilers/llvm/README.md
Normal file
79
pkgs/development/compilers/llvm/README.md
Normal file
|
@ -0,0 +1,79 @@
|
|||
## How to upgrade llvm_git
|
||||
|
||||
- Run `update-git.py`.
|
||||
This will set the github revision and sha256 for `llvmPackages_git.llvm` to whatever the latest chromium build is using.
|
||||
For a more recent, commit run `nix-prefetch-github` and change the rev and sha256 accordingly.
|
||||
|
||||
- That was the easy part.
|
||||
The hard part is updating the patch files.
|
||||
|
||||
The general process is:
|
||||
|
||||
1. Try to build `llvmPackages_git.llvm` and associated packages such as
|
||||
`clang` and `compiler-rt`. You can use the `-L` and `--keep-failed` flags to make
|
||||
debugging patch errors easy, e.g., `nix build .#llvmPackages_git.clang -L --keep-failed`
|
||||
|
||||
2. The build will error out with something similar to this:
|
||||
```sh
|
||||
...
|
||||
clang-unstable> patching sources
|
||||
clang-unstable> applying patch /nix/store/nndv6gq6w608n197fndvv5my4a5zg2qi-purity.patch
|
||||
clang-unstable> patching file lib/Driver/ToolChains/Gnu.cpp
|
||||
clang-unstable> Hunk #1 FAILED at 487.
|
||||
clang-unstable> 1 out of 1 hunk FAILED -- saving rejects to file lib/Driver/ToolChains/Gnu.cpp.rej
|
||||
note: keeping build directory '/tmp/nix-build-clang-unstable-2022-25-07.drv-17'
|
||||
error: builder for '/nix/store/zwi123kpkyz52fy7p6v23azixd807r8c-clang-unstable-2022-25-07.drv' failed with exit code 1;
|
||||
last 8 log lines:
|
||||
> unpacking sources
|
||||
> unpacking source archive /nix/store/mrxadx11wv1ckjr2208qgxp472pmmg6g-clang-src-unstable-2022-25-07
|
||||
> source root is clang-src-unstable-2022-25-07/clang
|
||||
> patching sources
|
||||
> applying patch /nix/store/nndv6gq6w608n197fndvv5my4a5zg2qi-purity.patch
|
||||
> patching file lib/Driver/ToolChains/Gnu.cpp
|
||||
> Hunk #1 FAILED at 487.
|
||||
> 1 out of 1 hunk FAILED -- saving rejects to file lib/Driver/ToolChains/Gnu.cpp.rej
|
||||
For full logs, run 'nix log /nix/store/zwi123kpkyz52fy7p6v23azixd807r8c-clang-unstable-2022-25-07.drv'.
|
||||
note: keeping build directory '/tmp/nix-build-compiler-rt-libc-unstable-2022-25-07.drv-20'
|
||||
error: 1 dependencies of derivation '/nix/store/ndbbh3wrl0l39b22azf46f1n7zlqwmag-clang-wrapper-unstable-2022-25-07.drv' failed to build
|
||||
```
|
||||
|
||||
Notice the `Hunk #1 Failed at 487` line.
|
||||
The lines above show us that the `purity.patch` failed on `lib/Driver/ToolChains/Gnu.cpp` when compiling `clang`.
|
||||
|
||||
3. The task now is to cross reference the hunks in the purity patch with
|
||||
`lib/Driver/ToolCahins/Gnu.cpp.orig` to see why the patch failed.
|
||||
The `.orig` file will be in the build directory referenced in the line `note: keeping build directory ...`;
|
||||
this message results from the `--keep-failed` flag.
|
||||
|
||||
4. Now you should be able to open whichever patch failed, and the `foo.orig` file that it failed on.
|
||||
Correct the patch by adapting it to the new code and be mindful of whitespace;
|
||||
which can be an easily missed reason for failures.
|
||||
For cases where the hunk is no longer needed you can simply remove it from the patch.
|
||||
|
||||
This is fine for small corrections, but when more serious changes are needed its better to use git.
|
||||
|
||||
1. Clone the LLVM monorepo at https://github.com/llvm/llvm-project/
|
||||
|
||||
2. Check out the revision we were using before.
|
||||
|
||||
3. Use `patch -p1 < path/to-path` in the project subdirectories to apply the patches and commit.
|
||||
|
||||
4. Use `git rebase HEAD^ --onto <dest>` to rebase the patches onto the new revision we are trying to build, and fix all conflicts.
|
||||
|
||||
5. Use `git diff HEAD^:<project> HEAD:<project>` to get subdir diff to write back to Nixpkgs.
|
||||
|
||||
## Information on our current patch sets
|
||||
|
||||
### "GNU Install Dirs" patches
|
||||
|
||||
Use CMake's [`GNUInstallDirs`](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html) to support multiple outputs.
|
||||
|
||||
Previously, LLVM Just hard-coded `bin`, `include`, and `lib${LLVM_TARGET_PREFIX}`.
|
||||
We are making it use these variables.
|
||||
|
||||
For the older LLVM versions, these patches live in https://github.com/Ericson2314/llvm-project branches `split-prefix`.
|
||||
Instead of applying the patches to the worktree per the above instructions, one can checkout those directly and rebase those instead.
|
||||
|
||||
For newer LLVM versions, enough has has been upstreamed,
|
||||
(see https://reviews.llvm.org/differential/query/5UAfpj_9zHwY/ for my progress upstreaming),
|
||||
that I have just assembled new gnu-install-dirs patches from the remaining unmerged patches instead of rebasing from the prior LLVM's gnu install dirs patch.
|
|
@ -15,6 +15,7 @@ let
|
|||
mkdir -p "$out"
|
||||
cp -r ${monorepoSrc}/cmake "$out"
|
||||
cp -r ${monorepoSrc}/${pname} "$out"
|
||||
cp -r ${monorepoSrc}/clang-tools-extra "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/${pname}";
|
||||
|
@ -26,6 +27,7 @@ let
|
|||
buildInputs = [ libxml2 libllvm ];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCLANG_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/clang"
|
||||
"-DCMAKE_CXX_FLAGS=-std=c++14"
|
||||
"-DCLANGD_BUILD_XPC=OFF"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
|
@ -71,7 +73,7 @@ let
|
|||
# Move libclang to 'lib' output
|
||||
moveToOutput "lib/libclang.*" "$lib"
|
||||
moveToOutput "lib/libclang-cpp.*" "$lib"
|
||||
substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
|
||||
substituteInPlace $dev/lib/cmake/clang/ClangTargets-release.cmake \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." \
|
||||
--replace "\''${_IMPORT_PREFIX}/lib/libclang-cpp." "$lib/lib/libclang-cpp."
|
||||
|
||||
|
|
|
@ -1,164 +1,69 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 7ea37850ad60..ac0f2d4f60b4 100644
|
||||
index c27beec313d7..480f13e73c9f 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)
|
||||
@@ -78,15 +78,17 @@ if(CLANG_BUILT_STANDALONE)
|
||||
if (NOT LLVM_CONFIG_FOUND)
|
||||
# Pull values from LLVMConfig.cmake. We can drop this once the llvm-config
|
||||
# path is removed.
|
||||
- set(MAIN_INCLUDE_DIR "${LLVM_INCLUDE_DIR}")
|
||||
+ set(INCLUDE_DIRS ${LLVM_INCLUDE_DIRS})
|
||||
set(LLVM_OBJ_DIR "${LLVM_BINARY_DIR}")
|
||||
# N.B. this is just a default value, the CACHE PATHs below can be overriden.
|
||||
set(MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm")
|
||||
set(TOOLS_BINARY_DIR "${LLVM_TOOLS_BINARY_DIR}")
|
||||
set(LIBRARY_DIR "${LLVM_LIBRARY_DIR}")
|
||||
+ else()
|
||||
+ set(INCLUDE_DIRS "${LLVM_BINARY_DIR}/include" "${MAIN_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
+ 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)
|
||||
@@ -424,7 +426,7 @@ include_directories(BEFORE
|
||||
- set(LLVM_MAIN_INCLUDE_DIR "${MAIN_INCLUDE_DIR}" CACHE PATH "Path to llvm/include")
|
||||
+ set(LLVM_INCLUDE_DIRS ${INCLUDE_DIRS} CACHE PATH "Path to llvm/include and any other header dirs needed")
|
||||
set(LLVM_BINARY_DIR "${LLVM_OBJ_ROOT}" CACHE PATH "Path to LLVM build tree")
|
||||
set(LLVM_MAIN_SRC_DIR "${MAIN_SRC_DIR}" CACHE PATH "Path to LLVM source tree")
|
||||
set(LLVM_TOOLS_BINARY_DIR "${TOOLS_BINARY_DIR}" CACHE PATH "Path to llvm/bin")
|
||||
@@ -128,7 +130,7 @@ if(CLANG_BUILT_STANDALONE)
|
||||
set(LLVM_INCLUDE_TESTS ON)
|
||||
endif()
|
||||
|
||||
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"
|
||||
@@ -433,7 +435,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
)
|
||||
- include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
|
||||
+ include_directories(${LLVM_INCLUDE_DIRS})
|
||||
link_directories("${LLVM_LIBRARY_DIR}")
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang
|
||||
- DESTINATION include
|
||||
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
COMPONENT clang-headers
|
||||
FILES_MATCHING
|
||||
PATTERN "CMakeFiles" EXCLUDE
|
||||
@@ -453,7 +455,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
|
||||
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
|
||||
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
|
||||
index 5752f4277444..5bf08dbf5e83 100644
|
||||
index 21ac332e4f5f..b16c314bd1e2 100644
|
||||
--- a/cmake/modules/AddClang.cmake
|
||||
+++ b/cmake/modules/AddClang.cmake
|
||||
@@ -118,9 +118,9 @@ macro(add_clang_library name)
|
||||
@@ -119,8 +119,8 @@ 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})
|
||||
+ 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}
|
||||
@@ -159,7 +159,7 @@ macro(add_clang_tool name)
|
||||
get_target_export_arg(${name} Clang export_to_clangtargets)
|
||||
install(TARGETS ${name}
|
||||
${export_to_clangtargets}
|
||||
- RUNTIME DESTINATION bin
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT ${name})
|
||||
|
||||
if(NOT LLVM_ENABLE_IDE)
|
||||
@@ -174,7 +174,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 078988980c52..14b58614b40a 100644
|
||||
index 6e2060991b92..b9bc930d26b8 100644
|
||||
--- a/lib/Headers/CMakeLists.txt
|
||||
+++ b/lib/Headers/CMakeLists.txt
|
||||
@@ -234,7 +234,7 @@ set_target_properties(clang-resource-headers PROPERTIES
|
||||
FOLDER "Misc"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
|
||||
@@ -420,7 +420,7 @@ add_header_target("openmp-resource-headers" ${openmp_wrapper_files})
|
||||
add_header_target("windows-resource-headers" ${windows_only_files})
|
||||
add_header_target("utility-resource-headers" ${utility_files})
|
||||
|
||||
-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 99c6081db2d6..0887102febb3 100644
|
||||
--- a/tools/c-index-test/CMakeLists.txt
|
||||
+++ b/tools/c-index-test/CMakeLists.txt
|
||||
@@ -49,7 +49,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)
|
||||
#############################################################
|
||||
# Install rules for the catch-all clang-resource-headers target
|
||||
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
|
||||
index bf88dca0a34b..7a10181e7738 100644
|
||||
index 8d95d0900e8c..ebc70ff7526d 100644
|
||||
--- a/tools/libclang/CMakeLists.txt
|
||||
+++ b/tools/libclang/CMakeLists.txt
|
||||
@@ -186,7 +186,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
|
||||
@@ -216,7 +216,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
|
||||
@@ -180,7 +180,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
|
||||
COMPONENT
|
||||
libclang-python-bindings
|
||||
DESTINATION
|
||||
|
@ -167,69 +72,34 @@ index bf88dca0a34b..7a10181e7738 100644
|
|||
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 74334e53c9b1..ebaae33e4324 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()
|
||||
diff --git a/tools/scan-build-py/CMakeLists.txt b/tools/scan-build-py/CMakeLists.txt
|
||||
index 061dc7ef4dd9..adc54b2edc32 100644
|
||||
--- a/tools/scan-build-py/CMakeLists.txt
|
||||
+++ b/tools/scan-build-py/CMakeLists.txt
|
||||
@@ -88,7 +88,7 @@ foreach(lib ${LibScanbuild})
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/${lib})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/${lib})
|
||||
install(PROGRAMS lib/libscanbuild/${lib}
|
||||
- DESTINATION lib/libscanbuild
|
||||
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libscanbuild"
|
||||
COMPONENT scan-build-py)
|
||||
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()
|
||||
@@ -106,7 +106,7 @@ foreach(resource ${LibScanbuildResources})
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/resources/${resource})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources/${resource})
|
||||
install(PROGRAMS lib/libscanbuild/resources/${resource}
|
||||
- DESTINATION lib/libscanbuild/resources
|
||||
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libscanbuild/resources"
|
||||
COMPONENT scan-build-py)
|
||||
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()
|
||||
@@ -122,7 +122,7 @@ foreach(lib ${LibEar})
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libear/${lib})
|
||||
list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libear/${lib})
|
||||
install(PROGRAMS lib/libear/${lib}
|
||||
- DESTINATION lib/libear
|
||||
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/libear"
|
||||
COMPONENT scan-build-py)
|
||||
endforeach()
|
||||
|
||||
diff --git a/tools/scan-view/CMakeLists.txt b/tools/scan-view/CMakeLists.txt
|
||||
index eccc6b83195b..ff72d9cf0666 100644
|
||||
--- a/tools/scan-view/CMakeLists.txt
|
||||
+++ b/tools/scan-view/CMakeLists.txt
|
||||
@@ -20,7 +20,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()
|
||||
|
||||
@@ -34,7 +34,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})
|
||||
|
|
|
@ -11,12 +11,13 @@ diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
|
|||
index fe3c0191bb..c6a482bece 100644
|
||||
--- a/lib/Driver/ToolChains/Gnu.cpp
|
||||
+++ b/lib/Driver/ToolChains/Gnu.cpp
|
||||
@@ -487,12 +487,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
if (!IsStatic) {
|
||||
@@ -487,13 +487,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
} else {
|
||||
if (Args.hasArg(options::OPT_rdynamic))
|
||||
CmdArgs.push_back("-export-dynamic");
|
||||
-
|
||||
- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
|
||||
|
||||
- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE &&
|
||||
- !Args.hasArg(options::OPT_r)) {
|
||||
- CmdArgs.push_back("-dynamic-linker");
|
||||
- CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
|
||||
- ToolChain.getDynamicLinker(Args)));
|
||||
|
|
|
@ -2,7 +2,7 @@ diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
|
|||
index 3a66dd9c3fb..7efc85d9f9f 100644
|
||||
--- a/lib/builtins/CMakeLists.txt
|
||||
+++ b/lib/builtins/CMakeLists.txt
|
||||
@@ -345,4 +345,8 @@ if (NOT MSVC)
|
||||
@@ -348,4 +348,8 @@ if (NOT MSVC)
|
||||
|
||||
+ set(i486_SOURCES ${i386_SOURCES})
|
||||
+ set(i586_SOURCES ${i386_SOURCES})
|
||||
|
@ -11,7 +11,7 @@ index 3a66dd9c3fb..7efc85d9f9f 100644
|
|||
if (WIN32)
|
||||
set(i386_SOURCES
|
||||
${i386_SOURCES}
|
||||
@@ -608,6 +612,7 @@ else ()
|
||||
@@ -723,6 +723,7 @@ else ()
|
||||
endif()
|
||||
|
||||
foreach (arch ${BUILTIN_SUPPORTED_ARCH})
|
||||
|
|
|
@ -66,7 +66,6 @@ stdenv.mkDerivation {
|
|||
outputs = [ "out" "dev" ];
|
||||
|
||||
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
|
||||
|
|
|
@ -1,30 +1,8 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c5003b5efa1d..4fffb9721284 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.4)
|
||||
|
||||
+include(GNUInstallDirs)
|
||||
+
|
||||
# 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)
|
||||
diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
|
||||
index 1ada0ab30ba0..b4be6c4a3c73 100644
|
||||
index 8a6219568b3f..30ee68a47ccf 100644
|
||||
--- a/cmake/base-config-ix.cmake
|
||||
+++ b/cmake/base-config-ix.cmake
|
||||
@@ -66,7 +66,7 @@ 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 "" CACHE PATH
|
||||
@@ -98,23 +98,23 @@ endif()
|
||||
@@ -100,13 +100,13 @@ endif()
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(COMPILER_RT_OUTPUT_LIBRARY_DIR
|
||||
${COMPILER_RT_OUTPUT_DIR}/lib)
|
||||
|
@ -40,16 +18,3 @@ index 1ada0ab30ba0..b4be6c4a3c73 100644
|
|||
set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
|
||||
"Path where built compiler-rt libraries should be installed.")
|
||||
endif()
|
||||
-extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" bin)
|
||||
+extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_BINDIR}")
|
||||
set(COMPILER_RT_INSTALL_BINARY_DIR "${default_install_path}" CACHE PATH
|
||||
"Path where built compiler-rt executables should be installed.")
|
||||
-extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" include)
|
||||
+extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(COMPILER_RT_INSTALL_INCLUDE_DIR "${default_install_path}" CACHE PATH
|
||||
"Path where compiler-rt headers should be installed.")
|
||||
-extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" share)
|
||||
+extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_DATADIR}")
|
||||
set(COMPILER_RT_INSTALL_DATA_DIR "${default_install_path}" CACHE PATH
|
||||
"Path where compiler-rt data files should be installed.")
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
}:
|
||||
|
||||
let
|
||||
release_version = "14.0.0";
|
||||
release_version = "15.0.0";
|
||||
candidate = ""; # empty or "rcN"
|
||||
dash-candidate = lib.optionalString (candidate != "") "-${candidate}";
|
||||
rev = "fb1582f6c54422995c6fb61ba4c55126b357f64e"; # When using a Git commit
|
||||
rev-version = "unstable-2022-01-07"; # When using a Git commit
|
||||
rev = "a5640968f2f7485b2aa4919f5fa68fd8f23e2d1f"; # When using a Git commit
|
||||
rev-version = "unstable-2022-26-07"; # When using a Git commit
|
||||
version = if rev != "" then rev-version else "${release_version}${dash-candidate}";
|
||||
targetConfig = stdenv.targetPlatform.config;
|
||||
|
||||
|
@ -30,7 +30,7 @@ let
|
|||
owner = "llvm";
|
||||
repo = "llvm-project";
|
||||
rev = if rev != "" then rev else "llvmorg-${version}";
|
||||
sha256 = "1pkgdsscvf59i22ix763lp2z3sg0v2z2ywh0n07k3ki7q1qpqbhk";
|
||||
sha256 = "1sh5xihdfdn2hp7ds3lkaq1bfrl4alj36gl1aidmhlw65p5rdvl7";
|
||||
};
|
||||
|
||||
llvm_meta = {
|
||||
|
@ -158,16 +158,17 @@ let
|
|||
] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
|
||||
echo "-lunwind" >> $out/nix-support/cc-ldflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
nixSupport.cc-cflags =
|
||||
[ "-rtlib=compiler-rt"
|
||||
"-Wno-unused-command-line-argument"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
]
|
||||
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
|
||||
++ lib.optional
|
||||
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
|
||||
"-lunwind"
|
||||
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
|
||||
};
|
||||
|
||||
clangNoLibcxx = wrapCCWith rec {
|
||||
|
@ -177,11 +178,12 @@ let
|
|||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
echo "-nostdlib++" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
nixSupport.cc-cflags = [
|
||||
"-rtlib=compiler-rt"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
"-nostdlib++"
|
||||
];
|
||||
};
|
||||
|
||||
clangNoLibc = wrapCCWith rec {
|
||||
|
@ -191,10 +193,11 @@ let
|
|||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
extraBuildCommands = mkExtraBuildCommands cc;
|
||||
nixSupport.cc-cflags = [
|
||||
"-rtlib=compiler-rt"
|
||||
"-B${targetLlvmLibraries.compiler-rt}/lib"
|
||||
];
|
||||
};
|
||||
|
||||
clangNoCompilerRt = wrapCCWith rec {
|
||||
|
@ -202,9 +205,8 @@ let
|
|||
libcxx = null;
|
||||
bintools = bintoolsNoLibc';
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands0 cc;
|
||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||
nixSupport.cc-cflags = [ "-nostartfiles" ];
|
||||
};
|
||||
|
||||
clangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||
|
|
|
@ -29,18 +29,29 @@ stdenv.mkDerivation rec {
|
|||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/third-party "$out"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/${basename}";
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";
|
||||
|
||||
prePatch = ''
|
||||
cd ../${basename}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
] ++ lib.optionals stdenv.hostPlatform.isMusl [
|
||||
../../libcxx-0001-musl-hacks.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
'';
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patchShebangs utils/cat_files.py
|
||||
'';
|
||||
|
@ -50,7 +61,10 @@ stdenv.mkDerivation rec {
|
|||
|
||||
buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
|
||||
|
||||
cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ]
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxx"
|
||||
"-DLIBCXX_CXX_ABI=${lib.optionalString (!headersOnly) "system-"}libcxxabi"
|
||||
] ++ lib.optional (!headersOnly) "-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${libcxxabi.dev}/include/c++/v1"
|
||||
++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||
++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
||||
++ lib.optionals stdenv.hostPlatform.isWasm [
|
||||
|
@ -62,15 +76,6 @@ stdenv.mkDerivation rec {
|
|||
buildFlags = lib.optional headersOnly "generate-cxx-headers";
|
||||
installTargets = lib.optional headersOnly "install-cxx-headers";
|
||||
|
||||
# At this point, cxxabi headers would be installed in the dev output, which
|
||||
# prevents moveToOutput from doing its job later in the build process.
|
||||
postInstall = lib.optionalString (!headersOnly) ''
|
||||
mv "$dev/include/c++/v1/"* "$out/include/c++/v1/"
|
||||
pushd "$dev"
|
||||
rmdir -p include/c++/v1
|
||||
popd
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isLLVM = true;
|
||||
};
|
||||
|
|
|
@ -1,85 +1,22 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b0569a4a54ca..7d665f5a3258 100644
|
||||
index 74eff2002fc9..c935d10878bb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -10,6 +10,8 @@ endif()
|
||||
#===============================================================================
|
||||
cmake_minimum_required(VERSION 3.13.4)
|
||||
|
||||
+include(GNUInstallDirs)
|
||||
+
|
||||
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
|
||||
|
||||
# Add path for custom modules
|
||||
@@ -415,13 +417,13 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
@@ -419,7 +419,7 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
- set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
"Path where built libc++ runtime libraries should be installed.")
|
||||
- set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH
|
||||
"Path where target-agnostic libc++ headers should be installed.")
|
||||
- set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
|
||||
@@ -431,11 +433,11 @@ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
|
||||
@@ -436,7 +436,7 @@ else()
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
|
||||
endif()
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
- set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}/c++/v1" CACHE PATH
|
||||
"Path where built libc++ runtime libraries should be installed.")
|
||||
- set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH
|
||||
"Path where target-agnostic libc++ headers should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
@@ -443,11 +445,11 @@ else()
|
||||
set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
|
||||
set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
|
||||
set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
|
||||
- set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++ libraries should be installed.")
|
||||
- set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
"Path where built libc++ runtime libraries should be installed.")
|
||||
- set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
|
||||
+ set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH
|
||||
"Path where target-agnostic libc++ headers should be installed.")
|
||||
set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH
|
||||
"Path where target-specific libc++ headers should be installed.")
|
||||
diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
index 5a8a4a270a1a..d69405ddeeac 100644
|
||||
--- a/cmake/Modules/HandleLibCXXABI.cmake
|
||||
+++ b/cmake/Modules/HandleLibCXXABI.cmake
|
||||
@@ -1,8 +1,9 @@
|
||||
-
|
||||
#===============================================================================
|
||||
# Add an ABI library if appropriate
|
||||
#===============================================================================
|
||||
|
||||
+include(GNUInstallDirs)
|
||||
+
|
||||
#
|
||||
# _setup_abi: Set up the build to use an ABI library
|
||||
#
|
||||
@@ -63,7 +64,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
|
||||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
|
||||
- DESTINATION include/c++/v1/${dstdir}
|
||||
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}"
|
||||
COMPONENT cxx-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
|
|
|
@ -18,9 +18,11 @@ stdenv.mkDerivation rec {
|
|||
cp -r ${monorepoSrc}/libcxx/src/include "$out/libcxx/src"
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/${pname}";
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
|
@ -30,14 +32,25 @@ stdenv.mkDerivation rec {
|
|||
patch -p1 -d llvm -i ${./wasm.patch}
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
cd ../${pname}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
./skip-other-project-tests.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake python3 ];
|
||||
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libcxxabi"
|
||||
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
|
||||
] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
|
||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||
|
@ -49,28 +62,20 @@ stdenv.mkDerivation rec {
|
|||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||
];
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
then ''
|
||||
for file in lib/*.dylib; do
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
install_name_tool -id $out/$file $file
|
||||
done
|
||||
make install
|
||||
install -d 755 $out/include
|
||||
install -m 644 ../include/*.h $out/include
|
||||
''
|
||||
else ''
|
||||
install -d -m 755 $out/include $out/lib
|
||||
install -m 644 lib/libc++abi.a $out/lib
|
||||
install -m 644 ../include/cxxabi.h $out/include
|
||||
'' + lib.optionalString enableShared ''
|
||||
install -m 644 lib/libc++abi.so.1.0 $out/lib
|
||||
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
|
||||
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
|
||||
'';
|
||||
preInstall = lib.optionalString stdenv.isDarwin ''
|
||||
for file in lib/*.dylib; do
|
||||
# this should be done in CMake, but having trouble figuring out
|
||||
# the magic combination of necessary CMake variables
|
||||
# if you fancy a try, take a look at
|
||||
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||
install_name_tool -id $out/$file $file
|
||||
done
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p "$dev/include"
|
||||
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
||||
'';
|
||||
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://libcxxabi.llvm.org/";
|
||||
|
|
|
@ -1,46 +1,22 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 858f5d5cfd7f..16c67d7062be 100644
|
||||
index b8326d08d23a..a1e36f713161 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -10,6 +10,8 @@ endif()
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.4)
|
||||
|
||||
+include(GNUInstallDirs)
|
||||
+
|
||||
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
|
||||
|
||||
# Add path for custom modules
|
||||
@@ -213,9 +215,9 @@ set(CMAKE_MODULE_PATH
|
||||
@@ -187,7 +187,7 @@ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
- set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
"Path where built libc++abi runtime libraries should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
|
||||
@@ -224,16 +226,16 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
@@ -201,7 +201,7 @@ else()
|
||||
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
- set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
"Path where built libc++abi runtime libraries should be installed.")
|
||||
else()
|
||||
set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
|
||||
- set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libc++abi libraries should be installed.")
|
||||
- set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
+ set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
"Path where built libc++abi runtime libraries should be installed.")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -131,10 +131,21 @@ if (NOT LIBCXXABI_ENABLE_SHARED AND NOT LIBCXXABI_ENABLE_STATIC)
|
||||
message(FATAL_ERROR "libc++abi must be built as either a shared or static library.")
|
||||
endif()
|
||||
|
||||
-# TODO: Remove this, which shouldn't be necessary since we know we're being built
|
||||
-# side-by-side with libc++.
|
||||
set(LIBCXXABI_LIBCXX_INCLUDES "" CACHE PATH
|
||||
"Specify path to libc++ includes.")
|
||||
+if (NOT libcxx IN_LIST LLVM_ENABLE_RUNTIMES)
|
||||
+ if (NOT IS_DIRECTORY ${LIBCXXABI_LIBCXX_INCLUDES})
|
||||
+ message(FATAL_ERROR
|
||||
+ "LIBCXXABI_LIBCXX_INCLUDES=${LIBCXXABI_LIBCXX_INCLUDES} is not a valid directory. "
|
||||
+ "Please provide the path to where the libc++ headers have been installed.")
|
||||
+ endif()
|
||||
+ add_library(cxx-headers INTERFACE)
|
||||
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
|
||||
+ target_compile_options(cxx-headers INTERFACE /I "${LIBCXXABI_LIBCXX_INCLUDES}")
|
||||
+ else()
|
||||
+ target_compile_options(cxx-headers INTERFACE -I "${LIBCXXABI_LIBCXX_INCLUDES}")
|
||||
+ endif()
|
||||
+endif()
|
||||
|
||||
set(LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT OFF)
|
||||
if (WIN32)
|
||||
--- a/test/CMakeLists.txt
|
||||
+++ b/test/CMakeLists.txt
|
||||
@@ -61,9 +61,13 @@ if (LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
|
||||
list(APPEND LIBCXXABI_TEST_DEPS cxx_external_threads)
|
||||
endif()
|
||||
|
||||
-list(APPEND LIBCXXABI_TEST_DEPS cxx)
|
||||
-if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
|
||||
- list(APPEND LIBCXXABI_TEST_DEPS unwind)
|
||||
+if(libcxx IN_LIST LLVM_ENABLE_RUNTIMES)
|
||||
+ list(APPEND LIBCXXABI_TEST_DEPS cxx)
|
||||
+endif()
|
||||
+if(libunwind IN_LIST LLVM_ENABLE_RUNTIMES)
|
||||
+ if (LIBCXXABI_USE_LLVM_UNWINDER AND TARGET unwind)
|
||||
+ list(APPEND LIBCXXABI_TEST_DEPS unwind)
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")
|
|
@ -1,6 +1,7 @@
|
|||
{ lib, stdenv, llvm_meta, version
|
||||
, monorepoSrc, runCommand
|
||||
, cmake
|
||||
, python3
|
||||
, enableShared ? !stdenv.hostPlatform.isStatic
|
||||
}:
|
||||
|
||||
|
@ -19,19 +20,32 @@ stdenv.mkDerivation rec {
|
|||
cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx"
|
||||
mkdir -p "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
|
||||
cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
|
||||
cp -r ${monorepoSrc}/runtimes "$out"
|
||||
'';
|
||||
|
||||
sourceRoot = "${src.name}/${pname}";
|
||||
sourceRoot = "${src.name}/runtimes";
|
||||
|
||||
prePatch = ''
|
||||
cd ../${pname}
|
||||
chmod -R u+w .
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cd ../runtimes
|
||||
'';
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
nativeBuildInputs = [ cmake python3 ];
|
||||
|
||||
cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
|
||||
cmakeFlags = [
|
||||
"-DLLVM_ENABLE_RUNTIMES=libunwind"
|
||||
] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
|
||||
|
||||
meta = llvm_meta // {
|
||||
# Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst
|
||||
|
|
|
@ -1,65 +1,22 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index e3cc66dd2226..1299b596ce0d 100644
|
||||
index 5a06805f05f1..86a50329e6a8 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -8,6 +8,8 @@ endif()
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.4)
|
||||
|
||||
+include(GNUInstallDirs)
|
||||
+
|
||||
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
|
||||
|
||||
# Add path for custom modules
|
||||
@@ -139,25 +141,27 @@ set(CMAKE_MODULE_PATH
|
||||
@@ -117,7 +117,7 @@ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
|
||||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
|
||||
set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
|
||||
- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
+ set(LIBUNWIND_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE PATH
|
||||
+ "Path where built libunwind headers should be installed.")
|
||||
+ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
|
||||
"Path where built libunwind libraries should be installed.")
|
||||
- set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
+ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
"Path where built libunwind runtime libraries should be installed.")
|
||||
if(LIBCXX_LIBDIR_SUBDIR)
|
||||
string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
|
||||
string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
|
||||
@@ -129,7 +129,7 @@ else()
|
||||
else()
|
||||
set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
-elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
- set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
|
||||
- "Path where built libunwind libraries should be installed.")
|
||||
- set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
- "Path where built libunwind runtime libraries should be installed.")
|
||||
else()
|
||||
- set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
|
||||
- set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
|
||||
+ if(LLVM_LIBRARY_OUTPUT_INTDIR)
|
||||
+ set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
|
||||
+ else()
|
||||
+ set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
|
||||
+ endif()
|
||||
+ set(LIBUNWIND_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH
|
||||
+ "Path where built libunwind headers should be installed.")
|
||||
+ set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
|
||||
"Path where built libunwind libraries should be installed.")
|
||||
- set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
|
||||
+ set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
|
||||
"Path where built libunwind runtime libraries should be installed.")
|
||||
endif()
|
||||
|
||||
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
||||
index c3bb1dd0f69f..adf1766c44cb 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -14,7 +14,7 @@ if(LIBUNWIND_INSTALL_HEADERS)
|
||||
foreach(file ${files})
|
||||
get_filename_component(dir ${file} DIRECTORY)
|
||||
install(FILES ${file}
|
||||
- DESTINATION "include/${dir}"
|
||||
+ DESTINATION "${LIBUNWIND_INSTALL_INCLUDE_DIR}/${dir}"
|
||||
COMPONENT unwind-headers
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
)
|
||||
|
|
|
@ -25,16 +25,14 @@ stdenv.mkDerivation rec {
|
|||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
# On Darwin the llvm-config is perhaps not working fine as the
|
||||
# LLVM_MAIN_SRC_DIR is not getting set correctly, and the build fails as
|
||||
# the include path is not correct.
|
||||
./fix-root-src-dir.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
buildInputs = [ libllvm libxml2 ];
|
||||
|
||||
cmakeFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
cmakeFlags = [
|
||||
"-DLLD_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/lld"
|
||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
|
||||
];
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
|
||||
index e1a29b884d17..9d542f8fbfc1 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -64,7 +64,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
|
||||
set(LLVM_MAIN_INCLUDE_DIR ${MAIN_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
|
||||
set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
|
||||
- set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
|
||||
+ set(LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" CACHE PATH "Path to LLVM source tree")
|
||||
|
||||
find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
|
||||
NO_DEFAULT_PATH)
|
|
@ -1,5 +1,36 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index dcc649629a4b..58dca54642e4 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -70,13 +70,15 @@ if(LLD_BUILT_STANDALONE)
|
||||
if (NOT LLVM_CONFIG_FOUND)
|
||||
# Pull values from LLVMConfig.cmake. We can drop this once the llvm-config
|
||||
# path is removed.
|
||||
- set(MAIN_INCLUDE_DIR "${LLVM_INCLUDE_DIR}")
|
||||
+ set(INCLUDE_DIRS ${LLVM_INCLUDE_DIRS})
|
||||
set(LLVM_OBJ_DIR "${LLVM_BINARY_DIR}")
|
||||
# N.B. this is just a default value, the CACHE PATHs below can be overridden.
|
||||
set(MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm")
|
||||
+ else()
|
||||
+ set(INCLUDE_DIRS "${LLVM_BINARY_DIR}/include" "${MAIN_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
- set(LLVM_MAIN_INCLUDE_DIR "${MAIN_INCLUDE_DIR}" CACHE PATH "Path to llvm/include")
|
||||
+ set(LLVM_INCLUDE_DIRS ${INCLUDE_DIRS} CACHE PATH "Path to llvm/include and any other header dirs needed")
|
||||
set(LLVM_BINARY_DIR "${LLVM_OBJ_ROOT}" CACHE PATH "Path to LLVM build tree")
|
||||
set(LLVM_MAIN_SRC_DIR "${MAIN_SRC_DIR}" CACHE PATH "Path to LLVM source tree")
|
||||
|
||||
@@ -95,7 +97,7 @@ if(LLD_BUILT_STANDALONE)
|
||||
|
||||
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
|
||||
|
||||
- include_directories("${LLVM_BINARY_DIR}/include" ${LLVM_INCLUDE_DIRS})
|
||||
+ include_directories(${LLVM_INCLUDE_DIRS})
|
||||
link_directories(${LLVM_LIBRARY_DIRS})
|
||||
|
||||
if(LLVM_INCLUDE_TESTS)
|
||||
diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
|
||||
index dd2898ce6236..ebbea040ff54 100644
|
||||
index d3924f7243d4..42a7cd62281c 100644
|
||||
--- a/cmake/modules/AddLLD.cmake
|
||||
+++ b/cmake/modules/AddLLD.cmake
|
||||
@@ -18,8 +18,8 @@ macro(add_lld_library name)
|
||||
|
@ -13,10 +44,3 @@ index dd2898ce6236..ebbea040ff54 100644
|
|||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
|
||||
if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@@ -62,5 +62,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()
|
||||
|
|
|
@ -1,16 +1,3 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 79d451965ed4..78188978d6de 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -12,6 +12,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 3291a7c808e1..b27d27ce6a87 100644
|
||||
--- a/cmake/modules/AddLLDB.cmake
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
--- a/source/Plugins/Process/Linux/Procfs.h
|
||||
+++ b/source/Plugins/Process/Linux/Procfs.h
|
||||
@@ -11,21 +11,12 @@
|
||||
@@ -10,6 +10,7 @@
|
||||
// sys/procfs.h on Android/Linux for all supported architectures.
|
||||
|
||||
#include <sys/ptrace.h>
|
||||
+#include <asm/ptrace.h>
|
||||
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
@@ -17,23 +18,13 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
-#ifdef __ANDROID__
|
||||
-#if defined(__arm64__) || defined(__aarch64__)
|
||||
-typedef unsigned long elf_greg_t;
|
||||
|
@ -29,3 +35,6 @@
|
|||
#include <sys/procfs.h>
|
||||
-#endif // __ANDROID__
|
||||
+#endif
|
||||
|
||||
namespace lldb_private {
|
||||
namespace process_linux {
|
||||
|
|
|
@ -89,6 +89,9 @@ in stdenv.mkDerivation (rec {
|
|||
rm test/DebugInfo/X86/convert-inlined.ll
|
||||
rm test/DebugInfo/X86/convert-linked.ll
|
||||
rm test/tools/dsymutil/X86/op-convert.test
|
||||
rm test/tools/gold/X86/split-dwarf.ll
|
||||
rm test/tools/llvm-dwarfdump/X86/prettyprint_types.s
|
||||
rm test/tools/llvm-dwarfdump/X86/simplified-template-names.s
|
||||
'' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
|
||||
# Seems to require certain floating point hardware (NEON?)
|
||||
rm test/ExecutionEngine/frem.ll
|
||||
|
@ -114,7 +117,7 @@ in stdenv.mkDerivation (rec {
|
|||
# Some flags don't need to be repassed because LLVM already does so (like
|
||||
# CMAKE_BUILD_TYPE), others are irrelevant to the result.
|
||||
flagsForLlvmConfig = [
|
||||
"-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
|
||||
"-DLLVM_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/cmake/llvm"
|
||||
"-DLLVM_ENABLE_RTTI=ON"
|
||||
] ++ optionals enableSharedLibraries [
|
||||
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
||||
|
@ -194,7 +197,7 @@ in stdenv.mkDerivation (rec {
|
|||
--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"'")'
|
||||
--replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "'"$lib"'")'
|
||||
''
|
||||
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
|
||||
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
|
||||
|
@ -209,6 +212,9 @@ in stdenv.mkDerivation (rec {
|
|||
|
||||
checkTarget = "check-all";
|
||||
|
||||
# For the update script:
|
||||
passthru.monorepoSrc = monorepoSrc;
|
||||
|
||||
requiredSystemFeatures = [ "big-parallel" ];
|
||||
meta = llvm_meta // {
|
||||
homepage = "https://llvm.org/";
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index fec956091cd5..5a766f5c5d7c 100644
|
||||
index 45399dc0537e..5d946e9e6583 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -303,6 +303,9 @@ set(LLVM_EXAMPLES_INSTALL_DIR "examples" CACHE STRING
|
||||
"Path for examples subdirectory (enabled by LLVM_BUILD_EXAMPLES=ON) (defaults to 'examples')")
|
||||
mark_as_advanced(LLVM_EXAMPLES_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})
|
||||
@@ -942,7 +942,7 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "")
|
||||
add_subdirectory(${TENSORFLOW_AOT_PATH}/xla_aot_runtime_src
|
||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_runtime)
|
||||
install(TARGETS tf_xla_runtime EXPORT LLVMExports
|
||||
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime)
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX} COMPONENT tf_xla_runtime)
|
||||
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS tf_xla_runtime)
|
||||
# Once we add more modules, we should handle this more automatically.
|
||||
if (DEFINED LLVM_OVERRIDE_MODEL_HEADER_INLINERSIZEMODEL)
|
||||
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
|
||||
index fed1fec7d72e..4baed19b9e98 100644
|
||||
index 057431208322..56f0dcb258da 100644
|
||||
--- a/cmake/modules/AddLLVM.cmake
|
||||
+++ b/cmake/modules/AddLLVM.cmake
|
||||
@@ -838,8 +838,8 @@ macro(add_llvm_library name)
|
||||
@@ -844,8 +844,8 @@ macro(add_llvm_library name)
|
||||
get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella})
|
||||
install(TARGETS ${name}
|
||||
${export_to_llvmexports}
|
||||
|
@ -27,58 +26,28 @@ index fed1fec7d72e..4baed19b9e98 100644
|
|||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name})
|
||||
|
||||
if (NOT LLVM_ENABLE_IDE)
|
||||
@@ -1056,7 +1056,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")
|
||||
@@ -1902,7 +1902,7 @@ function(llvm_install_library_symlink name dest type)
|
||||
@@ -2007,7 +2007,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)
|
||||
set(output_dir "${CMAKE_INSTALL_BINDIR}")
|
||||
endif()
|
||||
@@ -1913,7 +1913,7 @@ function(llvm_install_library_symlink name dest type)
|
||||
@@ -2271,15 +2271,15 @@ function(llvm_setup_rpath name)
|
||||
|
||||
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)
|
||||
@@ -1936,7 +1936,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)
|
||||
@@ -2019,7 +2019,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()
|
||||
@@ -2148,9 +2149,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(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS)
|
||||
# $ORIGIN is not interpreted at link time by aix ld.
|
||||
# Since BUILD_SHARED_LIBS is only recommended for use by developers,
|
||||
# hardcode the rpath to build/install lib dir first in this mode.
|
||||
# FIXME: update this when there is better solution.
|
||||
- set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
|
||||
+ set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
|
||||
+ set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_FULL_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})
|
||||
|
@ -102,19 +71,10 @@ index 891c9e6d618c..8d963f3b0069 100644
|
|||
list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
|
||||
|
||||
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
|
||||
index cea0c1df0a14..eedcd9450312 100644
|
||||
index d4b0ab959148..26ed981fd09f 100644
|
||||
--- a/cmake/modules/CMakeLists.txt
|
||||
+++ b/cmake/modules/CMakeLists.txt
|
||||
@@ -2,7 +2,7 @@ include(ExtendPath)
|
||||
include(LLVMDistributionSupport)
|
||||
include(FindPrefixFromConfig)
|
||||
|
||||
-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.
|
||||
@@ -122,7 +122,7 @@ set(LLVM_CONFIG_INCLUDE_DIRS
|
||||
@@ -128,7 +128,7 @@ set(LLVM_CONFIG_INCLUDE_DIRS
|
||||
)
|
||||
list(REMOVE_DUPLICATES LLVM_CONFIG_INCLUDE_DIRS)
|
||||
|
||||
|
@ -123,24 +83,11 @@ index cea0c1df0a14..eedcd9450312 100644
|
|||
set(LLVM_CONFIG_LIBRARY_DIRS
|
||||
"${LLVM_CONFIG_LIBRARY_DIR}"
|
||||
# FIXME: Should there be other entries here?
|
||||
diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
|
||||
index b5c35f706cb7..9261ab797de6 100644
|
||||
--- a/cmake/modules/LLVMInstallSymlink.cmake
|
||||
+++ b/cmake/modules/LLVMInstallSymlink.cmake
|
||||
@@ -6,7 +6,7 @@ include(GNUInstallDirs)
|
||||
|
||||
function(install_symlink name target outdir)
|
||||
set(DESTDIR $ENV{DESTDIR})
|
||||
- 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 044ec8a4d39d..504d0eac3ade 100644
|
||||
index 879b7b231d4c..9c31d14e8950 100644
|
||||
--- a/docs/CMake.rst
|
||||
+++ b/docs/CMake.rst
|
||||
@@ -224,7 +224,7 @@ description is in `LLVM-related variables`_ below.
|
||||
@@ -250,7 +250,7 @@ description is in `LLVM-related variables`_ below.
|
||||
**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``
|
||||
|
@ -149,72 +96,43 @@ index 044ec8a4d39d..504d0eac3ade 100644
|
|||
|
||||
**LLVM_PARALLEL_{COMPILE,LINK}_JOBS**:STRING
|
||||
Building the llvm toolchain can use a lot of resources, particularly
|
||||
@@ -910,9 +910,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
|
||||
@@ -284,6 +284,10 @@ manual, or execute ``cmake --help-variable VARIABLE_NAME``.
|
||||
The path to install executables, relative to the *CMAKE_INSTALL_PREFIX*.
|
||||
Defaults to "bin".
|
||||
|
||||
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 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}")
|
||||
+**CMAKE_INSTALL_LIBDIR**:PATH
|
||||
+ The path to install libraries, relative to the *CMAKE_INSTALL_PREFIX*.
|
||||
+ Defaults to "lib".
|
||||
+
|
||||
**CMAKE_INSTALL_INCLUDEDIR**:PATH
|
||||
The path to install header files, relative to the *CMAKE_INSTALL_PREFIX*.
|
||||
Defaults to "include".
|
||||
diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
|
||||
index abbb8a450da6..70c497be12f5 100644
|
||||
index 370005cd8d7d..7e790bc52111 100644
|
||||
--- a/tools/llvm-config/BuildVariables.inc.in
|
||||
+++ b/tools/llvm-config/BuildVariables.inc.in
|
||||
@@ -23,7 +23,10 @@
|
||||
@@ -23,6 +23,7 @@
|
||||
#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_INSTALL_PACKAGE_DIR "@LLVM_INSTALL_PACKAGE_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 8ed88f33ead4..5e7184bab90d 100644
|
||||
index 2c6c55f89d38..f6d2068a0827 100644
|
||||
--- a/tools/llvm-config/llvm-config.cpp
|
||||
+++ b/tools/llvm-config/llvm-config.cpp
|
||||
@@ -363,12 +363,20 @@ int main(int argc, char **argv) {
|
||||
ActiveIncludeDir = std::string(Path.str());
|
||||
}
|
||||
{
|
||||
- SmallString<256> Path(LLVM_TOOLS_INSTALL_DIR);
|
||||
+ SmallString<256> Path(LLVM_INSTALL_BINDIR);
|
||||
@@ -369,7 +369,11 @@ int main(int argc, char **argv) {
|
||||
sys::fs::make_absolute(ActivePrefix, Path);
|
||||
ActiveBinDir = std::string(Path.str());
|
||||
}
|
||||
- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
|
||||
- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
|
||||
+ {
|
||||
+ SmallString<256> Path(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX);
|
||||
+ sys::fs::make_absolute(ActivePrefix, Path);
|
||||
+ ActiveLibDir = std::string(Path.str());
|
||||
+ }
|
||||
+ {
|
||||
+ SmallString<256> Path(LLVM_INSTALL_CMAKEDIR);
|
||||
+ sys::fs::make_absolute(ActivePrefix, Path);
|
||||
+ ActiveCMakeDir = std::string(Path.str());
|
||||
+ }
|
||||
ActiveIncludeOption = "-I" + ActiveIncludeDir;
|
||||
}
|
||||
|
||||
{
|
||||
SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR);
|
||||
sys::fs::make_absolute(ActivePrefix, Path);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
, runCommand
|
||||
, cmake
|
||||
, llvm
|
||||
, lit
|
||||
, clang-unwrapped
|
||||
, perl
|
||||
, pkg-config
|
||||
|
@ -24,17 +25,29 @@ stdenv.mkDerivation rec {
|
|||
sourceRoot = "${src.name}/${pname}";
|
||||
|
||||
patches = [
|
||||
./gnu-install-dirs.patch
|
||||
./fix-find-tool.patch
|
||||
./gnu-install-dirs.patch
|
||||
./run-lit-directly.patch
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [ cmake perl pkg-config clang-unwrapped ];
|
||||
nativeBuildInputs = [ cmake perl pkg-config lit ];
|
||||
buildInputs = [ llvm ];
|
||||
|
||||
# Unsup:Pass:XFail:Fail
|
||||
# 26:267:16:8
|
||||
doCheck = false;
|
||||
checkTarget = "check-openmp";
|
||||
|
||||
preCheck = ''
|
||||
patchShebangs ../tools/archer/tests/deflake.bash
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
"-DLIBOMPTARGET_BUILD_AMDGCN_BCLIB=OFF" # Building the AMDGCN device RTL currently fails
|
||||
"-DCLANG_TOOL=${clang-unwrapped}/bin/clang"
|
||||
"-DOPT_TOOL=${llvm}/bin/opt"
|
||||
"-DLINK_TOOL=${llvm}/bin/llvm-link"
|
||||
];
|
||||
|
||||
meta = llvm_meta // {
|
||||
|
|
|
@ -1,54 +1,18 @@
|
|||
diff --git a/libomptarget/DeviceRTL/CMakeLists.txt b/libomptarget/DeviceRTL/CMakeLists.txt
|
||||
index 242df638f80d..a4654e96371f 100644
|
||||
index ce66214822a2..6ab7b33c95da 100644
|
||||
--- a/libomptarget/DeviceRTL/CMakeLists.txt
|
||||
+++ b/libomptarget/DeviceRTL/CMakeLists.txt
|
||||
@@ -25,16 +25,16 @@ endif()
|
||||
|
||||
@@ -27,10 +27,10 @@ endif()
|
||||
if (LLVM_DIR)
|
||||
# Builds that use pre-installed LLVM have LLVM_DIR set.
|
||||
# A standalone or LLVM_ENABLE_RUNTIMES=openmp build takes this route
|
||||
- find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
|
||||
+ find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} REQUIRED)
|
||||
+ find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR})
|
||||
find_program(LINK_TOOL llvm-link PATHS ${LLVM_TOOLS_BINARY_DIR}
|
||||
- NO_DEFAULT_PATH)
|
||||
- find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
|
||||
+ REQUIRED)
|
||||
+ find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} REQUIRED)
|
||||
libomptarget_say("Building DeviceRTL. Using clang: ${CLANG_TOOL}")
|
||||
elseif (LLVM_TOOL_CLANG_BUILD AND NOT CMAKE_CROSSCOMPILING AND NOT OPENMP_STANDALONE_BUILD)
|
||||
# LLVM in-tree builds may use CMake target names to discover the tools.
|
||||
- set(CLANG_TOOL $<TARGET_FILE:clang>)
|
||||
- set(LINK_TOOL $<TARGET_FILE:llvm-link>)
|
||||
- set(OPT_TOOL $<TARGET_FILE:opt>)
|
||||
+ set(CLANG_TOOL $<TARGET_FILE:clang> REQUIRED)
|
||||
+ set(LINK_TOOL $<TARGET_FILE:llvm-link> REQUIRED)
|
||||
+ set(OPT_TOOL $<TARGET_FILE:opt> REQUIRED)
|
||||
libomptarget_say("Building DeviceRTL. Using clang from in-tree build")
|
||||
else()
|
||||
libomptarget_say("Not building DeviceRTL. No appropriate clang found")
|
||||
diff --git a/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt b/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
|
||||
index 3f4c02671aeb..be9f4677d7b5 100644
|
||||
--- a/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
|
||||
+++ b/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
|
||||
@@ -38,16 +38,16 @@ endif()
|
||||
|
||||
if (LLVM_DIR)
|
||||
# Builds that use pre-installed LLVM have LLVM_DIR set.
|
||||
- find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
|
||||
+ find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} REQUIRED)
|
||||
find_program(LINK_TOOL llvm-link PATHS ${LLVM_TOOLS_BINARY_DIR}
|
||||
- NO_DEFAULT_PATH)
|
||||
- find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
|
||||
+ REQUIRED)
|
||||
+ find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} REQUIRED)
|
||||
libomptarget_say("Building AMDGCN device RTL. Using clang: ${CLANG_TOOL}")
|
||||
elseif (LLVM_TOOL_CLANG_BUILD AND NOT CMAKE_CROSSCOMPILING AND NOT OPENMP_STANDALONE_BUILD)
|
||||
# LLVM in-tree builds may use CMake target names to discover the tools.
|
||||
- set(CLANG_TOOL $<TARGET_FILE:clang>)
|
||||
- set(LINK_TOOL $<TARGET_FILE:llvm-link>)
|
||||
- set(OPT_TOOL $<TARGET_FILE:opt>)
|
||||
+ set(CLANG_TOOL $<TARGET_FILE:clang> REQUIRED)
|
||||
+ set(LINK_TOOL $<TARGET_FILE:llvm-link> REQUIRED)
|
||||
+ set(OPT_TOOL $<TARGET_FILE:opt> REQUIRED)
|
||||
libomptarget_say("Building AMDGCN device RTL. Using clang from in-tree build")
|
||||
else()
|
||||
libomptarget_say("Not building AMDGCN device RTL. No appropriate clang found")
|
||||
+ )
|
||||
+ find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR})
|
||||
if ((NOT CLANG_TOOL) OR (NOT LINK_TOOL) OR (NOT OPT_TOOL))
|
||||
libomptarget_say("Not building DeviceRTL. Missing clang: ${CLANG_TOOL}, llvm-link: ${LINK_TOOL} or opt: ${OPT_TOOL}")
|
||||
return()
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 7f11a05f5622..fb90f8f6a49b 100644
|
||||
index b6ddbe90516d..311ab1d50e7f 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -8,6 +8,8 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
|
||||
set(OPENMP_STANDALONE_BUILD TRUE)
|
||||
project(openmp C CXX)
|
||||
|
||||
+ include(GNUInstallDirs)
|
||||
+
|
||||
# CMAKE_BUILD_TYPE was not set, default to Release.
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
@@ -19,7 +21,7 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
|
||||
@@ -29,7 +29,7 @@ if (OPENMP_STANDALONE_BUILD)
|
||||
set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING
|
||||
"Suffix of lib installation directory, e.g. 64 => lib64")
|
||||
# Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
|
||||
|
@ -20,7 +11,7 @@ index 7f11a05f5622..fb90f8f6a49b 100644
|
|||
|
||||
# Group test settings.
|
||||
set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
|
||||
@@ -30,7 +32,7 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
|
||||
@@ -40,7 +40,7 @@ if (OPENMP_STANDALONE_BUILD)
|
||||
else()
|
||||
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
|
||||
# If building in tree, we honor the same install suffix LLVM uses.
|
||||
|
@ -29,61 +20,3 @@ index 7f11a05f5622..fb90f8f6a49b 100644
|
|||
|
||||
if (NOT MSVC)
|
||||
set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
|
||||
index 0e1ce2afd154..8b3810f83713 100644
|
||||
--- a/libomptarget/plugins/amdgpu/CMakeLists.txt
|
||||
+++ b/libomptarget/plugins/amdgpu/CMakeLists.txt
|
||||
@@ -80,7 +80,7 @@ add_library(omptarget.rtl.amdgpu SHARED
|
||||
|
||||
# Install plugin under the lib destination folder.
|
||||
# When we build for debug, OPENMP_LIBDIR_SUFFIX get set to -debug
|
||||
-install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "lib${OPENMP_LIBDIR_SUFFIX}")
|
||||
+install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${OPENMP_LIBDIR_SUFFIX}")
|
||||
set_property(TARGET omptarget.rtl.amdgpu PROPERTY INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
diff --git a/libomptarget/plugins/ve/CMakeLists.txt b/libomptarget/plugins/ve/CMakeLists.txt
|
||||
index 16ce0891ca23..db30ee9c769f 100644
|
||||
--- a/libomptarget/plugins/ve/CMakeLists.txt
|
||||
+++ b/libomptarget/plugins/ve/CMakeLists.txt
|
||||
@@ -32,7 +32,7 @@ if(${LIBOMPTARGET_DEP_VEO_FOUND})
|
||||
|
||||
# Install plugin under the lib destination folder.
|
||||
install(TARGETS "omptarget.rtl.${tmachine_libname}"
|
||||
- LIBRARY DESTINATION lib${OPENMP_LIBDIR_SUFFIX})
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${OPENMP_LIBDIR_SUFFIX})
|
||||
|
||||
target_link_libraries(
|
||||
"omptarget.rtl.${tmachine_libname}"
|
||||
diff --git a/runtime/src/CMakeLists.txt b/runtime/src/CMakeLists.txt
|
||||
index e4f4e6e1e73f..1164b3b22b0e 100644
|
||||
--- a/runtime/src/CMakeLists.txt
|
||||
+++ b/runtime/src/CMakeLists.txt
|
||||
@@ -346,13 +346,13 @@ add_dependencies(libomp-micro-tests libomp-test-deps)
|
||||
# We want to install libomp in DESTDIR/CMAKE_INSTALL_PREFIX/lib
|
||||
# We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include
|
||||
if(${OPENMP_STANDALONE_BUILD})
|
||||
- set(LIBOMP_HEADERS_INSTALL_PATH include)
|
||||
+ set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
else()
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
|
||||
set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")
|
||||
endif()
|
||||
if(WIN32)
|
||||
- install(TARGETS omp RUNTIME DESTINATION bin)
|
||||
+ install(TARGETS omp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}")
|
||||
# Create aliases (regular copies) of the library for backwards compatibility
|
||||
set(LIBOMP_ALIASES "libiomp5md")
|
||||
diff --git a/tools/multiplex/CMakeLists.txt b/tools/multiplex/CMakeLists.txt
|
||||
index 64317c112176..4002784da736 100644
|
||||
--- a/tools/multiplex/CMakeLists.txt
|
||||
+++ b/tools/multiplex/CMakeLists.txt
|
||||
@@ -4,7 +4,7 @@ if(LIBOMP_OMPT_SUPPORT)
|
||||
add_library(ompt-multiplex INTERFACE)
|
||||
target_include_directories(ompt-multiplex INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
- install(FILES ompt-multiplex.h DESTINATION include)
|
||||
+ install(FILES ompt-multiplex.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
diff --git a/cmake/OpenMPTesting.cmake b/cmake/OpenMPTesting.cmake
|
||||
--- a/cmake/OpenMPTesting.cmake
|
||||
+++ b/cmake/OpenMPTesting.cmake
|
||||
@@ -185,7 +185,7 @@ function(add_openmp_testsuite target comment)
|
||||
if (${OPENMP_STANDALONE_BUILD})
|
||||
set(LIT_ARGS ${OPENMP_LIT_ARGS} ${ARG_ARGS})
|
||||
add_custom_target(${target}
|
||||
- COMMAND ${PYTHON_EXECUTABLE} ${OPENMP_LLVM_LIT_EXECUTABLE} ${LIT_ARGS} ${ARG_UNPARSED_ARGUMENTS}
|
||||
+ COMMAND ${OPENMP_LLVM_LIT_EXECUTABLE} ${LIT_ARGS} ${ARG_UNPARSED_ARGUMENTS}
|
||||
COMMENT ${comment}
|
||||
DEPENDS ${ARG_DEPENDS}
|
||||
USES_TERMINAL
|
Loading…
Reference in a new issue