-
Notifications
You must be signed in to change notification settings - Fork 19
/
cplib
executable file
·133 lines (120 loc) · 2.06 KB
/
cplib
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
131
132
133
#!/bin/bash
function JudgeInputParams() {
echo "JudgeInputParams" $1 $2 $3
if [ ! -d "/$1" ]
then
echo "$1 not exist"
return -1
fi
case $2 in
s|d|h)
;;
*)
echo "[s|d|h] supported only"
return -1
;;
esac
case $3 in
all|cares|osip|exosip)
;;
*)
echo "[all|cares|osip|exosip] supported only"
return -1
;;
esac
}
function CopyCaresLibrary {
DEST_PATH=$1
case $2 in
"d")
libdir="/usr/local/lib"
cp -a $libdir/libcares.so* $DEST_PATH
;;
"s")
libdir="/usr/local/lib"
cp -a $libdir/libcares.a $DEST_PATH
;;
"h")
libdir="/usr/local/include"
cp -a -p $libdir/ares*.h $DEST_PATH/cares
;;
esac
}
function CopyOsipLibrary {
DEST_PATH=$1
case $2 in
"d")
libdir="/usr/local/lib"
cp -a $libdir/libosipparser2.so* $DEST_PATH
cp -a $libdir/libosip2.so* $DEST_PATH
;;
"s")
libdir="/usr/local/lib"
cp -a $libdir/libosipparser2.a $DEST_PATH
cp -a $libdir/libosip2.a $DEST_PATH
;;
"h")
libdir="/usr/local/include/osipparser2"
cp -a -p $libdir/* $DEST_PATH/osipparser2
libdir="/usr/local/include/osip2"
cp -a -p $libdir/* $DEST_PATH/osip2
;;
esac
}
function CopyExosipLibrary {
DEST_PATH=$1
case $2 in
"d")
libdir="/usr/local/lib"
cp -a $libdir/libeXosip2.so* $DEST_PATH
;;
"s")
libdir="/usr/local/lib"
cp -a $libdir/libeXosip2.a $DEST_PATH
;;
"h")
libdir="/usr/local/include/eXosip2"
cp -a -p $libdir/* $DEST_PATH/eXosip2
;;
esac
}
paraNum=4
if [ $# -lt $paraNum ]
then
echo "usage: ./cplib DEST_PATH [s|d|h] [all|cares|osip|exosip] groupname"
echo "s: static library"
echo "d: dynamic library"
echo "h: header"
exit
fi
JudgeInputParams $1 $2 $3
if [ $? -eq -1 ]
then
exit
fi
# 解析拷贝库名称
case $3 in
"all")
echo 'Copy all library'
CopyCaresLibrary $1 $2
CopyOsipLibrary $1 $2
CopyExosipLibrary $1 $2
;;
"cares")
echo 'Copy cares library'
CopyCaresLibrary $1 $2
;;
"osip")
echo 'Copy osip library'
CopyOsipLibrary $1 $2
;;
"exosip")
echo 'Copy exosip library'
CopyExosipLibrary $1 $2
;;
*)
echo 'Wrong params'
exit
;;
esac
chown -R $4:$4 $1