add snappy and leveldb to LD_LIBRARY_PATH

This commit is contained in:
siddontang 2014-04-21 16:24:56 +08:00
parent b9100d77aa
commit 0c336c59bf
1 changed files with 15 additions and 1 deletions

View File

@ -35,7 +35,21 @@ else
echo "skip install leveldb" echo "skip install leveldb"
fi 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_CFLAGS="-I$LEVELDB_DIR/include -I$SNAPPY_DIR/include"
export CGO_LDFLAGS="-L$LEVELDB_DIR/lib -L$SNAPPY_DIR/lib -lsnappy" 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 go get github.com/jmhodges/levigo