diff options
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/llvm/0005-fix-tools-path.patch | 14 | ||||
| -rw-r--r-- | ports/llvm/CONTROL | 2 | ||||
| -rw-r--r-- | ports/llvm/portfile.cmake | 71 |
3 files changed, 39 insertions, 48 deletions
diff --git a/ports/llvm/0005-fix-tools-path.patch b/ports/llvm/0005-fix-tools-path.patch new file mode 100644 index 000000000..bdfad617c --- /dev/null +++ b/ports/llvm/0005-fix-tools-path.patch @@ -0,0 +1,14 @@ +diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp +index 53ba24efc00..0badcafe000 100644 +--- a/llvm/tools/llvm-config/llvm-config.cpp ++++ b/llvm/tools/llvm-config/llvm-config.cpp +@@ -304,8 +304,8 @@ int main(int argc, char **argv) { + // Create an absolute path, and pop up one directory (we expect to be inside a + // 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/CONTROL b/ports/llvm/CONTROL index 28de43699..c6d652701 100644 --- a/ports/llvm/CONTROL +++ b/ports/llvm/CONTROL @@ -1,6 +1,6 @@ Source: llvm Version: 10.0.0 -Port-Version: 6 +Port-Version: 7 Homepage: https://llvm.org/ Description: The LLVM Compiler Infrastructure Supports: !uwp diff --git a/ports/llvm/portfile.cmake b/ports/llvm/portfile.cmake index 56209147a..6928676a8 100644 --- a/ports/llvm/portfile.cmake +++ b/ports/llvm/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_from_github( 0002-fix-install-paths.patch 0003-fix-vs2019-v16.6.patch 0004-fix-dr-1734.patch + 0005-fix-tools-path.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -145,57 +146,30 @@ vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH share/${PORT}) if("clang" IN_LIST FEATURES) vcpkg_fixup_cmake_targets(CONFIG_PATH share/clang TARGET_PATH share/clang) -endif() -if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - file(GLOB_RECURSE _llvm_release_targets - "${CURRENT_PACKAGES_DIR}/share/llvm/*-release.cmake" - ) - set(_clang_release_targets) - if("clang" IN_LIST FEATURES) - file(GLOB_RECURSE _clang_release_targets - "${CURRENT_PACKAGES_DIR}/share/clang/*-release.cmake" - ) + if(VCPKG_TARGET_IS_WINDOWS) + set(LLVM_EXECUTABLE_REGEX [[^([^.]*|[^.]*\.lld)\.exe$]]) + else() + set(LLVM_EXECUTABLE_REGEX [[^([^.]*|[^.]*\.lld)$]]) endif() - foreach(_target IN LISTS _llvm_release_targets _clang_release_targets) - file(READ ${_target} _contents) - # LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir. - # Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets. - string(REPLACE "{_IMPORT_PREFIX}/tools/${PORT}" "{_IMPORT_PREFIX}/bin" _contents "${_contents}") - file(WRITE ${_target} "${_contents}") - endforeach() -endif() -if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - file(GLOB_RECURSE _llvm_debug_targets - "${CURRENT_PACKAGES_DIR}/share/llvm/*-debug.cmake" - ) - set(_clang_debug_targets) - if("clang" IN_LIST FEATURES) - file(GLOB_RECURSE _clang_debug_targets - "${CURRENT_PACKAGES_DIR}/share/clang/*-debug.cmake" - ) - endif() - foreach(_target IN LISTS _llvm_debug_targets _clang_debug_targets) - file(READ ${_target} _contents) - # LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir. - # Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets. - string(REPLACE "{_IMPORT_PREFIX}/tools/${PORT}" "{_IMPORT_PREFIX}/bin" _contents "${_contents}") - # Debug shared libraries should have `d` suffix and should be installed in the `/bin` directory. - # Rename `/debug/bin/` to `/bin` - string(REPLACE "{_IMPORT_PREFIX}/debug/bin/" "{_IMPORT_PREFIX}/bin/" _contents "${_contents}") - file(WRITE ${_target} "${_contents}") + file(GLOB LLVM_TOOL_FILES "${CURRENT_PACKAGES_DIR}/bin/*") + set(LLVM_TOOLS) + foreach(tool_file IN LISTS LLVM_TOOL_FILES) + get_filename_component(tool_file "${tool_file}" NAME) + if(tool_file MATCHES "${LLVM_EXECUTABLE_REGEX}") + list(APPEND LLVM_TOOLS "${CMAKE_MATCH_1}") + endif() endforeach() - # Install debug shared libraries in the `/bin` directory - file(GLOB _debug_shared_libs ${CURRENT_PACKAGES_DIR}/debug/bin/*${CMAKE_SHARED_LIBRARY_SUFFIX}) - file(INSTALL ${_debug_shared_libs} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) + vcpkg_copy_tools( + TOOL_NAMES ${LLVM_TOOLS} + AUTO_CLEAN) +endif() - file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/debug/bin - ${CURRENT_PACKAGES_DIR}/debug/include - ${CURRENT_PACKAGES_DIR}/debug/share - ) +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) endif() # Handle copyright @@ -204,5 +178,8 @@ if("clang" IN_LIST FEATURES) file(INSTALL ${SOURCE_PATH}/clang/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/clang RENAME copyright) endif() -# Don't fail if the bin folder exists. -set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +# LLVM still generates a few DLLs in the static build: +# * libclang.dll +# * LTO.dll +# * Remarks.dll +set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) |
