#!/bin/sh target="all" if [ $# != 0 -a "$1" != "all" ]; then target=$1 fi cur_dir=`pwd` src=$cur_dir"/libgowrapper" runtime_dir=$cur_dir"/libs" # runtime_dir not exist, then create if [ ! -d $runtime_dir ];then mkdir $runtime_dir echo "~~~CREATE RUNTIME LIBRARY DIRECTORY $runtime_dir" 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 deps_dir=$runtime_dir"/"$value if [ ! -d $deps_dir ];then mkdir -p $deps_dir fi # move to runtime_dir rm -fr $deps_dir/* mv -f lib$value.so $deps_dir # move sdk to runtime_dir if [ -d `pwd`/sdk/lib ]; then cp -fr `pwd`/sdk/lib/* $deps_dir fi if [ -d `pwd`/thirdparty/lib ]; then cp -fr `pwd`/thirdparty/lib/* $deps_dir fi echo "~~~WATCH lib$value.so In $deps_dir IF CORRECT" cd $src done