Merge pull request #189 from felixbuenemann/homebrew-support

Use homebrew paths if /usr/local/opt exists
This commit is contained in:
siddontang 2015-10-05 12:39:15 +08:00
commit 144c5e240c
1 changed files with 18 additions and 4 deletions

22
dev.sh
View File

@ -10,10 +10,18 @@ fi
#default snappy and leveldb install path #default snappy and leveldb install path
#you may change yourself #you may change yourself
SNAPPY_DIR=/usr/local/snappy HOMEBREW_PREFIX=$(brew --prefix 2>/dev/null)
LEVELDB_DIR=/usr/local/leveldb if [[ ! -z "$HOMEBREW_PREFIX" ]]; then
ROCKSDB_DIR=/usr/local/rocksdb SNAPPY_DIR=$HOMEBREW_PREFIX/opt/snappy
LUA_DIR=/usr/local/lua LEVELDB_DIR=$HOMEBREW_PREFIX/opt/leveldb
ROCKSDB_DIR=$HOMEBREW_PREFIX/opt/rocksdb
LUA_DIR=$HOMEBREW_PREFIX/opt/lua51
else
SNAPPY_DIR=/usr/local/snappy
LEVELDB_DIR=/usr/local/leveldb
ROCKSDB_DIR=/usr/local/rocksdb
LUA_DIR=/usr/local/lua
fi
function add_path() function add_path()
{ {
@ -72,6 +80,12 @@ if [ -f $LUA_DIR/include/lua.h ]; then
LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $LUA_DIR/lib) LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $LUA_DIR/lib)
DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $LUA_DIR/lib) DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $LUA_DIR/lib)
GO_BUILD_TAGS="$GO_BUILD_TAGS lua" GO_BUILD_TAGS="$GO_BUILD_TAGS lua"
elif [ -f $LUA_DIR/include/lua-5.1/lua.h ]; then
CGO_CFLAGS="$CGO_CFLAGS -I$LUA_DIR/include/lua-5.1"
CGO_LDFLAGS="$CGO_LDFLAGS -L$LUA_DIR/lib -llua5.1"
LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $LUA_DIR/lib)
DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $LUA_DIR/lib)
GO_BUILD_TAGS="$GO_BUILD_TAGS lua"
fi fi
export CGO_CFLAGS export CGO_CFLAGS