diff options
Diffstat (limited to 'vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath')
| -rw-r--r-- | vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake | 65 | ||||
| -rw-r--r-- | vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/vcpkg.json | 6 |
2 files changed, 71 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake new file mode 100644 index 0000000..6754431 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake @@ -0,0 +1,65 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# Test for empty string +set(macho_dir "${CURRENT_PACKAGES_DIR}/lib") +set(test_rpath "") +set(expected "@loader_path") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# Test for empty string in the tools directory +set(macho_dir "${CURRENT_PACKAGES_DIR}/tools/hdf5") +set(test_rpath "") +set(expected "@loader_path/../../lib") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# macho dir in subdir +set(macho_dir "${CURRENT_PACKAGES_DIR}/lib/somesubdir") +set(test_rpath "") +set(expected "@loader_path/..") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath for '${macho_dir}' does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# Getting more complex +set(macho_dir "${CURRENT_PACKAGES_DIR}/plugins/notlib/extrasubdir") +set(test_rpath "") +set(expected "@loader_path/../../../lib") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/vcpkg.json new file mode 100644 index 0000000..17d7c76 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/vcpkg.json @@ -0,0 +1,6 @@ +{ + "name": "vcpkg-fixup-macho-rpath", + "version-date": "2024-06-15", + "description": "Test port to check the string replacement in z_vcpkg_fixup_macho_rpath", + "supports": "native & osx" +} |