mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 03:10:57 +08:00
e38b936343
... and don't fetch patchelf unless we actually need it. For example cmake helper ports have no need to fetch patchelf. In https://github.com/microsoft/vcpkg/pull/36056 , things were changed to unconditionally patchelf when targeting Linux. Unfortunately that broke --only-downloads a lot of the time. This fixes that. Also contains @Osyotr 's fixes from https://github.com/microsoft/vcpkg/pull/37190 to coalesce world rebuilds a bit, so repeating comments from there: Fixes https://github.com/microsoft/vcpkg/issues/37183 Towards https://github.com/microsoft/vcpkg/issues/25668
123 lines
4.1 KiB
CMake
123 lines
4.1 KiB
CMake
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
|
|
|
# Test for empty string
|
|
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib")
|
|
set(test_rpath "")
|
|
set(expected "$ORIGIN")
|
|
|
|
z_vcpkg_calculate_corrected_rpath(
|
|
ELF_FILE_DIR "${elf_dir}"
|
|
ORG_RPATH "${test_rpath}"
|
|
OUT_NEW_RPATH_VAR new_rpath
|
|
)
|
|
|
|
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x")
|
|
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ")
|
|
else()
|
|
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ")
|
|
endif()
|
|
|
|
# Test for empty string in the tools directory
|
|
set(elf_dir "${CURRENT_PACKAGES_DIR}/tools/hdf5")
|
|
set(test_rpath "")
|
|
set(expected "$ORIGIN:$ORIGIN/../../lib")
|
|
|
|
z_vcpkg_calculate_corrected_rpath(
|
|
ELF_FILE_DIR "${elf_dir}"
|
|
ORG_RPATH "${test_rpath}"
|
|
OUT_NEW_RPATH_VAR new_rpath
|
|
)
|
|
|
|
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x")
|
|
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ")
|
|
else()
|
|
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ")
|
|
endif()
|
|
|
|
# Simple replacement and outside path test
|
|
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib")
|
|
set(test_rpath "${CURRENT_PACKAGES_DIR}/lib:/usr/lib/")
|
|
set(expected "$ORIGIN")
|
|
|
|
z_vcpkg_calculate_corrected_rpath(
|
|
ELF_FILE_DIR "${elf_dir}"
|
|
ORG_RPATH "${test_rpath}"
|
|
OUT_NEW_RPATH_VAR new_rpath
|
|
)
|
|
|
|
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x")
|
|
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ")
|
|
else()
|
|
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ")
|
|
endif()
|
|
|
|
# Simple pkgconfig path and outside path test
|
|
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib/")
|
|
set(test_rpath "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../lib:/usr/lib/")
|
|
set(expected "$ORIGIN")
|
|
|
|
z_vcpkg_calculate_corrected_rpath(
|
|
ELF_FILE_DIR "${elf_dir}"
|
|
ORG_RPATH "${test_rpath}"
|
|
OUT_NEW_RPATH_VAR new_rpath
|
|
)
|
|
|
|
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x")
|
|
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ")
|
|
else()
|
|
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ")
|
|
endif()
|
|
|
|
# elf dir in subdir
|
|
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib/somesubdir")
|
|
set(test_rpath "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../lib:/usr/lib/")
|
|
set(expected "$ORIGIN:$ORIGIN/..")
|
|
|
|
z_vcpkg_calculate_corrected_rpath(
|
|
ELF_FILE_DIR "${elf_dir}"
|
|
ORG_RPATH "${test_rpath}"
|
|
OUT_NEW_RPATH_VAR new_rpath
|
|
)
|
|
|
|
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x")
|
|
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ")
|
|
else()
|
|
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ")
|
|
endif()
|
|
|
|
# Getting more complex
|
|
set(elf_dir "${CURRENT_PACKAGES_DIR}/plugins/notlib/extrasubdir")
|
|
set(test_rpath "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/../../lib/someotherdir2:${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../someotherdir1:/usr/lib/")
|
|
set(expected "$ORIGIN:$ORIGIN/../../../lib:$ORIGIN/../../../lib/someotherdir2:$ORIGIN/../../../someotherdir1")
|
|
|
|
z_vcpkg_calculate_corrected_rpath(
|
|
ELF_FILE_DIR "${elf_dir}"
|
|
ORG_RPATH "${test_rpath}"
|
|
OUT_NEW_RPATH_VAR new_rpath
|
|
)
|
|
|
|
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x")
|
|
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ")
|
|
else()
|
|
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ")
|
|
endif()
|
|
|
|
|
|
set(X_VCPKG_RPATH_KEEP_SYSTEM_PATHS ON)
|
|
# Simple replacement and outside path test
|
|
set(elf_dir "${CURRENT_PACKAGES_DIR}/lib")
|
|
set(test_rpath "${CURRENT_PACKAGES_DIR}/lib:/usr/lib/")
|
|
set(expected "$ORIGIN:/usr/lib")
|
|
|
|
z_vcpkg_calculate_corrected_rpath(
|
|
ELF_FILE_DIR "${elf_dir}"
|
|
ORG_RPATH "${test_rpath}"
|
|
OUT_NEW_RPATH_VAR new_rpath
|
|
)
|
|
|
|
if(NOT "x${new_rpath}x" STREQUAL "x${expected}x")
|
|
message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ")
|
|
else()
|
|
message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ")
|
|
endif()
|