Skip to content

Commit 0e6c39f

Browse files
committed
Recurse dylibs to catch libcrypto
1 parent 0e930c8 commit 0e6c39f

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

packages/macos/get-dylibs.sh

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,37 @@
22

33
INSTALLDIR=$1
44

5-
EXES=$(find $INSTALLDIR -type f -perm -u+x)
6-
LIBS=$(otool -L $EXES | grep -E "/opt/homebrew|/usr/local/opt" | grep -v python | sort | uniq | grep -o -E "/.*\.dylib")
5+
while true; do
6+
EXES=$(find $INSTALLDIR -type f -perm -u+x)
7+
LIBS=$(otool -L $EXES | grep -E "/opt/homebrew|/usr/local/opt" | grep -v python | sort | uniq | grep -o -E "/.*\.dylib")
78

8-
if [ ! $LIBS ]; then
9-
exit 1;
10-
fi
9+
if [ ! $LIBS ]; then
10+
echo "All libraries done"
11+
exit 0;
12+
fi
1113

12-
while IFS= read -r lib; do
13-
echo
14-
echo $lib
15-
libname=$(echo $lib | grep -o -E "[^/]*\.dylib")
16-
echo $libname
17-
echo
18-
while IFS= read -r exe; do
19-
if file $exe | grep "Mach-O 64-bit executable" > /dev/null; then
20-
if otool -L $exe | grep -o $lib > /dev/null; then
21-
echo "$exe $(otool -L $exe | grep -o $lib)"
22-
exedir=$(echo $exe | grep -o -E ".*/")
23-
install_name_tool -change $lib @loader_path/$libname $exe
24-
if ! otool -l $exe | grep "LC_RPATH" -A2 | grep "@loader_path" > /dev/null; then
25-
install_name_tool -add_rpath @loader_path/ $exe
26-
fi
27-
if [ ! -f $exedir$libname ]; then
28-
cp $lib $exedir$libname
14+
echo "Libraries found: $LIBS"
15+
16+
while IFS= read -r lib; do
17+
echo
18+
echo $lib
19+
libname=$(echo $lib | grep -o -E "[^/]*\.dylib")
20+
echo $libname
21+
echo
22+
while IFS= read -r exe; do
23+
if file $exe | grep "Mach-O 64-bit" > /dev/null; then
24+
if otool -L $exe | grep -o $lib > /dev/null; then
25+
echo "$exe $(otool -L $exe | grep -o $lib)"
26+
exedir=$(echo $exe | grep -o -E ".*/")
27+
install_name_tool -change $lib @loader_path/$libname $exe
28+
if ! otool -l $exe | grep "LC_RPATH" -A2 | grep "@loader_path" > /dev/null; then
29+
install_name_tool -add_rpath @loader_path/ $exe
30+
fi
31+
if [ ! -f $exedir$libname ]; then
32+
cp $lib $exedir$libname
33+
fi
2934
fi
3035
fi
31-
fi
32-
done <<< "$EXES"
33-
done <<< "$LIBS"
36+
done <<< "$EXES"
37+
done <<< "$LIBS"
38+
done

0 commit comments

Comments
 (0)