Support muti-thread compile in build.sh
Support muti-thread compile in build.sh
diff --git a/build.sh b/build.sh
index 8624bce..8cf85fe 100755
--- a/build.sh
+++ b/build.sh
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
@@ -41,6 +40,7 @@
need_build_libevent=1
need_build_boost=1
test=0
+cpu_num=4
pasres_arguments(){
for var in "$@"
@@ -176,7 +176,7 @@
if [ $? -ne 0 ];then
exit 1
fi
- make
+ make -j $cpu_num
if [ $? -ne 0 ];then
exit 1
fi
@@ -214,7 +214,7 @@
if [ $? -ne 0 ];then
exit 1
fi
- make
+ make -j $cpu_num
if [ $? -ne 0 ];then
exit 1
fi
@@ -225,8 +225,6 @@
echo " ./bin/lib directory is not libjsoncpp.a"
cp ${install_lib_dir}/lib/x86_64-linux-gnu/libjsoncpp.a ${install_lib_dir}/lib/
fi
-
-
}
BuildBoost()
@@ -255,7 +253,7 @@
fi
echo "build boost static #####################"
pwd
- ./b2 cflags=-fPIC cxxflags=-fPIC --with-atomic --with-thread --with-system --with-chrono --with-date_time --with-log --with-regex --with-serialization --with-filesystem --with-locale --with-iostreams threading=multi link=static release install --prefix=${install_lib_dir}
+ ./b2 -j$cpu_num cflags=-fPIC cxxflags=-fPIC --with-atomic --with-thread --with-system --with-chrono --with-date_time --with-log --with-regex --with-serialization --with-filesystem --with-locale --with-iostreams threading=multi link=static release install --prefix=${install_lib_dir}
if [ $? -ne 0 ];then
exit 1
fi
@@ -269,7 +267,7 @@
else
cmake .. -DRUN_UNIT_TEST=ON
fi
- make
+ make -j $cpu_num
if [ $? -ne 0 ];then
exit 1
fi
@@ -307,7 +305,7 @@
if [ $? -ne 0 ];then
exit 1
fi
- make
+ make -j $cpu_num
if [ $? -ne 0 ];then
exit 1
fi
@@ -355,7 +353,6 @@
echo "################## test end ###########"
}
-
PackageRocketMQStatic()
{
#packet libevent,jsoncpp,boost,rocketmq,Signature to one librocketmq.a
@@ -364,7 +361,6 @@
cp -f librocketmq.a ${install_lib_dir}
}
-
PrintParams
Prepare
BuildLibevent