File tree Expand file tree Collapse file tree 3 files changed +37
-32
lines changed
Expand file tree Collapse file tree 3 files changed +37
-32
lines changed Original file line number Diff line number Diff line change @@ -582,12 +582,8 @@ $(BUNDLE): $(TARGET) $(REFLECTOR_TARGET) @MANPAGES@ hd-rum-multi/hd-rum
582582 $(CP ) hd-rum-multi/hd-rum $(BUNDLE ) /Contents/MacOS/
583583 $(CP ) $(srcdir ) /data/template/bin/* $(BUNDLE ) /Contents/MacOS
584584 $(CP ) -r $(srcdir ) /share/ $(BUNDLE ) /Contents/share/
585- for n in $( BUNDLE) /Contents/MacOS/* ; \
586- do echo quit \
587- | $(DYLIBBUNDLER ) $(DYLIBBUNDLER_FLAGS ) -of -cd -b \
588- -d $(BUNDLE ) /Contents/libs/ -p @executable_path/../libs/ -x $$ n; \
589- done
590- $(srcdir ) /data/scripts/macos_fix_multiple_rpaths.sh $(BUNDLE )
585+ $(srcdir ) /data/scripts/macos_bundle_libs.sh " $( DYLIBBUNDLER) " \
586+ " $( DYLIBBUNDLER_FLAGS) " " $( BUNDLE) "
591587 if [ -d Frameworks ]; then $( CP) -R Frameworks $( BUNDLE) /Contents/; fi
592588 if [ -n ' @MANPAGES@' ]; then mkdir -p $( BUNDLE) /Contents/man/man1; \
593589 $(CP ) @MANPAGES@ $(BUNDLE ) /Contents/man/man1/; fi
Original file line number Diff line number Diff line change 1+ #! /bin/sh -eu
2+
3+ dylibbundler=$1
4+ dylibbundler_flags=$2
5+ bundle=$3
6+
7+ rpath=@executable_path/../libs/
8+
9+ for n in " $bundle " /Contents/MacOS/* ; do
10+ # shellcheck disable=SC2086 # intentional, even $dylibbundler
11+ # can have flags like 'dylibbundler -f'; obvious for _flags
12+ echo quit | $dylibbundler $dylibbundler_flags -of -cd -b \
13+ -d " $bundle /Contents/libs/" -p " $rpath " -x " $n "
14+ done
15+
16+ # Remove multiple LC_RPATH occurences of @executable_path/../libs/
17+ # as can be seen by cmd `otool -l $lib | grep -B 1 -A 2 LC_RPATH`
18+ # which seem to be refused by dyld since macOS 15.4 as can be seen
19+ # here <https://github.com/CESNET/UltraGrid/issues/436>. The multiplied
20+ # paths are caused by dylibbundler LC_RPATH replacements.
21+
22+ # # output number of $rpath occurences in 'cmd LC_RPATH'
23+ num_rel_lc_rpath () {
24+ otool -l " $1 " | sed -n ' /LC_RPATH/,+2p' | grep -c " $rpath " || true
25+ }
26+
27+ find " $bundle " -type f -print0 |
28+ while IFS= read -r -d ' ' n; do
29+ count=$( num_rel_lc_rpath " $n " )
30+ # remove all but at most one LC_RPATH $path occurences
31+ while [ " $count " -gt 1 ]; do
32+ install_name_tool -delete_rpath " $rpath " " $n "
33+ count=$(( count - 1 ))
34+ done
35+ done
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments