# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../nginx/nginx.conf # Copyright (C) 2009 - 2013 The OpenSDE Project # Copyright (C) 2006 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. A copy of the # GNU General Public License can be found in the file COPYING. # --- SDE-COPYRIGHT-NOTE-END --- if [ $prefix_auto = 1 ]; then # use a dedicated sysconfdir sysconfdir="$sysconfdir/$pkg" fi cleanconfopt=0 [[ "$sysconfdir" = */$pkg ]] || sysconfdir=$sysconfdir/$pkg # prefix used by nginx when searching for files confopt="--prefix=$sysconfdir" var_append confopt ' ' "--sbin-path=$sbindir" var_append confopt ' ' "--conf-path=$sysconfdir/nginx.conf" # set path to nginx.pid file var_append confopt ' ' "--pid-path=$localstatedir/run/nginx.pid" # set path to nginx.lock file var_append confopt ' ' "--lock-path=$localstatedir/lock/nginx.lock" # IPv6 support by default var_append confopt ' ' "--with-ipv6" # set temporary paths and files for x in proxy fastcgi uwsgi client-body; do var_append confopt ' ' "--http-$x-temp-path=$localstatedir/temp/${x//-/_}_temp" done # log directories logdir="$localstatedir/log/$pkg" var_append confopt ' ' "--http-log-path=$logdir/access.log" var_append confopt ' ' "--error-log-path=$logdir/error.log" # --with- with dependency for x in openssl:ssl zlib:gzip_static; do if pkginstalled "${x%:*}"; then var_append confopt ' ' "--with-http_${x#*:}_module" fi done # --without- because of dependency for x in pcre:http_rewrite_module openssl:http-cache uwsgi:http_uwsgi_module; do if ! pkginstalled "${x%:*}"; then var_append confopt ' ' "--without-${x#*:}" fi done # --with- without dependency for x in stub_status flv realip; do var_append confopt ' ' "--with-http_${x}_module" done # image_filter has_all=yes for x in libgd libjpeg libpng; do if ! pkginstalled "$x"; then has_all=no break fi done if [ "$has_all" = "yes" ]; then var_append confopt ' ' "--with-http_image_filter_module" fi unset has_all if atstage cross; then var_append configprefix ' ' 'cross_compiling=yes' for x in int long long_long char_p:void_p int:sig_atomic_t int:size_t int:off_t int:time_t; do y=$(eval echo "\$arch_sizeof_${x%:*}") var_append configprefix ' ' "ngx_cache_sizeof_${x#*:}=$y" done fi var_append CC_WRAPPER_REMOVE " " "-Werror" # # 3rd party addon modules # # generic function to patch 3rd party addon modules # patches have to be named $modulename*.diff where # $modulename is the name used as parameter while # calling pkg_nginx_add_module() # pkg_nginx_patch_module() { pushd ../addon-module/$1 for p in $( ls -1 $confdir/$1*.diff 2>/dev/null ); do patch -p1 < "$p" done popd } # generic function to add a 3rd party addon module # function parameters: # $1: pattern of the modules source file name # pkg_nginx_add_module() { mkdir -p $builddir/addon-module/$1 tar -v $taropt $( match_source_file -p $1 nginx ) --strip-components=1 -C $builddir/addon-module/$1 pkg_nginx_patch_module $1 var_append confopt ' ' "--add-module=../addon-module/$1" } # NAXSI is a bit different than the other 3rd party modules # so it needs its own function # pkg_nginx_add_naxsi_premake() { mkdir -p $builddir/addon-module/naxsi-core tar -v $taropt $( match_source_file -p naxsi-core nginx ) --strip-components=1 -C $builddir/addon-module/naxsi-core var_append confopt ' ' "--add-module=../addon-module/naxsi-core/naxsi_src" } pkg_nginx_add_naxsi_postmake() { cp -a $builddir/addon-module/naxsi-core/naxsi_config/naxsi_core.rules $sysconfdir } # rrd graph module if [ "$SDECFG_PKG_NGINX_ADDON_MOD_RRDGRAPH" == 1 ] ; then pkgprefix -t rrdtool hook_add prepatch 5 "pkg_nginx_add_module mod_rrd_graph" fi if [ "$SDECFG_PKG_NGINX_ADDON_MOD_UPLOAD" == 1 ] ; then hook_add prepatch 5 "pkg_nginx_add_module nginx_upload_module" fi if [ "$SDECFG_PKG_NGINX_ADDON_MOD_HTTPECHO" == 1 ] ; then hook_add prepatch 5 "pkg_nginx_add_module echo-nginx-module" fi if [ "$SDECFG_PKG_NGINX_ADDON_MOD_NDK" == 1 ] ; then hook_add prepatch 5 "pkg_nginx_add_module ngx_devel_kit" fi if [ "$SDECFG_PKG_NGINX_ADDON_MOD_LUA" == 1 ] ; then # prefer to use luajit if available if pkginstalled -f luajit; then pkgprefix -t luajit var_append configprefix ' ' "LUAJIT_LIB=$( pkgprefix -r libdir luajit )" var_append configprefix ' ' "LUAJIT_INC=$( pkgprefix -r includedir luajit )" else pkgprefix -t lua var_append configprefix ' ' "LUA_LIB=$( pkgprefix -r libdir lua )" var_append configprefix ' ' "LUA_INC=$( pkgprefix -r includedir lua )" fi hook_add prepatch 5 "pkg_nginx_add_module lua-nginx-module" fi if [ "$SDECFG_PKG_NGINX_ADDON_NAXSI" == 1 ] ; then hook_add prepatch 5 "pkg_nginx_add_naxsi_premake" hook_add postmake 5 "pkg_nginx_add_naxsi_postmake" fi if [ "$SDECFG_PKG_NGINX_ADDON_SYSLOG_PATCH" == 1 ] ; then hook_add prepatch 5 "pkg_nginx_add_module nginx_syslog_patch" hook_add prepatch 9 "var_append patchfiles ' ' '../addon-module/nginx_syslog_patch/syslog_$( cut -d. -f-2 <<< $ver)*.patch'" fi