forked from pingcap/docs-cn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·60 lines (46 loc) · 1.42 KB
/
build.sh
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
#!/bin/bash
set -e
# Use current path for building and installing TiDB.
TIDB_PATH=`pwd`
echo "building TiDB components in $TIDB_PATH"
# All the binaries are installed in the `bin` directory.
mkdir -p $TIDB_PATH/bin
# Assume we install go in /usr/local/go
export PATH=$PATH:/usr/local/go/bin
echo "checking if go is installed"
# Go is required
go version
# The output might be like: go version go1.6 darwin/amd64
echo "checking if rust is installed"
# Rust nightly is required
rustc -V
# The output might be like: rustc 1.12.0-nightly (7ad125c4e 2016-07-11)
# Set the GOPATH correctly.
export GOPATH=$TIDB_PATH/deps/go
# Build TiDB
echo "building TiDB..."
rm -rf $GOPATH/src/github.com/pingcap/tidb
git clone --depth=1 https://github.com/pingcap/tidb.git $GOPATH/src/github.com/pingcap/tidb
cd $GOPATH/src/github.com/pingcap/tidb
make
cp -f ./bin/tidb-server $TIDB_PATH/bin
cd $TIDB_PATH
echo "TiDB is built"
# Build PD
echo "building PD..."
rm -rf $GOPATH/src/github.com/pingcap/pd
git clone --depth=1 https://github.com/pingcap/pd.git $GOPATH/src/github.com/pingcap/pd
cd $GOPATH/src/github.com/pingcap/pd
make
cp -f ./bin/pd-server $TIDB_PATH/bin
cd $TIDB_PATH
echo "PD is built"
# Build TiKV
echo "building TiKV..."
rm -rf $TIDB_PATH/deps/tikv
git clone --depth=1 https://github.com/pingcap/tikv.git $TIDB_PATH/deps/tikv
cd $TIDB_PATH/deps/tikv
make release
cp -f ./bin/tikv-server $TIDB_PATH/bin
cd $TIDB_PATH
echo "TiKV is built"