forked from haiwen/seafile-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genapp.sh
executable file
·78 lines (67 loc) · 2.72 KB
/
genapp.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
#!/bin/sh
top_dir=${PWD}
dylibs="/usr/local/lib/libccnet.0.dylib /usr/local/lib/libseafile.0.dylib /usr/local/lib/libsearpc.1.dylib /opt/local/lib/libcrypto.1.0.0.dylib /opt/local/lib/libevent-2.0.5.dylib /opt/local/lib/libssl.1.0.0.dylib /opt/local/lib/libgio-2.0.0.dylib /opt/local/lib/libgmodule-2.0.0.dylib /opt/local/lib/libgobject-2.0.0.dylib /opt/local/lib/libgthread-2.0.0.dylib /opt/local/lib/libffi.6.dylib /opt/local/lib/libglib-2.0.0.dylib /opt/local/lib/libintl.8.dylib /opt/local/lib/libiconv.2.dylib /opt/local/lib/libsqlite3.0.dylib /opt/local/lib/libz.1.dylib /opt/local/lib/libjansson.4.dylib"
exes="`which ccnet` `which seaf-daemon`"
all=$dylibs" ${exes}"
target=seafile-applet
configuration=Release
function change_otool() {
DIR=$1
pushd ${DIR}
for var in $all ; do
dyexe=$(basename "$var")
if [ -f $dyexe ] ; then
echo "Deal with "$dyexe
for libpath in $dylibs ; do
lib=$(basename $libpath)
if [ "$lib" = "$dyexe" ] ; then
echo "install_name_tool -id @loader_path/../Frameworks/$lib $dyexe"
install_name_tool -id @loader_path/../Frameworks/$lib $dyexe
else
echo "install_name_tool -change $libpath @loader_path/../Frameworks/$lib $dyexe"
install_name_tool -change $libpath @loader_path/../Frameworks/$lib $dyexe
fi
done
fi
done
popd
}
while [ $# -ge 1 ]; do
case $1 in
"xcode" )
mkdir -p libs
cp -f `which ccnet` libs/
cp -f `which seaf-daemon` libs/
qmake -spec macx-xcode
;;
"build" )
echo "build ${target}.app for Mac OS X 10.6"
rm -rf build
lrelease seafile-client.pro
xcodebuild -target ${target} -configuration ${configuration}
rm -rf ${top_dir}/${target}.app
cp -rf build/Release/${target}.app ${top_dir}/${target}.app
;;
"libs" )
mkdir -p ${top_dir}/${target}.app/Contents/Frameworks
pushd ${top_dir}/${target}.app/Contents/Frameworks
for var in $dylibs ; do
cp -f $var ./
base=$(basename "$var")
chmod 0744 $base
done
popd
;;
"otool" )
echo "macdeployqt ${target}.app"
macdeployqt ${target}.app
change_otool ${top_dir}/${target}.app/Contents/Resources
change_otool ${top_dir}/${target}.app/Contents/Frameworks
;;
"dmg" )
echo "macdeployqt ${target}.app -dmg"
macdeployqt ${target}.app -dmg
;;
esac
shift
done