diff --git a/.github/workflows/vcpkg_ci_linux.yml b/.github/workflows/vcpkg_ci_linux.yml index 90c6db7e..2f389746 100644 --- a/.github/workflows/vcpkg_ci_linux.yml +++ b/.github/workflows/vcpkg_ci_linux.yml @@ -43,7 +43,8 @@ jobs: 'llvm-9', 'llvm-10', 'llvm-11', - 'llvm-12' + 'llvm-12', + 'llvm-13' ] # Only some LLVM versions for ARM CI include: @@ -198,7 +199,7 @@ jobs: - name: 'Test rellic build' shell: 'bash' - if: ${{ matrix.llvm != 'llvm-12' }} + if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }} run: | cd rellic rm -rf build @@ -214,6 +215,7 @@ jobs: - name: 'Test remill build' shell: 'bash' + if: ${{ matrix.llvm != 'llvm-13' }} run: | cd remill rm -rf build @@ -274,7 +276,7 @@ jobs: - name: 'Anvill-McSema build - custom remill' shell: 'bash' - if: ${{ matrix.llvm != 'llvm-12' }} + if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }} run: | cd anvill-mcsema rm -rf build @@ -292,7 +294,7 @@ jobs: - name: 'Test mcsema build' shell: 'bash' - if: ${{ matrix.llvm != 'llvm-12' }} + if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }} run: | cd mcsema rm -rf build diff --git a/.github/workflows/vcpkg_ci_mac.yml b/.github/workflows/vcpkg_ci_mac.yml index 083439da..9dc530c6 100644 --- a/.github/workflows/vcpkg_ci_mac.yml +++ b/.github/workflows/vcpkg_ci_mac.yml @@ -34,12 +34,13 @@ jobs: fail-fast: false matrix: os: - - { runner: 'macos-10.15', xcode: '12.4' } - # - { runner: 'macos-11.0', xcode: '12.5' } + # - { runner: 'macos-10.15', xcode: '12.4' } + - { runner: 'macos-11', xcode: '13.0' } llvm: [ 'llvm-10', 'llvm-11', - 'llvm-12' + 'llvm-12', + 'llvm-13' ] runs-on: ${{ matrix.os.runner }} @@ -166,7 +167,7 @@ jobs: - name: 'Test rellic build' shell: 'bash' - if: ${{ matrix.llvm != 'llvm-12' }} + if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }} run: | cd rellic mkdir -p build && cd build @@ -181,6 +182,7 @@ jobs: - name: 'Test remill build' shell: 'bash' + if: ${{ matrix.llvm != 'llvm-13' }} run: | cd remill mkdir -p build && cd build @@ -232,7 +234,7 @@ jobs: - name: 'Anvill-McSema build - custom remill' shell: 'bash' - if: ${{ matrix.llvm != 'llvm-12' }} + if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }} run: | cd anvill-mcsema mkdir -p build && cd build @@ -249,7 +251,7 @@ jobs: - name: 'Test mcsema build' shell: 'bash' - if: ${{ matrix.llvm != 'llvm-12' }} + if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }} run: | cd mcsema mkdir -p build && cd build diff --git a/.github/workflows/vcpkg_ci_windows.yml b/.github/workflows/vcpkg_ci_windows.yml index ad2d98e8..552245bb 100644 --- a/.github/workflows/vcpkg_ci_windows.yml +++ b/.github/workflows/vcpkg_ci_windows.yml @@ -40,7 +40,8 @@ jobs: # 'llvm-9', # 'llvm-10', 'llvm-11', - 'llvm-12' + 'llvm-12', + 'llvm-13' ] runs-on: ['self-hosted', 'Windows', 'X64'] @@ -148,7 +149,7 @@ jobs: # remill - name: 'Test rellic build' - if: ${{ matrix.llvm != 'llvm-12' }} + if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }} run: | cd rellic Remove-Item -Recurse -Force -ErrorAction SilentlyContinue .\build @@ -166,6 +167,7 @@ jobs: # python ../scripts/roundtrip.py ( Get-ChildItem tools | Where-Object {$_.name -match "rellic-decomp-.*.exe"} ) ..\tests\tools\decomp "${env:VCPKG_ROOT}\installed\${env:TRIPLET}\tools\${{ matrix.llvm }}\clang.exe" - name: 'Test remill build' + if: ${{ matrix.llvm != 'llvm-13' }} run: | cd remill Remove-Item -Recurse -Force -ErrorAction SilentlyContinue .\build diff --git a/README.md b/README.md index 1d3f2b83..ad7614dd 100644 --- a/README.md +++ b/README.md @@ -129,4 +129,4 @@ See [here](https://github.com/microsoft/vcpkg/blob/master/docs/examples/packagin This repo is under the Apache-2.0 LICENSE, unless where specified. See below. -The LLVM version port directories (ports/llvm-{9,10,11}) were initially copied from the upstream [vcpkg](https://github.com/microsoft/vcpkg) repo as a starting point. Eventually, we plan to submit the relevant patches for upstream when we have thoroughly tested these changes. More info can be found in the respective `LICENSE` and `NOTICE` files in those directories. +The LLVM version port directories (ports/llvm-{9,10,11,12,13}) were initially copied from the upstream [vcpkg](https://github.com/microsoft/vcpkg) repo as a starting point. Eventually, we plan to submit the relevant patches for upstream when we have thoroughly tested these changes. More info can be found in the respective `LICENSE` and `NOTICE` files in those directories. diff --git a/ports/llvm-13/0001-fix-install-paths.patch b/ports/llvm-13/0001-fix-install-paths.patch new file mode 100644 index 00000000..c2f214d2 --- /dev/null +++ b/ports/llvm-13/0001-fix-install-paths.patch @@ -0,0 +1,128 @@ +diff --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt +index 561665d58cad..3c73878a4483 100644 +--- a/clang/cmake/modules/CMakeLists.txt ++++ b/clang/cmake/modules/CMakeLists.txt +@@ -3,11 +3,11 @@ include(LLVMDistributionSupport) + # Generate a list of CMake library targets so that other CMake projects can + # link against them. LLVM calls its version of this file LLVMExports.cmake, but + # the usual CMake convention seems to be ${Project}Targets.cmake. +-set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang) ++set(CLANG_INSTALL_PACKAGE_DIR share/clang) + set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}") + + # Keep this in sync with llvm/cmake/CMakeLists.txt! +-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) ++set(LLVM_INSTALL_PACKAGE_DIR share/llvm) + set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + + get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS) +diff --git a/flang/cmake/modules/CMakeLists.txt b/flang/cmake/modules/CMakeLists.txt +index e46498a6bc35..2e922f8ca89d 100644 +--- a/flang/cmake/modules/CMakeLists.txt ++++ b/flang/cmake/modules/CMakeLists.txt +@@ -1,11 +1,11 @@ + # Generate a list of CMake library targets so that other CMake projects can + # link against them. LLVM calls its version of this file LLVMExports.cmake, but + # the usual CMake convention seems to be ${Project}Targets.cmake. +-set(FLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/flang) ++set(FLANG_INSTALL_PACKAGE_DIR share/flang) + set(flang_cmake_builddir "${CMAKE_BINARY_DIR}/${FLANG_INSTALL_PACKAGE_DIR}") + + # Keep this in sync with llvm/cmake/CMakeLists.txt! +-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) ++set(LLVM_INSTALL_PACKAGE_DIR share/llvm) + set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + + get_property(FLANG_EXPORTS GLOBAL PROPERTY FLANG_EXPORTS) +diff --git a/lld/cmake/modules/CMakeLists.txt b/lld/cmake/modules/CMakeLists.txt +index 62d03fa901dd..09b0f54ee8c3 100644 +--- a/lld/cmake/modules/CMakeLists.txt ++++ b/lld/cmake/modules/CMakeLists.txt +@@ -1,11 +1,11 @@ + # Generate a list of CMake library targets so that other CMake projects can + # link against them. LLVM calls its version of this file LLVMExports.cmake, but + # the usual CMake convention seems to be ${Project}Targets.cmake. +-set(LLD_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/lld) ++set(LLD_INSTALL_PACKAGE_DIR share/lld) + set(lld_cmake_builddir "${CMAKE_BINARY_DIR}/${LLD_INSTALL_PACKAGE_DIR}") + + # Keep this in sync with llvm/cmake/CMakeLists.txt! +-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) ++set(LLVM_INSTALL_PACKAGE_DIR share/llvm) + set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + + get_property(LLD_EXPORTS GLOBAL PROPERTY LLD_EXPORTS) +diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake +index 29e40f45fef8..e9094e9b8eb2 100644 +--- a/llvm/cmake/modules/AddLLVM.cmake ++++ b/llvm/cmake/modules/AddLLVM.cmake +@@ -1033,7 +1033,7 @@ function(process_llvm_pass_plugins) + + ## Part 1: Extension header to be included whenever we need extension + # processing. +- set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) ++ set(LLVM_INSTALL_PACKAGE_DIR share/llvm) + set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + file(WRITE + "${llvm_cmake_builddir}/LLVMConfigExtensions.cmake" +diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt +index 51b6a4fdc284..a818de2e116c 100644 +--- a/llvm/cmake/modules/CMakeLists.txt ++++ b/llvm/cmake/modules/CMakeLists.txt +@@ -1,6 +1,6 @@ + include(LLVMDistributionSupport) + +-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) ++set(LLVM_INSTALL_PACKAGE_DIR share/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. +diff --git a/mlir/cmake/modules/CMakeLists.txt b/mlir/cmake/modules/CMakeLists.txt +index 65efc4a14987..7c3213ab0c2b 100644 +--- a/mlir/cmake/modules/CMakeLists.txt ++++ b/mlir/cmake/modules/CMakeLists.txt +@@ -3,11 +3,11 @@ include(LLVMDistributionSupport) + # Generate a list of CMake library targets so that other CMake projects can + # link against them. LLVM calls its version of this file LLVMExports.cmake, but + # the usual CMake convention seems to be ${Project}Targets.cmake. +-set(MLIR_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir) ++set(MLIR_INSTALL_PACKAGE_DIR share/mlir) + set(mlir_cmake_builddir "${CMAKE_BINARY_DIR}/${MLIR_INSTALL_PACKAGE_DIR}") + + # Keep this in sync with llvm/cmake/CMakeLists.txt! +-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) ++set(LLVM_INSTALL_PACKAGE_DIR share/llvm) + set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + + get_property(MLIR_EXPORTS GLOBAL PROPERTY MLIR_EXPORTS) +diff --git a/polly/cmake/CMakeLists.txt b/polly/cmake/CMakeLists.txt +index 7cc129ba2e90..9776391cd535 100644 +--- a/polly/cmake/CMakeLists.txt ++++ b/polly/cmake/CMakeLists.txt +@@ -1,7 +1,7 @@ + # Keep this in sync with llvm/cmake/CMakeLists.txt! + +-set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") +-set(POLLY_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/polly") ++set(LLVM_INSTALL_PACKAGE_DIR share/llvm) ++set(POLLY_INSTALL_PACKAGE_DIR share/polly) + if (CMAKE_CONFIGURATION_TYPES) + set(POLLY_EXPORTS_FILE_NAME "PollyExports-$>.cmake") + else() +diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt +index 8bea8843589b..3658c0a4414a 100644 +--- a/pstl/CMakeLists.txt ++++ b/pstl/CMakeLists.txt +@@ -81,10 +81,10 @@ install(TARGETS ParallelSTL + install(EXPORT ParallelSTLTargets + FILE ParallelSTLTargets.cmake + NAMESPACE pstl:: +- DESTINATION lib/cmake/ParallelSTL) ++ DESTINATION share/ParallelSTL) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake" +- DESTINATION lib/cmake/ParallelSTL) ++ DESTINATION share/ParallelSTL) + install(DIRECTORY include/ + DESTINATION include + PATTERN "*.in" EXCLUDE) diff --git a/ports/llvm-13/0002-fix-openmp-debug.patch b/ports/llvm-13/0002-fix-openmp-debug.patch new file mode 100644 index 00000000..d6b9197d --- /dev/null +++ b/ports/llvm-13/0002-fix-openmp-debug.patch @@ -0,0 +1,22 @@ +diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt +index bdb867e352f7..16a13fa959ea 100644 +--- a/openmp/runtime/src/CMakeLists.txt ++++ b/openmp/runtime/src/CMakeLists.txt +@@ -159,7 +159,7 @@ else() + endif() + + set_target_properties(omp PROPERTIES +- PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_LIB_FILE}" ++ PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_LIB_FILE}" DEBUG_POSTFIX "" + LINK_FLAGS "${LIBOMP_CONFIGURED_LDFLAGS}" + LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE} + ) +@@ -236,7 +236,7 @@ if(WIN32) + # Create new import library that is just the previously created one + kmp_import.cpp + add_library(ompimp STATIC ${LIBOMP_GENERATED_IMP_LIB} kmp_import.cpp) + set_target_properties(ompimp PROPERTIES +- PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" ++ PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" DEBUG_POSTFIX "" + LINKER_LANGUAGE C + ) + add_dependencies(ompimp omp) # ensure generated import library is created first diff --git a/ports/llvm-13/0003-fix-dr-1734.patch b/ports/llvm-13/0003-fix-dr-1734.patch new file mode 100644 index 00000000..8b0a9bb4 --- /dev/null +++ b/ports/llvm-13/0003-fix-dr-1734.patch @@ -0,0 +1,14 @@ +diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h +index 7b7d5d991f3f..332864c1907e 100644 +--- a/llvm/include/llvm/Support/type_traits.h ++++ b/llvm/include/llvm/Support/type_traits.h +@@ -176,7 +176,8 @@ class is_trivially_copyable { + (has_deleted_copy_assign || has_trivial_copy_assign) && + (has_deleted_copy_constructor || has_trivial_copy_constructor); + +-#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE ++ // due to DR 1734, a type can be std::is_trivially_copyable but not llvm::is_trivially_copyable ++#if 0 + static_assert(value == std::is_trivially_copyable::value, + "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable"); + #endif diff --git a/ports/llvm-13/0004-fix-tools-path.patch b/ports/llvm-13/0004-fix-tools-path.patch new file mode 100644 index 00000000..bc89e33d --- /dev/null +++ b/ports/llvm-13/0004-fix-tools-path.patch @@ -0,0 +1,13 @@ +diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp +index 1a2f04552d13..9370c5e28206 100644 +--- a/llvm/tools/llvm-config/llvm-config.cpp ++++ b/llvm/tools/llvm-config/llvm-config.cpp +@@ -305,7 +305,7 @@ int main(int argc, char **argv) { + // bin dir). + sys::fs::make_absolute(CurrentPath); + CurrentExecPrefix = +- sys::path::parent_path(sys::path::parent_path(CurrentPath)).str(); ++ sys::path::parent_path(sys::path::parent_path(sys::path::parent_path(CurrentPath))).str(); + + // Check to see if we are inside a development tree by comparing to possible + // locations (prefix style or CMake style). diff --git a/ports/llvm-13/0005-fix-compiler-rt-install-path.patch b/ports/llvm-13/0005-fix-compiler-rt-install-path.patch new file mode 100644 index 00000000..d4886472 --- /dev/null +++ b/ports/llvm-13/0005-fix-compiler-rt-install-path.patch @@ -0,0 +1,39 @@ +diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt +index 8131f6005dc2..9afef2e5a4e7 100644 +--- a/clang/lib/Headers/CMakeLists.txt ++++ b/clang/lib/Headers/CMakeLists.txt +@@ -222,7 +222,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 tools/llvm/lib/clang/${CLANG_VERSION}/include) + + install( + FILES ${files} ${generated_files} +diff --git a/clang/runtime/CMakeLists.txt b/clang/runtime/CMakeLists.txt +index 61b1c60bf590..c20a5a326f15 100644 +--- a/clang/runtime/CMakeLists.txt ++++ b/clang/runtime/CMakeLists.txt +@@ -82,7 +82,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/) + -DLLVM_LIT_ARGS=${LLVM_LIT_ARGS} + -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION} + -DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR} +- -DCOMPILER_RT_INSTALL_PATH:PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} ++ -DCOMPILER_RT_INSTALL_PATH:PATH=tools/llvm/lib/clang/${CLANG_VERSION} + -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} +diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake +index c11342e68813..61bb52135c43 100644 +--- a/compiler-rt/cmake/base-config-ix.cmake ++++ b/compiler-rt/cmake/base-config-ix.cmake +@@ -42,7 +42,7 @@ if (LLVM_TREE_AVAILABLE) + # Setup the paths where compiler-rt runtimes and headers should be stored. + set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) + set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) +- set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) ++ set(COMPILER_RT_INSTALL_PATH tools/llvm/lib/clang/${CLANG_VERSION}) + option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." + ${LLVM_INCLUDE_TESTS}) + option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" diff --git a/ports/llvm-13/0006-fix-tools-install-path.patch b/ports/llvm-13/0006-fix-tools-install-path.patch new file mode 100644 index 00000000..3e5695f1 --- /dev/null +++ b/ports/llvm-13/0006-fix-tools-install-path.patch @@ -0,0 +1,159 @@ +diff --git a/clang-tools-extra/modularize/CMakeLists.txt b/clang-tools-extra/modularize/CMakeLists.txt +index 4caae81c49b6..8c459c51cc34 100644 +--- a/clang-tools-extra/modularize/CMakeLists.txt ++++ b/clang-tools-extra/modularize/CMakeLists.txt +@@ -23,5 +23,5 @@ clang_target_link_libraries(modularize + ) + + install(TARGETS modularize +- RUNTIME DESTINATION bin ++ RUNTIME DESTINATION tools/llvm + COMPONENT clang-extras) +diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake +index 5752f4277444..00b7d21b8fef 100644 +--- a/clang/cmake/modules/AddClang.cmake ++++ b/clang/cmake/modules/AddClang.cmake +@@ -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 tools/llvm + COMPONENT ${name}) + + if(NOT LLVM_ENABLE_IDE) +diff --git a/clang/tools/c-index-test/CMakeLists.txt b/clang/tools/c-index-test/CMakeLists.txt +index ceef4b08637c..ce6d7799475b 100644 +--- a/clang/tools/c-index-test/CMakeLists.txt ++++ b/clang/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 tools/llvm) + endif() + + install(TARGETS c-index-test +diff --git a/clang/tools/clang-format/CMakeLists.txt b/clang/tools/clang-format/CMakeLists.txt +index 35ecdb11253c..d1b800dfdadc 100644 +--- a/clang/tools/clang-format/CMakeLists.txt ++++ b/clang/tools/clang-format/CMakeLists.txt +@@ -36,5 +36,5 @@ install(PROGRAMS clang-format.py + DESTINATION share/clang + COMPONENT clang-format) + install(PROGRAMS git-clang-format +- DESTINATION bin ++ DESTINATION tools/llvm + COMPONENT clang-format) +diff --git a/clang/tools/scan-build/CMakeLists.txt b/clang/tools/scan-build/CMakeLists.txt +index ec0702d76f18..9a34a09921b1 100644 +--- a/clang/tools/scan-build/CMakeLists.txt ++++ b/clang/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 tools/llvm + COMPONENT scan-build) + endforeach() + +diff --git a/clang/tools/scan-view/CMakeLists.txt b/clang/tools/scan-view/CMakeLists.txt +index eccc6b83195b..232976c0c227 100644 +--- a/clang/tools/scan-view/CMakeLists.txt ++++ b/clang/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 tools/llvm + COMPONENT scan-view) + endforeach() + +diff --git a/clang/utils/hmaptool/CMakeLists.txt b/clang/utils/hmaptool/CMakeLists.txt +index 62f2de0cb15c..38dc821c76de 100644 +--- a/clang/utils/hmaptool/CMakeLists.txt ++++ b/clang/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 tools/llvm + COMPONENT hmaptool) + + add_custom_target(hmaptool ALL DEPENDS ${Depends}) +diff --git a/flang/cmake/modules/AddFlang.cmake b/flang/cmake/modules/AddFlang.cmake +index 5da58a59ed12..c019d7fc50a9 100644 +--- a/flang/cmake/modules/AddFlang.cmake ++++ b/flang/cmake/modules/AddFlang.cmake +@@ -108,7 +108,7 @@ macro(add_flang_tool name) + get_target_export_arg(${name} Flang export_to_flangtargets) + install(TARGETS ${name} + ${export_to_flangtargets} +- RUNTIME DESTINATION bin ++ RUNTIME DESTINATION tools/llvm + COMPONENT ${name}) + + if(NOT LLVM_ENABLE_IDE) +diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt +index 239859b5e5b9..12d00f904f8a 100644 +--- a/flang/tools/f18/CMakeLists.txt ++++ b/flang/tools/f18/CMakeLists.txt +@@ -60,7 +60,7 @@ endforeach() + + add_custom_target(module_files ALL DEPENDS ${MODULE_FILES}) + +-install(TARGETS f18 DESTINATION bin) ++install(TARGETS f18 DESTINATION tools/llvm) + + set(FLANG_DEFAULT_DRIVER "flang-new") + if (NOT FLANG_BUILD_NEW_DRIVER) +@@ -70,5 +70,5 @@ endif() + # This flang shell script will only work in a POSIX shell. + if (NOT WIN32) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flang.in ${CMAKE_BINARY_DIR}/bin/flang @ONLY) +- install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang DESTINATION bin) ++ install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang DESTINATION tools/llvm) + endif() +diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake +index 9883475d1aa5..48e46586f387 100644 +--- a/lld/cmake/modules/AddLLD.cmake ++++ b/lld/cmake/modules/AddLLD.cmake +@@ -46,7 +46,7 @@ macro(add_lld_tool name) + get_target_export_arg(${name} LLD export_to_lldtargets) + install(TARGETS ${name} + ${export_to_lldtargets} +- RUNTIME DESTINATION bin ++ RUNTIME DESTINATION tools/llvm + COMPONENT ${name}) + + if(NOT CMAKE_CONFIGURATION_TYPES) +diff --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt +index e77b2161a873..b325b934640c 100644 +--- a/lld/tools/lld/CMakeLists.txt ++++ b/lld/tools/lld/CMakeLists.txt +@@ -21,7 +21,7 @@ target_link_libraries(lld + ) + + install(TARGETS lld +- RUNTIME DESTINATION bin) ++ RUNTIME DESTINATION tools/llvm) + + if(NOT LLD_SYMLINKS_TO_CREATE) + set(LLD_SYMLINKS_TO_CREATE +diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake +index 8be214a8509a..4a5d0fa39be3 100644 +--- a/lldb/cmake/modules/AddLLDB.cmake ++++ b/lldb/cmake/modules/AddLLDB.cmake +@@ -187,7 +187,7 @@ function(add_lldb_executable name) + endif() + + if(ARG_GENERATE_INSTALL) +- set(install_dest bin) ++ set(install_dest tools/llvm) + if(ARG_INSTALL_PREFIX) + set(install_dest ${ARG_INSTALL_PREFIX}) + endif() diff --git a/ports/llvm-13/0020-remove-FindZ3.cmake.patch b/ports/llvm-13/0020-remove-FindZ3.cmake.patch new file mode 100644 index 00000000..22c3b125 --- /dev/null +++ b/ports/llvm-13/0020-remove-FindZ3.cmake.patch @@ -0,0 +1,116 @@ +diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake +deleted file mode 100644 +index 95dd37789..000000000 +--- a/llvm/cmake/modules/FindZ3.cmake ++++ /dev/null +@@ -1,110 +0,0 @@ +-INCLUDE(CheckCXXSourceRuns) +- +-# Function to check Z3's version +-function(check_z3_version z3_include z3_lib) +- # The program that will be executed to print Z3's version. +- file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.c +- "#include +- #include +- int main() { +- unsigned int major, minor, build, rev; +- Z3_get_version(&major, &minor, &build, &rev); +- printf(\"%u.%u.%u\", major, minor, build); +- return 0; +- }") +- +- # Get lib path +- get_filename_component(z3_lib_path ${z3_lib} PATH) +- +- try_run( +- Z3_RETURNCODE +- Z3_COMPILED +- ${CMAKE_BINARY_DIR} +- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.c +- COMPILE_DEFINITIONS -I"${z3_include}" +- LINK_LIBRARIES -L${z3_lib_path} -lz3 +- RUN_OUTPUT_VARIABLE SRC_OUTPUT +- ) +- +- if(Z3_COMPILED) +- string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*)" "\\1" +- z3_version "${SRC_OUTPUT}") +- set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE) +- endif() +-endfunction(check_z3_version) +- +-# Looking for Z3 in LLVM_Z3_INSTALL_DIR +-find_path(Z3_INCLUDE_DIR NAMES z3.h +- NO_DEFAULT_PATH +- PATHS ${LLVM_Z3_INSTALL_DIR}/include +- PATH_SUFFIXES libz3 z3 +- ) +- +-find_library(Z3_LIBRARIES NAMES z3 libz3 +- NO_DEFAULT_PATH +- PATHS ${LLVM_Z3_INSTALL_DIR} +- PATH_SUFFIXES lib bin +- ) +- +-# If Z3 has not been found in LLVM_Z3_INSTALL_DIR look in the default directories +-find_path(Z3_INCLUDE_DIR NAMES z3.h +- PATH_SUFFIXES libz3 z3 +- ) +- +-find_library(Z3_LIBRARIES NAMES z3 libz3 +- PATH_SUFFIXES lib bin +- ) +- +-# Searching for the version of the Z3 library is a best-effort task +-unset(Z3_VERSION_STRING) +- +-# First, try to check it dynamically, by compiling a small program that +-# prints Z3's version +-if(Z3_INCLUDE_DIR AND Z3_LIBRARIES) +- # We do not have the Z3 binary to query for a version. Try to use +- # a small C++ program to detect it via the Z3_get_version() API call. +- check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBRARIES}) +-endif() +- +-# If the dynamic check fails, we might be cross compiling: if that's the case, +-# check the version in the headers, otherwise, fail with a message +-if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND +- Z3_INCLUDE_DIR AND +- EXISTS "${Z3_INCLUDE_DIR}/z3_version.h")) +- # TODO: print message warning that we couldn't find a compatible lib? +- +- # Z3 4.8.1+ has the version is in a public header. +- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h" +- z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*") +- string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]).*$" "\\1" +- Z3_MAJOR "${z3_version_str}") +- +- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h" +- z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*") +- string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]).*$" "\\1" +- Z3_MINOR "${z3_version_str}") +- +- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h" +- z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*") +- string(REGEX REPLACE "^.*Z3_BUILD_VERSION[\t ]+([0-9]).*$" "\\1" +- Z3_BUILD "${z3_version_str}") +- +- set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD}) +- unset(z3_version_str) +-endif() +- +-if(NOT Z3_VERSION_STRING) +- # Give up: we are unable to obtain a version of the Z3 library. Be +- # conservative and force the found version to 0.0.0 to make version +- # checks always fail. +- set(Z3_VERSION_STRING "0.0.0") +-endif() +- +-# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if +-# all listed variables are TRUE +-include(FindPackageHandleStandardArgs) +-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3 +- REQUIRED_VARS Z3_LIBRARIES Z3_INCLUDE_DIR +- VERSION_VAR Z3_VERSION_STRING) +- +-mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES) diff --git a/ports/llvm-13/0021-fix-FindZ3.cmake.patch b/ports/llvm-13/0021-fix-FindZ3.cmake.patch new file mode 100644 index 00000000..d13e9b2f --- /dev/null +++ b/ports/llvm-13/0021-fix-FindZ3.cmake.patch @@ -0,0 +1,151 @@ +diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake +new file mode 100644 +index 000000000..32f6f4160 +--- /dev/null ++++ b/llvm/cmake/modules/FindZ3.cmake +@@ -0,0 +1,127 @@ ++INCLUDE(CheckCXXSourceRuns) ++ ++# Function to check Z3's version ++function(check_z3_version z3_include z3_lib) ++ # The program that will be executed to print Z3's version. ++ file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/testz3.c ++ "#include ++ #include ++ int main() { ++ unsigned int major, minor, build, rev; ++ Z3_get_version(&major, &minor, &build, &rev); ++ printf(\"%u.%u.%u\", major, minor, build); ++ return 0; ++ }") ++ ++ # Try to find a threading module in case Z3 was built with threading support. ++ # Threads are required elsewhere in LLVM, but not marked as required here because ++ # Z3 could have been compiled without threading support. ++ find_package(Threads) ++ set(z3_link_libs ${z3_lib} "${CMAKE_THREAD_LIBS_INIT}") ++ ++ # Get lib path ++ get_filename_component(z3_lib_path ${z3_lib} PATH) ++ ++ try_run( ++ Z3_RETURNCODE ++ Z3_COMPILED ++ ${CMAKE_BINARY_DIR} ++ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/testz3.c ++ COMPILE_DEFINITIONS -I"${z3_include}" ++ LINK_LIBRARIES -L${z3_lib_path} ${z3_link_libs} ++ RUN_OUTPUT_VARIABLE SRC_OUTPUT ++ ) ++ ++ if(Z3_COMPILED) ++ string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*)" "\\1" ++ z3_version "${SRC_OUTPUT}") ++ set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE) ++ endif() ++endfunction(check_z3_version) ++ ++# Looking for Z3 in LLVM_Z3_INSTALL_DIR ++find_path(Z3_INCLUDE_DIR NAMES z3.h ++ NO_DEFAULT_PATH ++ PATHS ${LLVM_Z3_INSTALL_DIR}/include ++ PATH_SUFFIXES libz3 z3 ++ ) ++ ++find_library(Z3_LIBS NAMES z3 libz3 ++ NO_DEFAULT_PATH ++ PATHS ${LLVM_Z3_INSTALL_DIR} ++ PATH_SUFFIXES lib bin ++ ) ++ ++# If Z3 has not been found in LLVM_Z3_INSTALL_DIR look in the default directories ++find_path(Z3_INCLUDE_DIR NAMES z3.h ++ PATH_SUFFIXES libz3 z3 ++ ) ++ ++find_library(Z3_LIBS NAMES z3 libz3 ++ PATH_SUFFIXES lib bin ++ ) ++ ++# Searching for the version of the Z3 library is a best-effort task ++unset(Z3_VERSION_STRING) ++ ++# First, try to check it dynamically, by compiling a small program that ++# prints Z3's version ++if(Z3_INCLUDE_DIR AND Z3_LIBS) ++ # We do not have the Z3 binary to query for a version. Try to use ++ # a small C++ program to detect it via the Z3_get_version() API call. ++ check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBS}) ++endif() ++ ++# If the dynamic check fails, we might be cross compiling: if that's the case, ++# check the version in the headers, otherwise, fail with a message ++if(EXISTS "${Z3_INCLUDE_DIR}/z3_version.h" AND (NOT Z3_VERSION_STRING OR ++ (CMAKE_CROSSCOMPILING AND ++ Z3_INCLUDE_DIR))) ++ # TODO: print message warning that we couldn't find a compatible lib? ++ ++ # Z3 4.8.1+ has the version is in a public header. ++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h" ++ z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*") ++ string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]+).*$" "\\1" ++ Z3_MAJOR "${z3_version_str}") ++ ++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h" ++ z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*") ++ string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]+).*$" "\\1" ++ Z3_MINOR "${z3_version_str}") ++ ++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h" ++ z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*") ++ string(REGEX REPLACE "^.*Z3_BUILD_NUMBER[\t ]+([0-9]+).*$" "\\1" ++ Z3_BUILD "${z3_version_str}") ++ ++ set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD}) ++ unset(z3_version_str) ++endif() ++ ++if(NOT Z3_VERSION_STRING) ++ # Give up: we are unable to obtain a version of the Z3 library. Be ++ # conservative and force the found version to 0.0.0 to make version ++ # checks always fail. ++ set(Z3_VERSION_STRING "0.0.0") ++endif() ++ ++# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if ++# all listed variables are TRUE ++include(FindPackageHandleStandardArgs) ++FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3 ++ REQUIRED_VARS Z3_LIBS Z3_INCLUDE_DIR ++ VERSION_VAR Z3_VERSION_STRING) ++ ++if(Z3_FOUND AND NOT TARGET Z3) ++ add_library(Z3 UNKNOWN IMPORTED) ++ set_target_properties(Z3 PROPERTIES ++ INTERFACE_INCLUDE_DIRECTORIES "${Z3_INCLUDE_DIR}" ++ IMPORTED_LOCATION "${Z3_LIBS}" ++ ) ++ set(Z3_LIBRARIES "Z3") ++ set(THREADS_PREFER_PTHREAD_FLAG ON) ++ find_package(Threads REQUIRED) ++ target_link_libraries(Z3 INTERFACE Threads::Threads) ++endif() ++mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBS Z3_LIBRARIES) +diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in +index ac053141b008..150b748aa491 100644 +--- a/llvm/cmake/modules/LLVMConfig.cmake.in ++++ b/llvm/cmake/modules/LLVMConfig.cmake.in +@@ -65,6 +65,13 @@ if(LLVM_ENABLE_LIBXML2) + endif() + + set(LLVM_WITH_Z3 @LLVM_WITH_Z3@) ++if(LLVM_WITH_Z3) ++ # Need to use our FindModule instead of another one (like the one included ++ # with later versions of Z3 ++ list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) ++ find_package(Z3 4.7.1 REQUIRED) ++ list(POP_FRONT CMAKE_MODULE_PATH) ++endif() + + set(LLVM_ENABLE_DIA_SDK @LLVM_ENABLE_DIA_SDK@) + diff --git a/ports/llvm-13/0022-llvm-config-bin-path.patch b/ports/llvm-13/0022-llvm-config-bin-path.patch new file mode 100644 index 00000000..ed608df0 --- /dev/null +++ b/ports/llvm-13/0022-llvm-config-bin-path.patch @@ -0,0 +1,13 @@ +diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt +index a818de2e116c..17e8068c68d9 100644 +--- a/llvm/cmake/modules/CMakeLists.txt ++++ b/llvm/cmake/modules/CMakeLists.txt +@@ -115,7 +115,7 @@ 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_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}/tools/llvm") + + # Generate a default location for lit + if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) diff --git a/ports/llvm-13/0023-clang-sys-include-dir-path.patch b/ports/llvm-13/0023-clang-sys-include-dir-path.patch new file mode 100644 index 00000000..9a4dc6ad --- /dev/null +++ b/ports/llvm-13/0023-clang-sys-include-dir-path.patch @@ -0,0 +1,31 @@ +diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp +index 261f522f6c49..1aca52642169 100644 +--- a/clang/lib/Driver/ToolChains/Darwin.cpp ++++ b/clang/lib/Driver/ToolChains/Darwin.cpp +@@ -2126,11 +2126,12 @@ void DarwinClang::AddClangCXXStdlibIncludeArgs( + // include_next could break). + + // Check for (1) +- // Get from '/bin' to '/include/c++/v1'. ++ // Get from '/tools/llvm' to '/include/c++/v1'. + // Note that InstallBin can be relative, so we use '..' instead of + // parent_path. + llvm::SmallString<128> InstallBin = + llvm::StringRef(getDriver().getInstalledDir()); // /bin ++ llvm::sys::path::append(InstallBin, ".."); + llvm::sys::path::append(InstallBin, "..", "include", "c++", "v1"); + if (getVFS().exists(InstallBin)) { + addSystemInclude(DriverArgs, CC1Args, InstallBin); +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index da39f29e4619..acf46ec11ed3 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2922,7 +2922,7 @@ Generic_GCC::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, + // Android never uses the libc++ headers installed alongside the toolchain, + // which are generally incompatible with the NDK libraries anyway. + if (!getTriple().isAndroid()) +- if (AddIncludePath(getDriver().Dir + "/../include")) ++ if (AddIncludePath(getDriver().Dir + "/../../include")) + return; + // If this is a development, non-installed, clang, libcxx will + // not be found at ../include/c++ but it likely to be found at diff --git a/ports/llvm-13/CONTROL b/ports/llvm-13/CONTROL new file mode 100644 index 00000000..fd1e74f3 --- /dev/null +++ b/ports/llvm-13/CONTROL @@ -0,0 +1,141 @@ +Source: llvm-13 +Version: 13.0.0 +Homepage: https://llvm.org/ +Description: The LLVM Compiler Infrastructure +Supports: !uwp +Build-Depends: llvm-vcpkg-common, llvm-13[core, compiler-rt] (linux|osx) +Default-Features: tools, clang, mlir, enable-rtti, enable-z3, enable-eh, enable-assertions, disable-abi-breaking-checks, disable-terminfo, libcxx, libcxxabi, target-aarch64, target-arm, target-nvptx, target-sparc, target-x86 + +Feature: tools +Description: Build LLVM tools. + +Feature: utils +Description: Build LLVM utils. + +Feature: default-targets +Description: Build with platform-specific default targets +Build-Depends: llvm-13[core,target-x86] (x86|x64), llvm-13[core,target-arm] (arm&!arm64), llvm-13[core,target-aarch64] (arm64), llvm-13[core,target-all] (!x86&!x64&!arm&!arm64) + +Feature: target-all +Description: Build with all backends. +Build-Depends: llvm-13[core,target-aarch64,target-amdgpu,target-arm,target-bpf,target-hexagon,target-lanai,target-mips,target-msp430,target-nvptx,target-powerpc,target-riscv,target-sparc,target-systemz,target-webassembly,target-x86,target-xcore] + +Feature: target-aarch64 +Description: Build with AArch64 backend. + +Feature: target-amdgpu +Description: Build with AMDGPU backend. + +Feature: target-arm +Description: Build with ARM backend. + +Feature: target-avr +Description: Build with AVR backend. + +Feature: target-bpf +Description: Build with BPF backend. + +Feature: target-hexagon +Description: Build with Hexagon backend. + +Feature: target-lanai +Description: Build with Lanai backend. + +Feature: target-mips +Description: Build with Mips backend. + +Feature: target-msp430 +Description: Build with MSP430 backend. + +Feature: target-nvptx +Description: Build with NVPTX backend. + +Feature: target-powerpc +Description: Build with PowerPC backend. + +Feature: target-riscv +Description: Build with RISCV backend. + +Feature: target-sparc +Description: Build with Sparc backend. + +Feature: target-systemz +Description: Build with SystemZ backend. + +Feature: target-webassembly +Description: Build with WebAssembly backend. + +Feature: target-x86 +Description: Build with X86 backend. + +Feature: target-xcore +Description: Build with XCore backend. + +Feature: enable-rtti +Description: Build LLVM with run-time type information. + +Feature: enable-assertions +Description: Build LLVM with assertions. + +Feature: disable-assertions +Description: Build LLVM without assertions. + +Feature: enable-terminfo +Description: Build LLVM with linking to terminfo. +Build-Depends: ncurses + +Feature: disable-terminfo +Description: Build LLVM without linking to terminfo. + +Feature: enable-abi-breaking-checks +Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON. + +Feature: disable-abi-breaking-checks +Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_OFF. + +Feature: clang +Description: Build C Language Family Front-end. + +Feature: disable-clang-static-analyzer +Description: Build without static analyzer. + +Feature: clang-tools-extra +Description: Build Clang tools. + +Feature: compiler-rt +Description: Build compiler's runtime libraries. + +Feature: flang +Description: Build Fortran front end. +Build-Depends: llvm-13[core,mlir] + +Feature: lld +Description: Build LLVM linker. + +Feature: lldb +Description: Build LLDB debugger. + +Feature: mlir +Build-Depends: llvm-13[core,utils] +Description: Build Multi-Level IR Compiler Framework. + +Feature: openmp +Description: Build LLVM OpenMP libraries. +Build-Depends: llvm-13[core,utils] + +Feature: polly +Description: Build polyhedral optimizations for LLVM. +Build-Depends: llvm-13[core,utils] + +Feature: enable-z3 +Description: Compile with Z3 SMT solver support for Clang static analyzer. +Build-Depends: z3, llvm-13[core,clang] + +Feature: libcxx +Description: Build libcxx runtime + +Feature: libcxxabi +Description: Build libcxxabi runtime + +Feature: enable-eh +Description: Build LLVM with exception handler turned on. diff --git a/ports/llvm-13/portfile.cmake b/ports/llvm-13/portfile.cmake new file mode 100644 index 00000000..08381e54 --- /dev/null +++ b/ports/llvm-13/portfile.cmake @@ -0,0 +1,24 @@ +set(LLVM_VERSION "13.0.0") + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO llvm/llvm-project + REF llvmorg-${LLVM_VERSION} + SHA512 8004c05d32b9720fb3391783621690c1df9bd1e97e72cbff9192ed88a84b0acd303b61432145fa917b5b5e548c8cee29b24ef8547dcc8677adf4816e7a8a0eb2 + HEAD_REF main + PATCHES + 0001-fix-install-paths.patch + 0002-fix-openmp-debug.patch + 0003-fix-dr-1734.patch + 0004-fix-tools-path.patch + 0005-fix-compiler-rt-install-path.patch + 0006-fix-tools-install-path.patch + 0020-remove-FindZ3.cmake.patch + 0021-fix-FindZ3.cmake.patch + 0022-llvm-config-bin-path.patch + 0023-clang-sys-include-dir-path.patch +) + +include("${CURRENT_INSTALLED_DIR}/share/llvm-vcpkg-common/llvm-common-build.cmake") diff --git a/ports/llvm-vcpkg-common/llvm-common-build.cmake b/ports/llvm-vcpkg-common/llvm-common-build.cmake index c50c8b27..172f4cee 100644 --- a/ports/llvm-vcpkg-common/llvm-common-build.cmake +++ b/ports/llvm-vcpkg-common/llvm-common-build.cmake @@ -2,6 +2,10 @@ string(REPLACE "." ";" VERSION_LIST ${LLVM_VERSION}) list(GET VERSION_LIST 0 LLVM_VERSION_MAJOR) list(GET VERSION_LIST 1 LLVM_VERSION_MINOR) list(GET VERSION_LIST 2 LLVM_VERSION_PATCH) +# Remove anything after the first patch number (removes suffix like `-rc3`) +if("${LLVM_VERSION_PATCH}" MATCHES "^([0-9]+).*") + set(LLVM_VERSION_PATCH "${CMAKE_MATCH_1}") +endif() vcpkg_check_features( OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -119,7 +123,8 @@ if("clang" IN_LIST FEATURES OR "clang-tools-extra" IN_LIST FEATURES) # 1) LLVM/Clang tools are relocated from ./bin/ to ./tools/llvm/ (LLVM_TOOLS_INSTALL_DIR=tools/llvm) # 2) Clang resource files are relocated from ./lib/clang/ to ./tools/llvm/lib/clang/ (see patch 0007-fix-compiler-rt-install-path.patch) # So, the relative path should be changed from ../lib/clang/ to ./lib/clang/ - list(APPEND FEATURE_OPTIONS -DCLANG_RESOURCE_DIR=lib/clang/${LLVM_VERSION}) + # This needs to not include version suffixes like '-rc3' + list(APPEND FEATURE_OPTIONS -DCLANG_RESOURCE_DIR=lib/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}) endif() if("clang-tools-extra" IN_LIST FEATURES) list(APPEND LLVM_ENABLE_PROJECTS "clang-tools-extra")