forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.env
86 lines (70 loc) · 2.47 KB
/
dev.env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 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\/github.com\/youtube\/vitess/}}"
# VTTOP sanity check
if [[ "$VTTOP" == "${VTTOP/\/src\/github.com\/youtube\/vitess/}" ]]; then
echo "WARNING: VTTOP($VTTOP) does not contain src/github.com/youtube/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
export PATH=$(prepend_path $PATH $VTROOT/dist/mysql/bin)
# 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
if [ "$(which mysql_config)" == "" ]; then
echo "WARNING: VT_MYSQL_ROOT unset because mysql_config not found"
else
export VT_MYSQL_ROOT=$(dirname $(dirname $(which mysql_config)))
fi
fi
# mysql cgo library config
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)
# 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