Browse Source

make faster on multi-core servers

kaneawk 8 years ago
parent
commit
9fdfc8501b

+ 2 - 2
include/GraphicsMagick.sh

@@ -15,7 +15,7 @@ src_url=http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/$
 tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz
 cd GraphicsMagick-$GraphicsMagick_version
 ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf GraphicsMagick-$GraphicsMagick_version
 cd ..
@@ -37,7 +37,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then
     export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
     $php_install_dir/bin/phpize
     ./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick
-    make && make install
+    make -j ${THREAD} && make install
     cd ..
     rm -rf gmagick-$gmagick_version
 

+ 2 - 2
include/ImageMagick.sh

@@ -15,7 +15,7 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/ImageMagick-$ImageMagick_vers
 tar xzf ImageMagick-$ImageMagick_version.tar.gz
 cd ImageMagick-$ImageMagick_version
 ./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf ImageMagick-$ImageMagick_version
 cd ..
@@ -37,7 +37,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then
     export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
     $php_install_dir/bin/phpize
     ./configure --with-php-config=$php_install_dir/bin/php-config --with-imagick=/usr/local/imagemagick
-    make && make install
+    make -j ${THREAD} && make install
     cd ..
     rm -rf imagick-$imagick_version
 

+ 1 - 1
include/apache-2.2.sh

@@ -20,7 +20,7 @@ cd httpd-$apache_2_version
 [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir
 [ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker
 ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir
-make && make install
+make -j ${THREAD} && make install
 if [ -e "$apache_install_dir/conf/httpd.conf" ];then
     echo "${CSUCCESS}Apache install successfully! ${CEND}"
     cd ..

+ 2 - 2
include/apache-2.4.sh

@@ -18,7 +18,7 @@ src_url=http://mirrors.linuxeye.com/apache/httpd/httpd-$apache_4_version.tar.gz
 tar xzf pcre-$pcre_version.tar.gz
 cd pcre-$pcre_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 
 id -u $run_user >/dev/null 2>&1
@@ -33,7 +33,7 @@ cd httpd-$apache_4_version
 /bin/cp -R ../apr-util-$apr_util_version ./srclib/apr-util
 [ "$ZendGuardLoader_yn" == 'y' -o "$ionCube_yn" == 'y' ] && MPM=prefork || MPM=worker
 ./configure --prefix=$apache_install_dir --enable-headers --enable-deflate --enable-mime-magic --enable-so --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --disable-userdir --with-included-apr --with-mpm=$MPM --disable-userdir
-make && make install
+make -j ${THREAD} && make install
 if [ -e "$apache_install_dir/conf/httpd.conf" ];then
     echo "${CSUCCESS}Apache install successfully! ${CEND}"
     cd ..

+ 1 - 1
include/apcu.sh

@@ -17,7 +17,7 @@ cd apcu-$apcu_version
 make clean
 $php_install_dir/bin/phpize
 ./configure --with-php-config=$php_install_dir/bin/php-config
-make && make install
+make -j ${THREAD} && make install
 if [ -f "`$php_install_dir/bin/php-config --extension-dir`/apcu.so" ];then
     cat > $php_install_dir/etc/php.d/ext-apcu.ini << EOF
 [apcu]

+ 3 - 0
include/check_os.sh

@@ -39,3 +39,6 @@ else
     SYS_BIG_FLAG=i586
     SYS_BIT_a=x86;SYS_BIT_b=i686;
 fi
+
+CPU=$(grep 'processor' /proc/cpuinfo | sort -u | wc -l)
+let THREAD=${CPU}*2

+ 1 - 1
include/eaccelerator-0.9.sh

@@ -17,7 +17,7 @@ cd eaccelerator-0.9.6.1
 make clean
 $php_install_dir/bin/phpize
 ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config
-make && make install
+make -j ${THREAD} && make install
 
 if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then
     mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache

+ 1 - 1
include/eaccelerator-1.0-dev.sh

@@ -18,7 +18,7 @@ cd eaccelerator-eaccelerator-42067ac
 make clean
 $php_install_dir/bin/phpize
 ./configure --enable-eaccelerator=shared --with-php-config=$php_install_dir/bin/php-config
-make && make install
+make -j ${THREAD} && make install
 if [ -f "`$php_install_dir/bin/php-config --extension-dir`/eaccelerator.so" ];then
     mkdir /var/eaccelerator_cache;chown -R ${run_user}.$run_user /var/eaccelerator_cache
     cat > $php_install_dir/etc/php.d/ext-eaccelerator.ini << EOF

+ 1 - 1
include/get_ipaddr_state.py

@@ -3,7 +3,7 @@
 try:
     import sys,urllib2,socket
     socket.setdefaulttimeout(10)
-    apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1] 
+    apiurl = "http://ip.taobao.com/service/getIpInfo.php?ip=%s" % sys.argv[1]
     content = urllib2.urlopen(apiurl).read()
     data = eval(content)['data']
     code = eval(content)['code']

+ 3 - 3
include/init_CentOS.sh

@@ -184,13 +184,13 @@ if [ ! -e "`which tmux`" ];then
     tar xzf libevent-2.0.22-stable.tar.gz
     cd libevent-2.0.22-stable
     ./configure
-    make && make install
+    make -j ${THREAD} && make install
     cd ..
 
     tar xzf tmux-2.2.tar.gz
     cd tmux-2.2
     CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure
-    make && make install
+    make -j ${THREAD} && make install
     cd ../../
 
     if [ "$OS_BIT" == '64' ];then
@@ -207,7 +207,7 @@ if [ ! -e "`which htop`" ];then
     tar xzf htop-2.0.0.tar.gz
     cd htop-2.0.0
     ./configure
-    make && make install
+    make -j ${THREAD} && make install
     cd ../../
 fi
 . /etc/profile

+ 1 - 1
include/init_Ubuntu.sh

@@ -33,7 +33,7 @@ if [[ "$Ubuntu_version" =~ ^14$|^15$ ]];then
     tar xzf bison-2.7.1.tar.gz
     cd bison-2.7.1
     ./configure
-    make && make install
+    make -j ${THREAD} && make install
     cd ..
     rm -rf bison-2.7.1
     cd ..

+ 1 - 1
include/jemalloc.sh

@@ -15,7 +15,7 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/jemalloc-$jemalloc_version.ta
 tar xjf jemalloc-$jemalloc_version.tar.bz2
 cd jemalloc-$jemalloc_version
 LDFLAGS="${LDFLAGS} -lrt" ./configure
-make && make install
+make -j ${THREAD} && make install
 if [ -f "/usr/local/lib/libjemalloc.so" ];then
     if [ "$OS_BIT" == '64' -a "$OS" == 'CentOS' ];then
         ln -s /usr/local/lib/libjemalloc.so.2 /usr/lib64/libjemalloc.so.1

+ 4 - 4
include/memcached.sh

@@ -20,7 +20,7 @@ tar xzf memcached-$memcached_version.tar.gz
 cd memcached-$memcached_version
 [ ! -d "$memcached_install_dir" ] && mkdir -p $memcached_install_dir
 ./configure --prefix=$memcached_install_dir
-make && make install
+make -j ${THREAD} && make install
 if [ -d "$memcached_install_dir/include/memcached" ];then
     echo "${CSUCCESS}memcached install successfully! ${CEND}"
     cd ..
@@ -58,7 +58,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then
     make clean
     $php_install_dir/bin/phpize
     ./configure --with-php-config=$php_install_dir/bin/php-config
-    make && make install
+    make -j ${THREAD} && make install
     if [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcache.so" ];then
         cat > $php_install_dir/etc/php.d/ext-memcache.ini << EOF
 extension=memcache.so
@@ -84,7 +84,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then
     [ "$OS" == 'CentOS' ] && yum -y install cyrus-sasl-devel
     [[ $OS =~ ^Ubuntu$|^Debian$ ]] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure
     ./configure --with-memcached=$memcached_install_dir
-    make && make install
+    make -j ${THREAD} && make install
     cd ..
     rm -rf libmemcached-$libmemcached_version
 
@@ -102,7 +102,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then
     make clean
     $php_install_dir/bin/phpize
     ./configure --with-php-config=$php_install_dir/bin/php-config
-    make && make install
+    make -j ${THREAD} && make install
     if [ -f "`$php_install_dir/bin/php-config --extension-dir`/memcached.so" ];then
         cat > $php_install_dir/etc/php.d/ext-memcached.ini << EOF
 extension=memcached.so

+ 1 - 1
include/nginx.sh

@@ -37,7 +37,7 @@ fi
 
 [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir
 ./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
-make && make install
+make -j ${THREAD} && make install
 if [ -e "$nginx_install_dir/conf/nginx.conf" ];then
     cd ..
     rm -rf nginx-$nginx_version

+ 1 - 1
include/openresty.sh

@@ -34,7 +34,7 @@ fi
 
 [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir
 ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
-make && make install
+make -j ${THREAD} && make install
 if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then
     cd ..
     rm -rf openresty-$openresty_version

+ 1 - 1
include/percona-5.5.sh

@@ -40,7 +40,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \
 -DDEFAULT_CHARSET=utf8mb4 \
 -DDEFAULT_COLLATION=utf8mb4_general_ci \
 $EXE_LINKER
-make -j `grep processor /proc/cpuinfo | wc -l`
+make -j ${THREAD}
 make install
 
 if [ -d "$percona_install_dir/support-files" ];then

+ 1 - 1
include/percona-5.6.sh

@@ -39,7 +39,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \
 -DDEFAULT_CHARSET=utf8mb4 \
 -DDEFAULT_COLLATION=utf8mb4_general_ci \
 $EXE_LINKER
-make -j `grep processor /proc/cpuinfo | wc -l`
+make -j ${THREAD}
 make install
 
 if [ -d "$percona_install_dir/support-files" ];then

+ 1 - 1
include/percona-5.7.sh

@@ -54,7 +54,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=$percona_install_dir \
 -DDEFAULT_CHARSET=utf8mb4 \
 -DDEFAULT_COLLATION=utf8mb4_general_ci \
 $EXE_LINKER
-make -j `grep processor /proc/cpuinfo | wc -l`
+make -j ${THREAD}
 make install
 
 if [ -d "$percona_install_dir/support-files" ];then

+ 7 - 7
include/php-5.3.sh

@@ -24,25 +24,25 @@ tar xzf libiconv-$libiconv_version.tar.gz
 patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch
 cd libiconv-$libiconv_version
 ./configure --prefix=/usr/local
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf libiconv-$libiconv_version
 
 tar xzf libmcrypt-$libmcrypt_version.tar.gz
 cd libmcrypt-$libmcrypt_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 ldconfig
 cd libltdl
 ./configure --enable-ltdl-install
-make && make install
+make -j ${THREAD} && make install
 cd ../../
 rm -rf libmcrypt-$libmcrypt_version
 
 tar xzf mhash-$mhash_version.tar.gz
 cd mhash-$mhash_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mhash-$mhash_version
 
@@ -56,7 +56,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz
 cd mcrypt-$mcrypt_version
 ldconfig
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mcrypt-$mcrypt_version
 
@@ -72,7 +72,7 @@ if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then
         tar xzf openssl-1.0.0s.tar.gz
         cd openssl-1.0.0s
         ./config --prefix=/usr/local/openssl -fPIC shared zlib
-        make && make install
+        make -j ${THREAD} && make install
         cd ..
         [ -e '/usr/local/openssl/lib/libcrypto.a' ] && { OpenSSL_args='--with-openssl=/usr/local/openssl'; rm -rf openssl-1.0.0s; } || OpenSSL_args='--with-openssl'
     fi
@@ -84,7 +84,7 @@ if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ];then
             tar xzf curl-7.29.0.tar.gz
             cd curl-7.29.0
             LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl
-            make && make install
+            make -j ${THREAD} && make install
             cd ..
             [ -e '/usr/local/curl/lib/libcurl.a' ] && { Curl_args='--with-curl=/usr/local/curl'; rm -rf curl-7.29.0; } || Curl_args='--with-curl'
         fi

+ 5 - 5
include/php-5.4.sh

@@ -22,25 +22,25 @@ tar xzf libiconv-$libiconv_version.tar.gz
 patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch
 cd libiconv-$libiconv_version
 ./configure --prefix=/usr/local
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf libiconv-$libiconv_version
 
 tar xzf libmcrypt-$libmcrypt_version.tar.gz
 cd libmcrypt-$libmcrypt_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 ldconfig
 cd libltdl
 ./configure --enable-ltdl-install
-make && make install
+make -j ${THREAD} && make install
 cd ../../
 rm -rf libmcrypt-$libmcrypt_version
 
 tar xzf mhash-$mhash_version.tar.gz
 cd mhash-$mhash_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mhash-$mhash_version
 
@@ -52,7 +52,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz
 cd mcrypt-$mcrypt_version
 ldconfig
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mcrypt-$mcrypt_version
 

+ 5 - 5
include/php-5.5.sh

@@ -22,25 +22,25 @@ tar xzf libiconv-$libiconv_version.tar.gz
 patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch
 cd libiconv-$libiconv_version
 ./configure --prefix=/usr/local
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf libiconv-$libiconv_version
 
 tar xzf libmcrypt-$libmcrypt_version.tar.gz
 cd libmcrypt-$libmcrypt_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 ldconfig
 cd libltdl
 ./configure --enable-ltdl-install
-make && make install
+make -j ${THREAD} && make install
 cd ../../
 rm -rf libmcrypt-$libmcrypt_version
 
 tar xzf mhash-$mhash_version.tar.gz
 cd mhash-$mhash_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mhash-$mhash_version
 
@@ -52,7 +52,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz
 cd mcrypt-$mcrypt_version
 ldconfig
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mcrypt-$mcrypt_version
 

+ 5 - 5
include/php-5.6.sh

@@ -21,25 +21,25 @@ tar xzf libiconv-$libiconv_version.tar.gz
 patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch
 cd libiconv-$libiconv_version
 ./configure --prefix=/usr/local
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf libiconv-$libiconv_version
 
 tar xzf libmcrypt-$libmcrypt_version.tar.gz
 cd libmcrypt-$libmcrypt_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 ldconfig
 cd libltdl
 ./configure --enable-ltdl-install
-make && make install
+make -j ${THREAD} && make install
 cd ../../
 rm -rf libmcrypt-$libmcrypt_version
 
 tar xzf mhash-$mhash_version.tar.gz
 cd mhash-$mhash_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mhash-$mhash_version
 
@@ -51,7 +51,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz
 cd mcrypt-$mcrypt_version
 ldconfig
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mcrypt-$mcrypt_version
 

+ 5 - 5
include/php-7.sh

@@ -21,25 +21,25 @@ tar xzf libiconv-$libiconv_version.tar.gz
 patch -d libiconv-$libiconv_version -p0 < libiconv-glibc-2.16.patch
 cd libiconv-$libiconv_version
 ./configure --prefix=/usr/local
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf libiconv-$libiconv_version
 
 tar xzf libmcrypt-$libmcrypt_version.tar.gz
 cd libmcrypt-$libmcrypt_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 ldconfig
 cd libltdl
 ./configure --enable-ltdl-install
-make && make install
+make -j ${THREAD} && make install
 cd ../../
 rm -rf libmcrypt-$libmcrypt_version
 
 tar xzf mhash-$mhash_version.tar.gz
 cd mhash-$mhash_version
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mhash-$mhash_version
 
@@ -51,7 +51,7 @@ tar xzf mcrypt-$mcrypt_version.tar.gz
 cd mcrypt-$mcrypt_version
 ldconfig
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 rm -rf mcrypt-$mcrypt_version
 

+ 1 - 1
include/pureftpd.sh

@@ -20,7 +20,7 @@ id -u $run_user >/dev/null 2>&1
 cd pure-ftpd-$pureftpd_version
 [ ! -d "$pureftpd_install_dir" ] && mkdir -p $pureftpd_install_dir
 ./configure --prefix=$pureftpd_install_dir CFLAGS=-O2 --with-puredb --with-quotas --with-cookie --with-virtualhosts --with-virtualchroot --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg  --with-throttling --with-uploadscript --with-language=english --with-rfc2640
-make && make install
+make -j ${THREAD} && make install
 if [ -e "$pureftpd_install_dir/sbin/pure-ftpwho" ];then
     echo "${CSUCCESS}Pure-Ftp install successfully! ${CEND}"
     [ ! -e "$pureftpd_install_dir/etc" ] && mkdir $pureftpd_install_dir/etc

+ 2 - 2
include/redis.sh

@@ -19,7 +19,7 @@ if [ "$OS_BIT" == '32' ];then
     sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings
 fi
 
-make
+make -j ${THREAD}
 
 if [ -f "src/redis-server" ];then
     mkdir -p $redis_install_dir/{bin,etc,var}
@@ -67,7 +67,7 @@ if [ -e "$php_install_dir/bin/phpize" ];then
     make clean
     $php_install_dir/bin/phpize
     ./configure --with-php-config=$php_install_dir/bin/php-config
-    make && make install
+    make -j ${THREAD} && make install
     if [ -f "`$php_install_dir/bin/php-config --extension-dir`/redis.so" ];then
         cat > $php_install_dir/etc/php.d/ext-redis.ini << EOF
 [redis]

+ 1 - 1
include/tcmalloc.sh

@@ -15,7 +15,7 @@ src_url=http://mirrors.linuxeye.com/oneinstack/src/gperftools-$tcmalloc_version.
 tar xzf gperftools-$tcmalloc_version.tar.gz
 cd gperftools-$tcmalloc_version
 ./configure --enable-frame-pointers
-make && make install
+make -j ${THREAD} && make install
 
 if [ -f "/usr/local/lib/libtcmalloc.so" ];then
     echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf

+ 1 - 1
include/tengine.sh

@@ -35,7 +35,7 @@ fi
 
 [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir
 ./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
-make && make install
+make -j ${THREAD} && make install
 if [ -e "$tengine_install_dir/conf/nginx.conf" ];then
     cd ..
     rm -rf tengine-$tengine_version

+ 1 - 1
include/tomcat-7.sh

@@ -41,7 +41,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then
     cd tomcat-native-*-src/jni/native/
     rm -rf /usr/local/apr
     ./configure --with-apr=/usr/bin/apr-1-config
-    make && make install
+    make -j ${THREAD} && make install
     if [ -d "/usr/local/apr/lib" ];then
         [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256
         cat > $tomcat_install_dir/bin/setenv.sh << EOF

+ 1 - 1
include/tomcat-8.sh

@@ -41,7 +41,7 @@ if [ -e "$tomcat_install_dir/conf/server.xml" ];then
     cd tomcat-native-*-src/jni/native/
     rm -rf /usr/local/apr
     ./configure --with-apr=/usr/bin/apr-1-config
-    make && make install
+    make -j ${THREAD} && make install
     if [ -d "/usr/local/apr/lib" ];then
         [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256
         cat > $tomcat_install_dir/bin/setenv.sh << EOF

+ 1 - 1
include/upgrade_db.sh

@@ -150,7 +150,7 @@ $EXE_LINKER
 -DDEFAULT_COLLATION=utf8mb4_general_ci \
 $EXE_LINKER
         fi
-        make -j `grep processor /proc/cpuinfo | wc -l`
+        make -j ${THREAD}
         service mysqld stop
         mv ${percona_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
         mv ${percona_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}

+ 1 - 1
include/upgrade_redis.sh

@@ -42,7 +42,7 @@ if [ -e "redis-$NEW_Redis_version.tar.gz" ];then
         sed -i 's@^OPT=.*@OPT=-O2 -march=i686@' src/.make-settings
     fi
 
-    make
+    make -j ${THREAD}
 
     if [ -f "src/redis-server" ];then
         echo "Restarting Redis..."

+ 3 - 3
include/upgrade_web.sh

@@ -46,7 +46,7 @@ if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then
     nginx_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'`
     rm -rf $$
     ./configure $nginx_configure_arguments
-    make
+    make -j ${THREAD}
     if [ -f "objs/nginx" ];then
         /bin/mv $nginx_install_dir/sbin/nginx $nginx_install_dir/sbin/nginx$(date +%m%d)
         /bin/cp objs/nginx $nginx_install_dir/sbin/nginx
@@ -100,7 +100,7 @@ if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then
     tengine_configure_arguments=`cat $$ | grep 'configure arguments:' | awk -F: '{print $2}'`
     rm -rf $$
     ./configure $tengine_configure_arguments
-    make
+    make -j ${THREAD}
     if [ -f "objs/nginx" ];then
         /bin/mv $tengine_install_dir/sbin/nginx $tengine_install_dir/sbin/nginx$(date +%m%d)
         /bin/mv $tengine_install_dir/sbin/dso_tool $tengine_install_dir/sbin/dso_tool$(date +%m%d)
@@ -162,7 +162,7 @@ if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then
     [ -n "`echo $openresty_configure_arguments | grep jemalloc`"] && malloc_module="--with-ld-opt='-ljemalloc'"
     [ -n "`echo $openresty_configure_arguments | grep perftools`" ] && malloc_module='--with-google_perftools_module'
     ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
-    make
+    make -j ${THREAD}
     if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ];then
         /bin/mv $openresty_install_dir/nginx/sbin/nginx $openresty_install_dir/nginx/sbin/nginx$(date +%m%d)
         make install

+ 1 - 1
include/xcache.sh

@@ -18,7 +18,7 @@ cd xcache-$xcache_version
 make clean
 $php_install_dir/bin/phpize
 ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=$php_install_dir/bin/php-config
-make && make install
+make -j ${THREAD} && make install
 if [ -f "`$php_install_dir/bin/php-config --extension-dir`/xcache.so" ];then
     /bin/cp -R htdocs $wwwroot_dir/default/xcache
     chown -R ${run_user}.$run_user $wwwroot_dir/default/xcache

+ 1 - 1
include/zendopcache.sh

@@ -18,7 +18,7 @@ cd zendopcache-$zendopcache_version
 make clean
 $php_install_dir/bin/phpize
 ./configure --with-php-config=$php_install_dir/bin/php-config
-make && make install
+make -j ${THREAD} && make install
 if [ -f "`$php_install_dir/bin/php-config --extension-dir`/opcache.so" ];then
     cat > $php_install_dir/etc/php.d/ext-opcache.ini << EOF
 [opcache]

+ 1 - 1
shadowsocks.sh

@@ -151,7 +151,7 @@ Install_shadowsocks-libev() {
 git clone https://github.com/shadowsocks/shadowsocks-libev.git
 cd shadowsocks-libev
 ./configure
-make && make install
+make -j ${THREAD} && make install
 cd ..
 if [ -f  /usr/local/bin/ss-server ];then
     /bin/cp ../init.d/Shadowsocks-libev-init /etc/init.d/shadowsocks