-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild_travis.sh
executable file
·66 lines (60 loc) · 1.54 KB
/
build_travis.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
# Detect OS
if test -z "$TARGET_OS"; then
TARGET_OS=`uname -s`
fi
if [ "$TARGET_OS" = "Darwin" ]; then
INSTALL_PATH=/usr/local
else
INSTALL_PATH=/usr
fi
CXX=g++
CXXFLAGS="-std=c++11 -pthread -I/usr/local/include -I/usr/include"
CXXOUTPUT="/tmp/skywalker_build_detect_platform-cxx.$$"
# Test whether Protobuf library is installed
$CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT 2>/dev/null <<EOF
#include <google/protobuf/arena.h>
int main() {}
EOF
if [ "$?" != 0 ]; then
wget https://github.com/google/protobuf/archive/v3.5.1.tar.gz
tar zxvf v3.5.1.tar.gz
cd protobuf-3.5.1
./autogen.sh
./configure --prefix=$INSTALL_PATH
make
sudo make install
cd ..
rm -rf protobuf-3.5.1
rm -rf v3.5.1.tar.gz
fi
$CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT 2>/dev/null <<EOF
#include <leveldb/db.h>
int main() {}
EOF
if [ "$?" != 0 ]; then
wget https://github.com/google/leveldb/archive/v1.20.tar.gz
tar zxvf v1.20.tar.gz
cd leveldb-1.20
make
sudo cp -rf out-shared/libleveldb.* $INSTALL_PATH/lib
sudo cp -rf include/leveldb $INSTALL_PATH/include
cd ..
rm -rf leveldb-1.20
rm -rf v1.20.tar.gz
fi
$CXX $CXXFLAGS -x c++ -o $CXXOUTPUT 2>/dev/null <<EOF
#include <voyager/rpc/rpc_server.h>
int main() { }
EOF
if [ "$?" != 0 ]; then
git clone https://github.com/QiumingLu/voyager.git
cd voyager
cmake -DCMAKE_BUILD_TYPE=release \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH \
.
make
sudo make install
cd ..
rm -rf voyager
fi
rm -f $CXXOUTPUT