diff --git a/leveldb/build_deps.sh b/leveldb/build_deps.sh index 3b1443b..fec3b2f 100644 --- a/leveldb/build_deps.sh +++ b/leveldb/build_deps.sh @@ -35,7 +35,21 @@ else echo "skip install leveldb" fi +function add_path() +{ + # $1 path variable + # $2 path to add + if [ -d "$2" ] && [[ ":$1:" != *":$2:"* ]]; then + echo "$1:$2" + else + echo "$1" + fi +} + export CGO_CFLAGS="-I$LEVELDB_DIR/include -I$SNAPPY_DIR/include" export CGO_LDFLAGS="-L$LEVELDB_DIR/lib -L$SNAPPY_DIR/lib -lsnappy" +export LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $SNAPPY_DIR/lib) +export LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $LEVELDB_DIR/lib) -go get github.com/jmhodges/levigo \ No newline at end of file + +go get github.com/jmhodges/levigo