forked from chparsons/rgbdemo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fix_macosx_bundle.sh
executable file
·130 lines (106 loc) · 4.36 KB
/
fix_macosx_bundle.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/sh
dump_ansi_colors ()
{
for attr in 0 1 4 5 7 ; do
echo "----------------------------------------------------------------"
printf "ESC[%s;Foreground;Background - \n" $attr
for fore in 30 31 32 33 34 35 36 37; do
for back in 40 41 42 43 44 45 46 47; do
printf '\033[%s;%s;%sm %02s;%02s ' $attr $fore $back $fore $back
done
printf '\n'
done
printf '\033[0m'
done
}
ansi_red()
{
printf '\033[1;31;40m'
}
ansi_purple()
{
printf '\033[1;34;40m'
}
ansi_clear()
{
printf '\033[0m'
}
try_run ()
{
echo `ansi_purple` "[RUN]" `ansi_clear` " $@"
if ! "$@"; then
echo `ansi_red` "[ERR]" `ansi_clear` " $@"
fi
}
run ()
{
echo `ansi_purple` "[RUN]" `ansi_clear` " $@"
if ! "$@"; then
echo `ansi_red` "[ERR]" `ansi_clear` " $@"
exit 1
fi
}
dbg_vars () # name
{
for name in $@; do
echo "[DBG] $name=\"${!name}\""
done
}
#-------------------------------------------------------------------------------
for app in $@;
do
program=`echo $app | sed -e s/\.app//`
macdeployqt $app
bin=`basename $program`
cd $app/Contents/Frameworks
rm -rf Qt*.framework
for l in ../../../common/lib/*.dylib ../../../common/*.framework; do
ln -sf $l .
done
for lib in *.dylib; do
try_run install_name_tool -change $lib @executable_path/../Frameworks/$lib ../MacOS/$bin
try_run install_name_tool -change lib/$lib @executable_path/../Frameworks/$lib ../MacOS/$bin
try_run install_name_tool -change @executable_path/../MacOS/$lib @executable_path/../Frameworks/$lib ../MacOS/$bin
try_run install_name_tool -change /opt/local/lib/$lib @executable_path/../Frameworks/$lib ../MacOS/$bin
try_run install_name_tool -change /usr/local/lib/$lib @executable_path/../Frameworks/$lib ../MacOS/$bin
try_run install_name_tool -change /usr/lib/libcminpack.1.1.3.dylib @executable_path/../Frameworks/libcminpack.1.1.3.dylib ../MacOS/$bin
done
# If not already done, uncomment this.
if false; then
for bin in *.dylib; do
for QTLIB in QtCore QtOpenGL QtSvg QtXml QtNetwork QtGui; do
try_run install_name_tool -change ${QTLIB}.framework/Versions/4/${QTLIB} \
@executable_path/../Frameworks/${QTLIB}.framework/Versions/4/${QTLIB} $bin
done
try_run install_name_tool -id @executable_path/../Frameworks/$bin $bin
try_run install_name_tool -change /usr/local/Cellar/jpeg/8c/lib/libjpeg.8.dylib @executable_path/../Frameworks/libjpeg.8.dylib $bin
try_run install_name_tool -change /usr/local/Cellar/jpeg/8b/lib/libjpeg.8.dylib @executable_path/../Frameworks/libjpeg.8.dylib $bin
try_run install_name_tool -change /usr/local/Cellar/libtiff/3.9.5/lib/libtiff.3.dylib @executable_path/../Frameworks/libtiff.3.dylib $bin
try_run install_name_tool -change /usr/local/Cellar/libtiff/3.9.5/lib/libtiffxx.3.dylib @executable_path/../Frameworks/libtiffxx.3.dylib $bin
try_run install_name_tool -change /usr/local/Cellar/jasper/1.900.1/lib/libjasper.1.dylib @executable_path/../Frameworks/libjasper.1.dylib $bin
if true; then
for lib in *.dylib; do
try_run install_name_tool -change @executable_path/$lib @executable_path/../Frameworks/$lib $bin
try_run install_name_tool -change $lib @executable_path/../Frameworks/$lib $bin
try_run install_name_tool -change lib/$lib @executable_path/../Frameworks/$lib $bin
try_run install_name_tool -change /opt/local/lib/$lib @executable_path/../Frameworks/$lib $bin
try_run install_name_tool -change /usr/local/lib/$lib @executable_path/../Frameworks/$lib $bin
try_run install_name_tool -change ../../Bin/Release/$lib @executable_path/../Frameworks/$lib $bin
try_run install_name_tool -change ../../../Bin/Release/$lib @executable_path/../Frameworks/$lib $bin
try_run install_name_tool -change /usr/lib/libcminpack.1.1.3.dylib @executable_path/../Frameworks/libcminpack.1.1.3.dylib $bin
done
fi
done
fi
# Copy some OpenNI plugins that also need to be in the MacOS dir
cd ../MacOS
rm -rf *.dylib
for lib in ../Frameworks/lib{nim*,Xn*}.dylib; do ln -sf $lib; done
rm -rf config plugins
ln -s ../../../common/plugins .
ln -s ../../../common/config .
cd ..
rm -rf PlugIns
ln -s ../../common/Contents/PlugIns .
cd ../..
done