zhangmeng
2019-12-11 2f5f0c75f3257b4ea9c37df6d02e5598b975740f
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
#!/bin/sh
 
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"  
else
    rm -fr $runtime_dir/*
fi
 
cd $src
 
for value in `ls`; do
    if [ ! -d $src"/"$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