2013-10-03 17:20:43 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2013-10-08 21:01:20 +00:00
|
|
|
cd `dirname $0`
|
2013-10-03 17:20:43 +00:00
|
|
|
|
|
|
|
export GOPATH=`pwd`
|
|
|
|
|
2013-11-07 20:46:50 +00:00
|
|
|
if [ "x$GOROOT" = 'x' -a -d $HOME/go ]; then
|
2013-10-03 17:20:43 +00:00
|
|
|
export GOROOT=$HOME/go
|
|
|
|
fi
|
2013-10-08 21:01:20 +00:00
|
|
|
|
|
|
|
pushd src
|
2013-10-23 17:06:18 +00:00
|
|
|
all_packages=$(find . -type d | egrep -v 'google|launchpad|github' | tr '\n' ' ' | sed 's/\.\///g')
|
|
|
|
packages=""
|
|
|
|
for i in $all_packages; do
|
2013-10-25 20:03:52 +00:00
|
|
|
if [ $i = "." ]; then
|
2013-10-23 17:06:18 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
if [ `ls $i/*.go 2>/dev/null | wc -l` -ne 0 ]; then
|
|
|
|
packages="$packages $i"
|
|
|
|
fi
|
|
|
|
done
|
2013-10-08 21:01:20 +00:00
|
|
|
popd
|
|
|
|
|
2013-10-11 14:55:35 +00:00
|
|
|
snappy_dir=/tmp/snappychronosdb
|
|
|
|
leveldb_dir=/tmp/leveldbchronosdb
|
|
|
|
export LD_LIBRARY_PATH=/usr/local/lib
|
2013-10-24 20:55:56 +00:00
|
|
|
on_linux="no"
|
2013-10-25 20:03:52 +00:00
|
|
|
if [ `uname` = "Linux" ]; then
|
2013-10-24 20:55:56 +00:00
|
|
|
on_linux=yes
|
2013-10-25 17:42:33 +00:00
|
|
|
|
2013-11-06 18:48:48 +00:00
|
|
|
elif [ "x$CC" == "x" -a `uname -v | cut -d' ' -f4` = "13.0.0:" ]; then
|
2013-10-25 17:42:33 +00:00
|
|
|
# for mavericks use gcc instead of llvm
|
2013-10-25 17:38:30 +00:00
|
|
|
export CC=gcc-4.2
|
2013-10-24 20:55:56 +00:00
|
|
|
fi
|
2013-11-06 18:48:48 +00:00
|
|
|
|
2013-11-07 20:46:50 +00:00
|
|
|
if [ "x$PYTHONPATH" = x -a $on_linux != yes ]; then
|
2013-11-06 18:48:48 +00:00
|
|
|
PYTHONPATH=/usr/local/lib/python2.7/site-packages/:$PYTHONPATH
|
|
|
|
fi
|
|
|
|
|
2013-10-25 20:03:52 +00:00
|
|
|
if [ $on_linux = yes ]; then
|
2013-10-11 14:55:35 +00:00
|
|
|
export CGO_CFLAGS="-I$leveldb_dir/include"
|
|
|
|
export CGO_LDFLAGS="$leveldb_dir/libleveldb.a $snappy_dir/.libs/libsnappy.a -lstdc++"
|
|
|
|
else
|
|
|
|
export CGO_LDFLAGS="-lleveldb -lsnappy -lstdc++"
|
|
|
|
fi
|