Skip to content

Commit

Permalink
allow manual forced Google Brotli dependency update for ngx_brotli in…
Browse files Browse the repository at this point in the history
… 123.09beta01

- ngx_brotli nginx module https://github.com/eustas/ngx_brotli is built against Google Brotli. However, Google Brotli version used can be outdated. This update allows experimental forced manual update for Google Brotli version for ngx_brotli via persistent config file /etc/centminmod/custom_config.inc set variable NGINX_BROTLIDEP_UPDATE='y' which is disabled by default to allow ngx_brotli to use the intended Google Brotli version. When enabled NGINX_BROTLIDEP_UPDATE='y' prior to centmin.sh menu option 4 nginx update/compiles, it will override the intended Google Brotli version and use latest version available https://github.com/google/brotli/releases. This is not the Google Brotli version intended by ngx_brotli developer/author so use with care and there maybe bugs unforseen.
  • Loading branch information
centminmod committed Dec 31, 2018
1 parent 275ffce commit edf3e32
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
5 changes: 3 additions & 2 deletions centmin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DT=$(date +"%d%m%y-%H%M%S")
branchname='123.09beta01'
SCRIPT_MAJORVER='1.2.3'
SCRIPT_MINORVER='09'
SCRIPT_INCREMENTVER='085'
SCRIPT_INCREMENTVER='086'
SCRIPT_VERSIONSHORT="${branchname}"
SCRIPT_VERSION="${SCRIPT_VERSIONSHORT}.b${SCRIPT_INCREMENTVER}"
SCRIPT_DATE='31/12/2018'
Expand Down Expand Up @@ -521,7 +521,8 @@ NGINX_FANCYINDEX='y' # https://github.com/aperezdc/ngx-fancyindex/releas
NGINX_FANCYINDEXVER='0.4.2' # https://github.com/aperezdc/ngx-fancyindex/releases
NGINX_VHOSTSTATS='n' # https://github.com/vozlt/nginx-module-vts
NGINX_LIBBROTLI='n' # https://github.com/eustas/ngx_brotli
NGINX_LIBBROTLISTATIC='n'
NGINX_LIBBROTLISTATIC='n' # only enable if you want pre-compress brotli support and on the fly brotli disabled
NGINX_BROTLIDEP_UPDATE='n' # experimental manual update of Google Brotli dependency in ngx_brotli
NGINX_PAGESPEED='n' # Install ngx_pagespeed
NGINX_PAGESPEEDGITMASTER='n' # Install ngx_pagespeed from official github master instead
NGXPGSPEED_VER='1.13.35.2-stable'
Expand Down
3 changes: 2 additions & 1 deletion example/custom_config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ NGINX_FANCYINDEX='y' # http://wiki.nginx.org/NgxFancyIndex
NGINX_FANCYINDEXVER='0.4.2' # https://github.com/aperezdc/ngx-fancyindex/releases
NGINX_VHOSTSTATS='n' # https://github.com/vozlt/nginx-module-vts
NGINX_LIBBROTLI='n' # https://github.com/eustas/ngx_brotli
NGINX_LIBBROTLISTATIC='n'
NGINX_LIBBROTLISTATIC='n' # only enable if you want pre-compress brotli support and on the fly brotli disabled
NGINX_BROTLIDEP_UPDATE='n' # experimental manual update of Google Brotli dependency in ngx_brotli
NGINX_PAGESPEED='n' # Install ngx_pagespeed
NGINX_PAGESPEEDGITMASTER='n' # Install ngx_pagespeed from official github master instead
NGXPGSPEED_VER='1.13.35.2-stable'
Expand Down
43 changes: 29 additions & 14 deletions inc/brotli.inc
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,19 @@ libbroti_install() {
fi
}

brdep_update() {
if [[ "$NGINX_BROTLIDEP_UPDATE" = [yY] ]]; then
grep 'BROTLI_VERSION' c/common/version.h
brotlilatest_tag=$(git tag | tail -1)
brotlibranch=$(echo $brotlilatest_tag | sed -e 's|v|local-|')
echo $brotlilatest_tag
echo $brotlibranch
git stash
git checkout $brotlilatest_tag -b $brotlibranch
grep 'BROTLI_VERSION' c/common/version.h
fi
}

ngxbrotli_download() {
if [[ "$NGINX_LIBBROTLI" = [yY] && "$(uname -m)" = 'x86_64' ]]; then
# only if GCC used to compile nginx with ngx_brotli
Expand Down Expand Up @@ -302,26 +315,28 @@ ngxbrotli_download() {
cd ngx_brotli
git submodule update --init
cd deps/brotli
brdep_update
./configure-cmake
make${MAKETHREADS}
make install
cd ../../
cd ../
fi
if [[ "$INITIALINSTALL" != [yY] ]]; then
cd ngx_brotli
# git stash
git fetch origin
git reset --hard origin/master
git pull
git submodule update --init
cd deps/brotli
./configure-cmake
make${MAKETHREADS}
make install
cd ../../
cd ../
fi
# if [[ "$INITIALINSTALL" != [yY] ]]; then
# cd ngx_brotli
# # git stash
# git fetch origin
# git reset --hard origin/master
# git pull
# git submodule update --init
# cd deps/brotli
# brdep_update
# ./configure-cmake
# make${MAKETHREADS}
# make install
# cd ../../
# cd ../
# fi
echo
cat > "/usr/local/nginx/conf/brotli_inc.conf" <<EIF
brotli on;
Expand Down

0 comments on commit edf3e32

Please sign in to comment.