zhangmeng
2019-12-17 b40844a779c2405f90d72873fdbca7e9aae933db
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
#!/bin/sh
 
target="all"
 
if [ $# != 0 -a "$1" != "all" ]; then
    target=$1
fi
 
cur_dir=`pwd`
src=$cur_dir"/libgowrapper"
 
runtime_dir=$cur_dir"/runtime"
 
# runtime_dir not exist, then create
if [ ! -d $runtime_dir ];then
    mkdir $runtime_dir 
    echo "~~~CREATE RUNTIME LIBRARY DIRECTORY"  
fi
 
cd $src
 
for value in `ls`; do
    if [ ! -d $src"/"$value ];then
        continue
    fi
 
    if [ "$target" != "all" -a "$target" != "$value" ]; then
        continue
    fi
# build so file
    cd $src"/"$value
    go build -buildmode=plugin -o lib$value.so -a
    if [ $? != 0 ]; then
        echo "!!!CREATE lib$value.so FAILED, WATCH IT"
        continue
    fi
 
# move to runtime_dir
    cp -fr lib$value.so $runtime_dir
# move sdk to runtime_dir
    if [ -d `pwd`/sdk/lib ]; then
        cp -fr `pwd`/sdk/lib/* $runtime_dir
    fi
    
    if [ -d `pwd`/thirdparty/lib ]; then
        cp -fr `pwd`/thirdparty/lib/* $runtime_dir
    fi
 
    echo "~~~WATCH lib$value.so In $runtime_dir IF CORRECT"
 
    cd $src
done