From 712cf7f52eceac1e3fbc7e69d719a06104e26d30 Mon Sep 17 00:00:00 2001 From: Liu Lantao Date: Sat, 25 May 2019 16:43:39 +0200 Subject: [PATCH] Update module config file (#36) Nginx dynamic module build system can compile multiple modules in a single .so * ngx_module_name https://www.nginx.com/resources/wiki/extending/new_config/#key-ngx_module_name This will let users enable/disable HTTP or STREAM or both module[s] by using `--without-http` or `--with-stream` --- config | 46 ++++++++++++++++++++++++++++++++++-- ngx_http_accounting_module | 17 ------------- ngx_stream_accounting_module | 17 ------------- samples/Dockerfile | 2 +- samples/nginx.conf | 2 +- 5 files changed, 46 insertions(+), 38 deletions(-) delete mode 100644 ngx_http_accounting_module delete mode 100644 ngx_stream_accounting_module diff --git a/config b/config index 2bb9ce8..497e557 100644 --- a/config +++ b/config @@ -12,5 +12,47 @@ TRAFFIC_ACCOUNTING_SRCS=" \ $ngx_addon_dir/src/ngx_traffic_accounting_statuses.c \ " -. $ngx_addon_dir/ngx_http_accounting_module -#. $ngx_addon_dir/ngx_stream_accounting_module +HTTP_ACCOUNTING_DEPS=" \ + $ngx_addon_dir/src/http/ngx_http_accounting_module.h \ + " +HTTP_ACCOUNTING_SRCS=" \ + $ngx_addon_dir/src/http/ngx_http_accounting_module.c \ + $ngx_addon_dir/src/http/ngx_http_accounting_statuses.c \ + " + +STREAM_ACCOUNTING_DEPS=" \ + $ngx_addon_dir/src/stream/ngx_stream_accounting_module.h \ + " +STREAM_ACCOUNTING_SRCS=" \ + $ngx_addon_dir/src/stream/ngx_stream_accounting_module.c \ + $ngx_addon_dir/src/stream/ngx_stream_accounting_statuses.c \ + " + +ngx_module_type= +ngx_module_name= +ngx_module_incs=$ngx_addon_dir +ngx_module_deps=$TRAFFIC_ACCOUNTING_DEPS +ngx_module_srcs=$TRAFFIC_ACCOUNTING_SRCS +ngx_module_libs= + +if [ $HTTP != NO ] +then + ngx_module_type=HTTP + ngx_module_name="ngx_http_accounting_module" + ngx_module_deps="$ngx_module_deps $HTTP_ACCOUNTING_DEPS" + ngx_module_srcs="$ngx_module_srcs $HTTP_ACCOUNTING_SRCS" +fi + +if [ $STREAM != NO ] +then + ngx_module_type=STREAM + if test -n "$ngx_module_name"; then + ngx_module_name="ngx_http_accounting_module ngx_stream_accounting_module" + else + ngx_module_name="ngx_stream_accounting_module" + fi + ngx_module_deps="$ngx_module_deps $STREAM_ACCOUNTING_DEPS" + ngx_module_srcs="$ngx_module_srcs $STREAM_ACCOUNTING_SRCS" +fi + +. auto/module diff --git a/ngx_http_accounting_module b/ngx_http_accounting_module deleted file mode 100644 index 5a1e9ce..0000000 --- a/ngx_http_accounting_module +++ /dev/null @@ -1,17 +0,0 @@ -[ $HTTP != NO ] || exit 0 - -HTTP_ACCOUNTING_DEPS=" \ - $ngx_addon_dir/src/http/ngx_http_accounting_module.h \ - " -HTTP_ACCOUNTING_SRCS=" \ - $ngx_addon_dir/src/http/ngx_http_accounting_module.c \ - $ngx_addon_dir/src/http/ngx_http_accounting_statuses.c \ - " - -ngx_module_type=HTTP -ngx_module_name=ngx_http_accounting_module -ngx_module_incs=$ngx_addon_dir -ngx_module_deps="$TRAFFIC_ACCOUNTING_DEPS $HTTP_ACCOUNTING_DEPS" -ngx_module_srcs="$TRAFFIC_ACCOUNTING_SRCS $HTTP_ACCOUNTING_SRCS" - -. auto/module diff --git a/ngx_stream_accounting_module b/ngx_stream_accounting_module deleted file mode 100644 index baf0685..0000000 --- a/ngx_stream_accounting_module +++ /dev/null @@ -1,17 +0,0 @@ -[ $STREAM != NO ] || exit 0 - -STREAM_ACCOUNTING_DEPS=" \ - $ngx_addon_dir/src/stream/ngx_stream_accounting_module.h \ - " -STREAM_ACCOUNTING_SRCS=" \ - $ngx_addon_dir/src/stream/ngx_stream_accounting_module.c \ - $ngx_addon_dir/src/stream/ngx_stream_accounting_statuses.c \ - " - -ngx_module_type=STREAM -ngx_module_name=ngx_stream_accounting_module -ngx_module_incs=$ngx_addon_dir -ngx_module_deps="$TRAFFIC_ACCOUNTING_DEPS $STREAM_ACCOUNTING_DEPS" -ngx_module_srcs="$TRAFFIC_ACCOUNTING_SRCS $STREAM_ACCOUNTING_SRCS" - -. auto/module diff --git a/samples/Dockerfile b/samples/Dockerfile index e57cf9b..ce1029e 100644 --- a/samples/Dockerfile +++ b/samples/Dockerfile @@ -4,7 +4,7 @@ RUN yum install gcc make pcre-devel zlib-devel openssl-devel -y \ && yum clean all ENV PREFIX /opt/nginx -ENV NGX_VER 1.14.0 +ENV NGX_VER 1.16.0 ENV WORKDIR /src ENV NGX_SRC_DIR ${WORKDIR}/nginx-${NGX_VER} diff --git a/samples/nginx.conf b/samples/nginx.conf index e852454..5bf4137 100644 --- a/samples/nginx.conf +++ b/samples/nginx.conf @@ -1,5 +1,5 @@ load_module modules/ngx_http_accounting_module.so; -load_module modules/ngx_stream_accounting_module.so; +#load_module modules/ngx_stream_accounting_module.so; load_module modules/ngx_http_echo_module.so; worker_processes auto;