-
Notifications
You must be signed in to change notification settings - Fork 4
/
prepare-build.sh
executable file
·90 lines (76 loc) · 2.87 KB
/
prepare-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
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
#########################################################################
echo "Step 1. Installing prerequisites..."
#########################################################################
# Install bzip2, zlib, and unzip. In CentOS, build.sh runs following commands.
# sudo yum install zlib-devel bzip2-devel unzip
# In Ubuntu, build.sh runs following commands.
# sudo apt-get install libz-dev libbz2-dev unzip
#########################################################################
if [ `lsb_release -a | grep CentOS | wc -l` -gt 0 ]
then
USE_YUM=1
fi
if [ `lsb_release -a | grep "Red Hat Enterprise Linux" | wc -l` -gt 0 ]
then
USE_YUM=1
fi
if [ `lsb_release -a | grep "Ubuntu" | wc -l` -gt 0 ]
then
USE_APT=1
fi
if [ "$USE_YUM" = "1" ]
then
echo "Using yum to install prerequisites."
sudo yum install zlib-devel bzip2-devel unzip
fi
if [ "$USE_APT" = "1" ]
then
echo "Using aptitude to install prerequisites."
sudo apt-get install libz-dev libbz2-dev unzip
fi
#########################################################################
echo "Step 2. Check gcc version ... (needs 4.6.x) ..."
#########################################################################
# Nanolat Database requires gcc 4.6 to build it.
# gcc --version
#
# If the version of gcc is not 4.6.x, build gcc 4.6 by running following commands.
# git clone https://github.com/ThankyouSoft/gcc46.git
# cd gcc46
# ./build.sh
#
# Use the gcc 4.6 built in the previous step.
# This is required for each time you compile nldb project.
# cd gcc46
# source ./use-gcc46.sh
#########################################################################
if [ `gcc --version | grep "4\.6\." | wc -l` = "1" ]
then
echo "gcc version is 4.6.x. Will use the installed gcc."
elif [ `gcc --version | grep "4\.7\." | wc -l` = "1" ]
then
echo "gcc version is 4.7.x. Will use the installed gcc."
else
echo "gcc version is not 4.6.x. Will download and install gcc 4.6.3."
git clone https://github.com/ThankyouSoft/gcc46.git
cd gcc46
./build.sh
source use-gcc46.sh
cd ..
fi
#########################################################################
echo "Step 3. Build external libraries ..."
#########################################################################
# Nanolat Database requires following libraries.
# 1. Google test framework for unit tests.
# 2. Crossroads library for sending and receiving transactional logs between the master and slaves.
# 3. TokyoCabinet library for the TokyoCabinet in-memory table plugin.
# 4. Google LevelDB library for the LevelDB on-disk table plugin.
#########################################################################
cd external-libs
./build.sh all
cd ..
#########################################################################
echo "Step 4. Build all projects ..."
#########################################################################
make