vitess-gh/dev.env

87 строки
2.5 KiB
Bash
Исходник Обычный вид История

# Copyright 2012, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
2012-02-25 11:30:03 +04:00
export VTTOP=$(pwd)
2012-06-05 05:42:45 +04:00
export VTROOT="${VTROOT:-${VTTOP/\/src\/code.google.com\/p\/vitess/}}"
# VTTOP sanity check
if [[ "$VTTOP" == "${VTTOP/\/src\/code.google.com\/p\/vitess/}" ]]; then
echo "WARNING: VTTOP($VTTOP) does not contain src/code.google.com/p/vitess"
fi
2012-02-25 11:30:03 +04:00
export GOTOP=$VTTOP/go
export PYTOP=$VTTOP/py
function prepend_path()
{
# $1 path variable
# $2 path to add
if [ -d "$2" ] && [[ ":$1:" != *":$2:"* ]]; then
echo "$2:$1"
else
echo "$1"
fi
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
export PATH="$1:$PATH"
fi
}
for pypath in $(find $VTROOT/dist -name site-packages)
2012-02-25 11:30:03 +04:00
do
export PYTHONPATH=$(prepend_path $PYTHONPATH $pypath)
2012-02-25 11:30:03 +04:00
done
export PYTHONPATH=$(prepend_path $PYTHONPATH $VTROOT/py-vtdb)
export PATH=$(prepend_path $PATH $VTROOT/bin)
if [ "$GOBIN" ]; then
export PATH=$(prepend_path $PATH $GOBIN)
fi
2013-07-19 04:53:59 +04:00
export PATH=$(prepend_path $PATH $VTROOT/dist/mysql/bin)
2013-04-06 04:55:22 +04:00
# GOROOT sanity
go_bin=`which go`
go_env=`go env | grep GOROOT | cut -f 2 -d\"`
if [ "$go_bin" -a "$go_bin" != "$go_env/bin/go" ]; then
echo "WARNING: \$GOROOT may not compatible with the used go binary"
echo "Please make sure 'go' comes from \$GOROOT/bin"
echo "go_env: $go_env"
echo "go_bin: $go_bin"
fi
# mysql install location. Please set based on your environment.
# Build will not work if this is incorrect.
if [ "$VT_MYSQL_ROOT" == "" ]; then
2013-03-09 00:01:49 +04:00
if [ "$(which mysql_config)" == "" ]; then
echo "WARNING: VT_MYSQL_ROOT unset because mysql_config not found"
2013-03-09 00:01:49 +04:00
else
export VT_MYSQL_ROOT=$(dirname $(dirname $(which mysql_config)))
fi
fi
# mysql cgo library config
2012-09-14 02:30:30 +04:00
export LD_LIBRARY_PATH=$(prepend_path $LD_LIBRARY_PATH $VT_MYSQL_ROOT/lib/mysql)
export PKG_CONFIG_PATH=$(prepend_path $PKG_CONFIG_PATH $VTROOT/lib)
# zookeeper cgo library config
export CGO_CFLAGS="$CGO_CFLAGS -I$VTROOT/dist/vt-zookeeper-3.3.5/include/c-client-src"
export CGO_LDFLAGS="$CGO_LDFLAGS -L$VTROOT/dist/vt-zookeeper-3.3.5/lib"
export LD_LIBRARY_PATH=$(prepend_path $LD_LIBRARY_PATH $VTROOT/dist/vt-zookeeper-3.3.5/lib)
export GOPATH=$(prepend_path $GOPATH $VTROOT)
2012-02-25 11:30:03 +04:00
# Useful aliases. Remove if inconvenient.
alias gt="cd $GOTOP"
alias pt="cd $PYTOP"
alias vt="cd $VTTOP"
2012-09-25 22:00:05 +04:00
function vtretag() {
go-etags -o $VTROOT/src/TAGS $(find $VTROOT/src -iname '*.go' -a \! -name '*test.go' -type f | sort)
}
if [ "$(which go-etags)" ]; then
vtretag
fi