-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildFrameworks.sh
executable file
·70 lines (53 loc) · 2.24 KB
/
buildFrameworks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
if [ ! -f MacOS/sigterm ]; then
echo "You have to call $0 from the sigterm.app/Contents directory (file MacOS/sigterm not found)"
exit 1;
fi
echo "Checking dependencies of MacOS/sigterm ..."
LIBS=`otool -L MacOS/sigterm | awk '{print $1}' | grep -v '/usr/lib' | grep -v '/System' | grep -v ':'`
echo "Removing Frameworks directory ..."
rm -rf Frameworks
echo "Creating Frameworks directory ..."
mkdir Frameworks
COPIED_LIBS=""
for LIB in $LIBS; do
if [ `echo $LIB | grep .framework` ]; then
FRAMEWORK=`echo $LIB | sed -e 's/\(.*.framework\).*$/\1/'`
echo cp -R $FRAMEWORK Frameworks ...
cp -R $FRAMEWORK Frameworks
BASE=`basename $FRAMEWORK`
echo rm -rf Frameworks/$BASE/Versions/Current/Headers
echo rm -rf Frameworks/$BASE/Versions/Current/*_debug
rm -rf Frameworks/$BASE/Versions/Current/Headers
rm -rf Frameworks/$BASE/Versions/Current/*_debug
BINARY=`echo $BASE | cut -d '.' -f 1`
echo Changing dependencies for Frameworks/$BASE
install_name_tool -id @executable_path/../Frameworks/$BASE/Versions/4.0/$BINARY Frameworks/$BASE/Versions/4.0/$BINARY
install_name_tool -change $LIB @executable_path/../Frameworks/$BASE/Versions/4.0/$BINARY MacOS/sigterm
COPIED_LIBS="$COPIED_LIBS Frameworks/$BASE/Versions/4.0/$BINARY"
else
echo cp $LIB Frameworks
cp $LIB Frameworks
BASE=`basename $LIB`
echo Changing dependencies for Frameworks/$BASE
install_name_tool -id @executable_path/../Frameworks/$BASE Frameworks/$BASE
install_name_tool -change $LIB @executable_path/../Frameworks/$BASE MacOS/sigterm
COPIED_LIBS="$COPIED_LIBS Frameworks/$BASE"
fi
done
for LIB in $COPIED_LIBS; do
DEPS=`otool -L $LIB | awk '{print $1}' | grep -v '/usr/lib' | grep -v '/System' | grep -v '@executable_path' | grep -v ':'`
for DEPLIB in $DEPS; do
if [ `echo $DEPLIB | grep .framework` ]; then
FRAMEWORK=`echo $DEPLIB | sed -e 's/\(.*.framework\).*$/\1/'`
BASE=`basename $FRAMEWORK`
BINARY=`echo $BASE | cut -d '.' -f 1`
echo "Changing depencendy for $LIB ..."
install_name_tool -change $DEPLIB @executable_path/../Frameworks/${BASE}/Versions/4.0/$BINARY $LIB
else
BASE=`basename $DEPLIB`
echo "Changing depencendy for $LIB ..."
install_name_tool -change $DEPLIB @executable_path/../Frameworks/$BASE $LIB
fi
done
done