Skip to content

Commit 7be0cc3

Browse files
committed
Build - Mac bundle: rewrite pre-staged dylib LC_ID_DYLIB to @rpath
1 parent c4573a8 commit 7be0cc3

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎app/mac-release-02-bundle-dylibs.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ bundle_deps_of() {
115115
local binary="$1"
116116
chmod u+w "$binary" 2>/dev/null || true
117117

118+
# If this binary is a dylib whose own LC_ID_DYLIB still points to an
119+
# external path (e.g. a copy that was vendored into the bundle pre-staged,
120+
# like Ruby's libyaml under server/native/ruby/...), rewrite the id to
121+
# @rpath/<base>. install_name_tool -change handles LC_LOAD_DYLIB only, so
122+
# the install name has to be fixed separately or the verify step trips.
123+
local own_id
124+
own_id="$(otool -D "$binary" 2>/dev/null | sed -n '2p')"
125+
if [ -n "$own_id" ] && is_external_dep "$own_id"; then
126+
unsign "$binary"
127+
install_name_tool -id "@rpath/$(basename "$own_id")" "$binary" 2>/dev/null \
128+
|| log_warn " could not rewrite id of ${binary##${RELEASE_APP}/}"
129+
fi
130+
118131
local deps_text
119132
deps_text="$(otool_deps "$binary")"
120133

0 commit comments

Comments
 (0)