forked from haiwen/seafile-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenapp.sh
executable file
·96 lines (84 loc) · 3.16 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
set -e
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 /opt/local/lib/libcurl.4.dylib \
/opt/local/lib/libidn.11.dylib"
exes="`which ccnet` `which seaf-daemon`"
all=$dylibs" ${exes}"
target=seafile-applet
configuration=Release
num_cpus=$(sysctl -n hw.ncpu)
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" )
export CC=clang
export CXX=clang++
cmake -G Xcode -DCMAKE_BUILD_TYPE=${configuration} .
;;
"build" )
echo "build ${target}.app with -j${num_cpus}"
rm -rf Release
xcodebuild -target ${target} -configuration $configuration -jobs $num_cpus
rm -rf ${top_dir}/${target}.app
cp -rf Release/${target}.app ${top_dir}/${target}.app
;;
# use xctool, provide better output (experimental)
"build2" )
echo "build ${target}.app with xctool -j${num_cpus}"
rm -rf Release
xctool -scheme ${target} -configuration $configuration -jobs $num_cpus
rm -rf ${top_dir}/${target}.app
cp -rf 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