| # Copyright (C) 2015 Google Inc. | |
| # All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions | |
| # are met: | |
| # 1. Redistributions of source code must retain the above copyright | |
| # notice, this list of conditions and the following disclaimer. | |
| # 2. Redistributions in binary form must reproduce the above copyright | |
| # notice, this list of conditions and the following disclaimer in the | |
| # documentation and/or other materials provided with the distribution. | |
| # | |
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| # SUCH DAMAGE. | |
| ngx_addon_name=ngx_brotli | |
| # | |
| # static module (no dependencies) | |
| # | |
| HTTP_MODULES="$HTTP_MODULES \ | |
| ngx_http_brotli_static_module" | |
| NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ | |
| $ngx_addon_dir/src/ngx_http_brotli_static_module.c" | |
| have=NGX_HTTP_GZIP . auto/have | |
| have=NGX_HTTP_BROTLI_STATIC_MODULE . auto/have | |
| if [ -n "$NGX_BROTLI_STATIC_MODULE_ONLY" ]; then | |
| return | |
| fi | |
| # | |
| # filter module (depends on Brotli library) | |
| # | |
| ngx_feature_run=no | |
| ngx_feature_cpp=yes | |
| ngx_feature_incs="#include <brotli/enc/encode.h>" | |
| ngx_feature_test="brotli::BrotliParams params; | |
| params.quality = 11" | |
| # auto-discovery | |
| ngx_feature="Brotli library" | |
| ngx_feature_cpp=yes | |
| ngx_feature_path= | |
| ngx_feature_libs="-lbrotlienc -lstdc++" | |
| . $ngx_addon_dir/auto/feature | |
| if [ $ngx_found = no ]; then | |
| # FreeBSD, OpenBSD | |
| ngx_feature="Brotli library in /usr/local/" | |
| ngx_feature_cpp=yes | |
| ngx_feature_path="/usr/local/include" | |
| if [ $NGX_RPATH = YES ]; then | |
| ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lbrotlienc -lstdc++" | |
| else | |
| ngx_feature_libs="-L/usr/local/lib -lbrotlienc -lstdc++" | |
| fi | |
| . $ngx_addon_dir/auto/feature | |
| fi | |
| if [ $ngx_found = no ]; then | |
| # NetBSD | |
| ngx_feature="Brotli library in /usr/pkg/" | |
| ngx_feature_cpp=yes | |
| ngx_feature_path="/usr/pkg/include" | |
| if [ $NGX_RPATH = YES ]; then | |
| ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lbrotlienc -lstdc++" | |
| else | |
| ngx_feature_libs="-L/usr/pkg/lib -lbrotlienc -lstdc++" | |
| fi | |
| . $ngx_addon_dir/auto/feature | |
| fi | |
| if [ $ngx_found = no ]; then | |
| # MacPorts | |
| ngx_feature="Brotli library in /opt/local/" | |
| ngx_feature_cpp=yes | |
| ngx_feature_path="/opt/local/include" | |
| if [ $NGX_RPATH = YES ]; then | |
| ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lbrotlienc -lstdc++" | |
| else | |
| ngx_feature_libs="-L/opt/local/lib -lbrotlienc -lstdc++" | |
| fi | |
| . $ngx_addon_dir/auto/feature | |
| fi | |
| if [ $ngx_found = no ]; then | |
| echo "$0: error: ngx_brotli filter module requires Brotli library." | |
| exit 1 | |
| fi | |
| CORE_INCS="$CORE_INCS $ngx_feature_path" | |
| CORE_LIBS="$CORE_LIBS $ngx_feature_libs" | |
| HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES \ | |
| ngx_http_brotli_filter_module" | |
| NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ | |
| $ngx_addon_dir/src/ngx_http_brotli_filter_module.cc" | |
| have=NGX_HTTP_BROTLI_FILTER_MODULE . auto/have |