diff --git a/install_binaries.sh b/install_binaries.sh index 9ed3bd2..d84f027 100755 --- a/install_binaries.sh +++ b/install_binaries.sh @@ -1,55 +1,111 @@ #!/bin/sh -git clone https://github.com/libssh2/libssh2 +set -e + +# initial repository clones +if [ ! -e libssh2 ]; then + git clone https://github.com/libssh2/libssh2 +fi +if [ ! -e ImageMagick ]; then + git clone https://github.com/ImageMagick/ImageMagick +fi +if [ ! -e nginx ]; then + git clone https://github.com/nginx/nginx +fi +cd nginx +if [ ! -e ngx_brotli ]; then + git clone https://github.com/google/ngx_brotli +fi +if [ ! -e ngx_devel_kit ]; then + git clone https://github.com/vision5/ngx_devel_kit +fi +if [ ! -e luajit2 ]; then + git clone https://github.com/openresty/luajit2 +fi +if [ ! -e lua-resty-core ]; then + git clone https://github.com/openresty/lua-resty-core +fi +if [ ! -e lua-resty-lrucache ]; then + git clone https://github.com/openresty/lua-resty-lrucache +fi +if [ ! -e lua-nginx-module ]; then + git clone https://github.com/openresty/lua-nginx-module +fi +if [ ! -e stream-lua-nginx-module ]; then + git clone https://github.com/openresty/stream-lua-nginx-module +fi +if [ ! -e lua-resty-mysql ]; then + git clone https://github.com/openresty/lua-resty-mysql +fi +if [ ! -e rds-json-nginx-module ]; then + git clone https://github.com/openresty/rds-json-nginx-module +fi +if [ ! -e set-misc-nginx-module ]; then + git clone https://github.com/openresty/set-misc-nginx-module +fi +if [ ! -e libatomic_ops ]; then + git clone https://github.com/ivmai/libatomic_ops/ +fi +cd .. +if [ ! -e php-src ]; then + git clone https://github.com/php/php-src +fi +cd php-src/ext +if [ ! -e apcu ]; then + git clone https://github.com/krakjoe/apcu +fi +if [ ! -e php-ext-brotli ]; then + git clone https://github.com/kjdev/php-ext-brotli +fi +if [ ! -e imagick ]; then + git clone https://github.com/Imagick/imagick +fi +if [ ! -e php-gnupg ]; then + git clone https://github.com/php-gnupg/php-gnupg --recurse-submodules +fi +if [ ! -e php-rar ]; then + git clone https://github.com/cataphract/php-rar +fi +cd ../.. + +export PROC_LIMIT=`free -g | grep Mem | awk -v nproc=$(nproc) '{print (($2 + 1) < nproc) ? ($2 + 1) : nproc;}'` +#start build cd libssh2 git pull autoreconf -fi CFLAGS="-O3 -march=native -mtune=native" ./configure -make -j $(nproc) install +make -j $PROC_LIMIT install cd .. -git clone https://github.com/ImageMagick/ImageMagick cd ImageMagick git pull CXXFLAGS='-O3 -mtune=native -march=native' CFLAGS='-O3 -mtune=native -march=native' ./configure --without-perl --without-magick-plus-plus --with-rsvg=yes -make -j $(nproc) install +make -j $PROC_LIMIT install cd .. ldconfig -git clone https://github.com/nginx/nginx cd nginx git pull -git clone https://github.com/google/ngx_brotli cd ngx_brotli && git pull && cd .. -git clone https://github.com/vision5/ngx_devel_kit cd ngx_devel_kit && git pull && cd .. -git clone https://github.com/openresty/luajit2 cd luajit2 && git pull && cd .. -git clone https://github.com/openresty/lua-resty-core cd lua-resty-core && git pull && cd .. -git clone https://github.com/openresty/lua-resty-lrucache cd lua-resty-lrucache && git pull && cd .. -git clone https://github.com/openresty/lua-nginx-module cd lua-nginx-module && git pull && cd .. -git clone https://github.com/openresty/stream-lua-nginx-module cd stream-lua-nginx-module && git pull && cd .. -git clone https://github.com/openresty/lua-resty-mysql cd lua-resty-mysql && git pull && cd .. -git clone https://github.com/openresty/rds-json-nginx-module cd rds-json-nginx-module && git pull && cd .. -git clone https://github.com/openresty/set-misc-nginx-module cd set-misc-nginx-module && git pull && cd .. -git clone https://github.com/ivmai/libatomic_ops/ cd libatomic_ops git pull ./autogen.sh ln -sf .libs/libatomic_ops.a src/libatomic_ops.a cd .. cd luajit2 -XCFLAGS="-O3 -march=native -mtune=native" make -j $(nproc) install +XCFLAGS="-O3 -march=native -mtune=native" make -j $PROC_LIMIT install cd ../lua-resty-core -make -j $(nproc) install +make -j $PROC_LIMIT install cd ../lua-resty-lrucache -make -j $(nproc) install +make -j $PROC_LIMIT install cd ../lua-resty-mysql -make -j $(nproc) install +make -j $PROC_LIMIT install cd .. # apply dynamic TLS record and HTTP2 HPACK patch by CloudFlare cat <