diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake | |
Diffstat (limited to 'vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake')
| -rw-r--r-- | vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake b/vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake new file mode 100644 index 0000000..c317fa8 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake @@ -0,0 +1,62 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +foreach(dir IN ITEMS tools/rpath-macho-test-binaries manual-tools/rpath-macho-test-binaries) + string(REPLACE "/" "_" logname "execute-rel-${dir}") + vcpkg_execute_required_process( + COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-macho-test-tool" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + LOGNAME "${logname}" + ) + if(NOT output STREQUAL "release") + message(SEND_ERROR "${dir}: $Actual: '${output}', expected: 'release'") + endif() +endforeach() + +if(NOT VCPKG_BUILD_TYPE) + foreach(dir IN ITEMS tools/rpath-macho-test-binaries/debug manual-tools/rpath-macho-test-binaries/debug debug/tools/rpath-macho-test-binaries) + string(REPLACE "/" "_" logname "execute-dbg-${dir}") + vcpkg_execute_required_process( + COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-macho-test-tool" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + LOGNAME "${logname}" + ) + if(NOT output STREQUAL "debug") + message(SEND_ERROR "${dir}: Actual: '${output}', expected: 'debug'") + endif() + endforeach() +endif() + +function(check_proper_rpath macho_lib) + vcpkg_execute_required_process( + COMMAND "otool" "-L" "${macho_lib}" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + LOGNAME "${logname}" + ) + + set(found_rpath_backend_lib OFF) + + string(REPLACE "\n" ";" output_lines "${output}") + # Ignore first line, it contains the path to the lib which we are checking + list(REMOVE_AT output_lines 0) + foreach(line IN LISTS output_lines) + if("${line}" MATCHES "\\s+/.*librpath-macho-backend-lib\\+\\+\\.dylib") + message(SEND_ERROR "${line} contains an absolute path") + endif() + if("${line}" MATCHES "@rpath/librpath-macho-backend-lib\\+\\+.dylib") + set(found_rpath_backend_lib ON) + endif() + endforeach() + + if(NOT found_rpath_backend_lib) + message(SEND_ERROR "@rpath/librpath-macho-backend-lib++.dylib not found in ${output}") + endif() +endfunction() + +check_proper_rpath("${CURRENT_INSTALLED_DIR}/lib/librpath-macho-test-lib.dylib") +check_proper_rpath("${CURRENT_INSTALLED_DIR}/debug/lib/librpath-macho-test-lib.dylib") |