From 0c336c59bf72b8795212abdfb05cee06f4e0a476 Mon Sep 17 00:00:00 2001 From: siddontang Date: Mon, 21 Apr 2014 16:24:56 +0800 Subject: [PATCH] add snappy and leveldb to LD_LIBRARY_PATH --- leveldb/build_deps.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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