зеркало из https://github.com/github/vitess-gh.git
64 строки
1.7 KiB
Bash
64 строки
1.7 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.
|
|
|
|
export VTTOP=$(pwd)
|
|
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
|
|
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)
|
|
do
|
|
export PYTHONPATH=$(prepend_path $PYTHONPATH $pypath)
|
|
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
|
|
|
|
# mysql install location. Please set based on your environment.
|
|
# Build will not work if this is incorrect.
|
|
|
|
|
|
if [ "$VT_MYSQL_ROOT" == "" ]; then
|
|
export VT_MYSQL_ROOT=$(dirname $(dirname $(which mysql_config)))
|
|
fi
|
|
|
|
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)
|
|
export GOPATH=$(prepend_path $GOPATH $VTROOT)
|
|
|
|
# Useful aliases. Remove if inconvenient.
|
|
alias gt="cd $GOTOP"
|
|
alias pt="cd $PYTOP"
|
|
alias vt="cd $VTTOP"
|
|
|
|
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
|