forked from Percona-QA/percona-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_tokumx.sh
executable file
·144 lines (122 loc) · 5.01 KB
/
build_tokumx.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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
WORK_DIR=/tmp/tokumx_debug_build # Default: /tmp/tokumx_debug_build
MX_BRANCH=tokumx-2.4.0 # For example, tokumx-1.0.0-rc.5
BUILD_TYPE=2 # 1: Release build | 2: Debug build | 3: Valrind build (includes Debug)
echoit(){ echo " [$(date +'%T')] $1"; }
echoitn(){ echo -n " [$(date +'%T')] $1"; }
echoitf(){ echo " $1"; }
#SCRIPT_PWD=$(cd `dirname $0` && pwd)
THREADS=$(grep -c processor /proc/cpuinfo)
echoitn "Checking prerequisites..."
# ==========================================================
if ! which git 1>/dev/null 2>&1; then
echoitf "Failed!"
echoit "Assert: git ($ sudo yum install git) required, but not present. Exiting"
exit 1
fi
#if ! which scons 1>/dev/null 2>&1; then
# echoitf "Failed!"
# echoit "Assert: scons ($ sudo yum install scons) required, but not present. Exiting"
# exit 1
#fi
if ! which cmake 1>/dev/null 2>&1; then
echoitf "Failed!"
echoit "Assert: cmake ($ sudo yum install cmake) required (version 2.8.10 or higher), but not present. Exiting"
exit 1
else
CMAKE_VERSION=$(cmake --version 2>/dev/null | grep -o "[2-9]\.[8-9]\.[1-9][0-9]") # The [8-9]\.[1-9] needs to become [0-9]\.[0-9] on a major release
if [ "${CMAKE_VERSION}" == "" ]; then
echoitf "Failed!"
echoit "Assert: cmake 2.8.10 or higher required, but detected version is ${CMAKE_VERSION}. Exiting"
exit 1
fi
fi
if ! which gcc 1>/dev/null 2>&1; then
echoitf "Failed!"
echoit "Assert: gcc ($ sudo yum install gcc) required (version 4.7 or higher), but not present. Exiting"
exit 1
else
GCC_VERSION=$(gcc --version | grep -o "[4-9]\.[8-9]\.[2-9]" | head -n1)
if [ "${GCC_VERSION}" == "" ]; then
echoitf "Failed!"
echoit "Assert: gcc 4.7 or higher required, but detected version is ${GCC_VERSION}. Exiting"
exit 1
fi
fi
if ! which g++ 1>/dev/null 2>&1; then
echoitf "Failed!"
echoit "Assert: g++ ($ sudo yum install gcc) required (version 4.7 or higher), but not present. Exiting"
exit 1
else
GPP_VERSION=$(g++ --version | grep -o "[4-9]\.[8-9]\.[2-9]" | head -n1)
if [ "${GPP_VERSION}" == "" ]; then
echoitf "Failed!"
echoit "Assert: g++ 4.7 or higher required, but detected version is ${GPP_VERSION}. Exiting"
exit 1
fi
fi
if [ "$(yum list installed | grep -o "zlib-devel" | head -n1)" != "zlib-devel" ]; then
echoitf "Failed!"
echoit "Assert: zlib-devel ($ sudo yum install zlib-devel) required, but not present. Exiting"
exit 1
fi
echoitf "Done!" # Prerequisites done
echoitn "[Re-]creating temporary working directories..."
# ==========================================================
rm -Rf ${WORK_DIR}
mkdir ${WORK_DIR} ${WORK_DIR}/install
cd ${WORK_DIR}
if [ ! -d ${WORK_DIR} ]; then
echoitf "Failed!"
echoit "Assert: failed to create ${WORK_DIR}! Disk fulll or privileges incorrect? Exiting."
exit 1
fi
echoitf "Done! /tmp/tokumx_debug_build"
echoit "Cloning git project mongo working directory..."
# ==========================================================
git clone https://github.com/Tokutek/mongo
echoitf "Tree: mongo - Done!"
echoit "Cloning git project ft-index into working directory..."
# ==========================================================
git clone https://github.com/Tokutek/ft-index
echoitf "Tree: ft-index - Done!"
echoit "Cloning git project jemalloc into working directory..."
# ==========================================================
git clone https://github.com/Tokutek/jemalloc
echoitf "Tree: jemalloc Done!"
echoit "Cloning git project backup-community into working directory..."
# ==========================================================
git clone https://github.com/Tokutek/backup-community
echoitf "Tree: backup-community Done!"
echoit "Selecting TokuMX branch ${MX_BRANCH} as per settings..."
cd ${WORK_DIR}/mongo
git checkout ${MX_BRANCH}
cd ${WORK_DIR}/ft-index
git checkout ${MX_BRANCH}
cd ${WORK_DIR}/jemalloc
git checkout ${MXSE_BRANCH}
cd ${WORK_DIR}/backup-community
git checkout ${MXSE_BRANCH}
echoitf "Branch selecting: Done!"
echoit "Creating symlinks in src/third_party"
cd ${WORK_DIR}
ln -snf ${WORK_DIR}/jemalloc ft-index/third_party/jemalloc
cd mongo
ln -snf ${WORK_DIR}/ft-index src/third_party/ft-index
ln -snf ${WORK_DIR}/backup-community/backup src/third_party/backup
echoit "Creating build directory.."
mkdir build
cd build
if [ ${BUILD_TYPE} -eq 1 ]; then
CMAKE="-D CMAKE_BUILD_TYPE=Release -D TOKU_DEBUG_PARANOID=OFF -D USE_VALGRIND=OFF -D USE_BDB=OFF -D BUILD_TESTING=OFF -D TOKUMX_DISTNAME=1.4.0"
elif [ ${BUILD_TYPE} -eq 2 ]; then
CMAKE="-D CMAKE_BUILD_TYPE=Debug -D TOKU_DEBUG_PARANOID=ON -D USE_VALGRIND=OFF -D USE_BDB=OFF -D BUILD_TESTING=OFF -D TOKUMX_DISTNAME=1.4.0"
elif [ ${BUILD_TYPE} -eq 3 ]; then
CMAKE="-D CMAKE_BUILD_TYPE=Debug -D TOKU_DEBUG_PARANOID=ON -D USE_VALGRIND=ON -D USE_BDB=OFF -D BUILD_TESTING=OFF -D TOKUMX_DISTNAME=1.4.0"
fi
cmake ${CMAKE} -D CMAKE_INSTALL_PREFIX=${WORK_DIR}/install ..
echoitf "TokuMX: Compile: Done!"
echoitf "TokuMX: building the tarballs.."
echo ${THREADS}
make -j${THREADS} package
echoit "Build process complete! Your build is available in ${PWD}"