Skip to content

Commit

Permalink
use git submodule for build
Browse files Browse the repository at this point in the history
  • Loading branch information
wodesuck committed Nov 16, 2016
1 parent 644e813 commit 0ccf57a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 134 deletions.
128 changes: 7 additions & 121 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,137 +1,23 @@
#!/bin/bash

set -e # exit immediately on error
set -x # display all commands

cd third_party;
git submodule update --init --recursive

if [ ! -f protobuf/bin/protoc ]; then
if [ ! -f protobuf-cpp-3.0.0.tar.gz ]; then
wget https://github.com/google/protobuf/releases/download/v3.0.0/protobuf-cpp-3.0.0.tar.gz
fi

tar zxvf protobuf-cpp-3.0.0.tar.gz
cd protobuf-3.0.0

./configure CXXFLAGS=-fPIC --prefix=`pwd`/../protobuf
make -j2
make install

cd ../
fi

if [ ! -f glog/lib/libglog.a ]; then
if [ ! -f v0.3.3.tar.gz ]; then
wget https://github.com/google/glog/archive/v0.3.3.tar.gz
fi

tar zxvf v0.3.3.tar.gz
cd glog-0.3.3

./configure CXXFLAGS=-fPIC --prefix=`pwd`/../glog
make -j2
make install

cd ../
fi

if [ ! -f leveldb/lib/libleveldb.a ]; then
if [ ! -f v1.19.tar.gz ]; then
wget https://github.com/google/leveldb/archive/v1.19.tar.gz
fi

rm -rf leveldb

tar zxvf v1.19.tar.gz
ln -s leveldb-1.19 leveldb
cd leveldb

make

mkdir -p lib
cp out-static/libleveldb.a lib/

cd ../
fi

if [ ! -f colib/lib/libcolib.a ]; then
if [ ! -f colib-master.zip ]; then
wget https://github.com/tencent-wechat/libco/archive/master.zip -O colib-master.zip
fi

rm -rf colib

unzip colib-master.zip
ln -s libco-master colib

cd colib
make

cd ../
fi

if [ ! -f phxpaxos/lib/libphxpaxos.a ]; then
if [ ! -f v1.1.1.tar.gz ]; then
wget https://github.com/tencent-wechat/phxpaxos/archive/v1.1.1.tar.gz
fi

rm -rf phxpaxos

tar zxvf v1.1.1.tar.gz
ln -s phxpaxos-1.1.1 phxpaxos

cd phxpaxos/third_party
rm -rf glog gmock leveldb protobuf
ln -s ../../glog-0.3.3 glog
ln -s ../../protobuf-3.0.0/gmock gmock
ln -s ../../leveldb leveldb
ln -s ../../protobuf protobuf
cd ../

./autoinstall.sh

make
make install

cd plugin
make
make install

cd ../../
fi

if [ ! -f phxrpc/lib/libphxrpc.a ]; then
if [ ! -f phxrpc-master.zip ]; then
wget https://github.com/tencent-wechat/phxrpc/archive/master.zip -O phxrpc-master.zip
fi

rm -rf phxrpc

unzip phxrpc-master.zip
ln -s phxrpc-master phxrpc

cd phxrpc
rm third_party -rf
ln -s ../../third_party third_party

make

cd ../
fi

cd ..
(cd third_party && ./autoinstall.sh)

if [ ! -f percona/sql/binlog.cc ]; then
wget https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.31-77.0/source/tarball/percona-server-5.6.31-77.0.tar.gz
wget https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.31-77.0/source/tarball/percona-server-5.6.31-77.0.tar.gz

rm percona -rf
rm percona -rf

tar -xvf percona-server-5.6.31-77.0.tar.gz
mv percona-server-5.6.31-77.0 percona
tar -xvf percona-server-5.6.31-77.0.tar.gz
mv percona-server-5.6.31-77.0 percona
fi

./autoinstall.sh

make

make install

20 changes: 9 additions & 11 deletions third_party/autoinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function check_dir_exist()
dir_path=$current_path"/$1";
if [ ! -d $dir_path ]; then
perror $dir_path" dir not exist.";
exit;
exit 1;
fi
}

Expand Down Expand Up @@ -73,7 +73,7 @@ function install_leveldb()
check_lib_exist $lib_name;
if [ $? -eq 1 ]; then
perror "$lib_name install fail. please check compile error info."
exit;
exit 1;
fi

psucc "install $lib_name ok."
Expand Down Expand Up @@ -125,7 +125,7 @@ function install_protobuf()
check_protobuf_installed $lib_name;
if [ $? -eq 1 ]; then
perror "$lib_name install fail. please check compile error info."
exit;
exit 1;
fi
psucc "install $lib_name ok."
}
Expand All @@ -151,7 +151,7 @@ function install_glog()
check_lib_exist $lib_name;
if [ $? -eq 1 ]; then
perror "$lib_name install fail. please check compile error info."
exit;
exit 1;
fi
psucc "install $lib_name ok."
}
Expand All @@ -176,7 +176,7 @@ function install_colib()
check_lib_exist $lib_name;
if [ $? -eq 1 ]; then
perror "$lib_name install fail. please check compile error info."
exit;
exit 1;
fi
psucc "install $lib_name ok."
}
Expand Down Expand Up @@ -224,7 +224,7 @@ function install_phxpaxos()
check_phxpaxos_installed $lib_name;
if [ $? -eq 1 ]; then
perror "$lib_name install fail. please check compile error info."
exit;
exit 1;
fi

psucc "install $lib_name ok."
Expand All @@ -245,16 +245,14 @@ function install_phxrpc()

go_back;
cd $lib_name;
cd third_party;
rm -rf protobuf;
ln -s ../../protobuf protobuf;
cd ..;
rm -rf third_party;
ln -s .. third_party;
make;

check_lib_exist $lib_name;
if [ $? -eq 1 ]; then
perror "$lib_name install fail. please check compile error info."
exit;
exit 1;
fi
psucc "install $lib_name ok."
}
Expand Down
2 changes: 1 addition & 1 deletion third_party/colib
Submodule colib updated 1 files
+12 −0 co_hook_sys_call.cpp

0 comments on commit 0ccf57a

Please sign in to comment.