diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-13 11:20:12 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-13 11:20:12 +0000 |
| commit | 13d8de7c674aecb1e8e9e9a45fd82edef4dd2709 (patch) | |
| tree | 09570ee30779a623eed5e78121270326ccd181c9 /cmake | |
| parent | 3320220943fee04e6fff98c14aadf148472e6556 (diff) | |
build: relocate Homebrew bottle runtime search paths
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/HomebrewPackages.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/HomebrewPackages.cmake b/cmake/HomebrewPackages.cmake index edb40f4..30c0e70 100644 --- a/cmake/HomebrewPackages.cmake +++ b/cmake/HomebrewPackages.cmake @@ -77,6 +77,21 @@ function(cpsc_prepare_homebrew_packages) list(APPEND options -change "${old}" "${new}") endif() endforeach() + execute_process(COMMAND "${cpsc_otool}" -l "${binary}" + OUTPUT_VARIABLE commands ERROR_QUIET RESULT_VARIABLE result) + if(NOT result EQUAL 0) + message(FATAL_ERROR "Cannot inspect Mach-O load commands in ${binary}") + endif() + string(REGEX MATCHALL "cmd LC_RPATH\n[^\n]*\n[ \t]*path [^\n]+" rpaths "${commands}") + foreach(rpath IN LISTS rpaths) + string(REGEX REPLACE + "^cmd LC_RPATH\n[^\n]*\n[ \t]*path (.*) \\(offset [0-9]+\\)$" + "\\1" old "${rpath}") + cpsc_homebrew_path("${old}" new) + if(NOT old STREQUAL new) + list(APPEND options -rpath "${old}" "${new}") + endif() + endforeach() execute_process(COMMAND "${cpsc_otool}" -D "${binary}" OUTPUT_VARIABLE identity ERROR_QUIET) string(REGEX MATCH "\n([^\n]+)" match "${identity}") |
