aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/scripts/test_ports/rpath-macho-test
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/test_ports/rpath-macho-test
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/scripts/test_ports/rpath-macho-test')
-rw-r--r--vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake62
-rw-r--r--vcpkg/scripts/test_ports/rpath-macho-test/vcpkg.json8
2 files changed, 70 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")
diff --git a/vcpkg/scripts/test_ports/rpath-macho-test/vcpkg.json b/vcpkg/scripts/test_ports/rpath-macho-test/vcpkg.json
new file mode 100644
index 0000000..c7c70c0
--- /dev/null
+++ b/vcpkg/scripts/test_ports/rpath-macho-test/vcpkg.json
@@ -0,0 +1,8 @@
+{
+ "name": "rpath-macho-test",
+ "version-string": "ci",
+ "description": "Test rpath macho fixup",
+ "dependencies": [
+ "rpath-macho-test-binaries"
+ ]
+}