[nginx] Configure: shared sources for addon modules.

Maxim Dounin mdounin at mdounin.ru
Tue Nov 10 15:50:23 UTC 2020


details:   https://hg.nginx.org/nginx/rev/4b1299b1856a
branches:  
changeset: 7743:4b1299b1856a
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Tue Nov 10 17:13:20 2020 +0300
description:
Configure: shared sources for addon modules.

Addon modules, both dynamic and static, can now use shared source files.
Shared sources result in only one make rule even if specified several
times in different modules.

diffstat:

 auto/make    |   3 ++-
 auto/module  |  44 ++++++++++++++++++++++++++++++++++++++++++--
 auto/options |   1 +
 3 files changed, 45 insertions(+), 3 deletions(-)

diffs (99 lines):

diff -r 4a69fec53b2f -r 4b1299b1856a auto/make
--- a/auto/make	Tue Nov 10 17:13:17 2020 +0300
+++ b/auto/make	Tue Nov 10 17:13:20 2020 +0300
@@ -502,6 +502,7 @@ fi
 for ngx_module in $DYNAMIC_MODULES
 do
     eval ngx_module_srcs="\$${ngx_module}_SRCS"
+    eval ngx_module_shrd="\$${ngx_module}_SHRD"
     eval eval ngx_module_libs="\\\"\$${ngx_module}_LIBS\\\""
 
     eval ngx_module_modules="\$${ngx_module}_MODULES"
@@ -567,7 +568,7 @@ END
         | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
 
     ngx_module_objs=
-    for ngx_src in $ngx_module_srcs
+    for ngx_src in $ngx_module_srcs $ngx_module_shrd
     do
         case "$ngx_src" in
             src/*)
diff -r 4a69fec53b2f -r 4b1299b1856a auto/module
--- a/auto/module	Tue Nov 10 17:13:17 2020 +0300
+++ b/auto/module	Tue Nov 10 17:13:20 2020 +0300
@@ -17,7 +17,6 @@ if [ "$ngx_module_link" = DYNAMIC ]; the
     done
 
     DYNAMIC_MODULES="$DYNAMIC_MODULES $ngx_module"
-    eval ${ngx_module}_SRCS=\"$ngx_module_srcs\"
 
     eval ${ngx_module}_MODULES=\"$ngx_module_name\"
 
@@ -31,6 +30,30 @@ if [ "$ngx_module_link" = DYNAMIC ]; the
         eval ${ngx_module}_ORDER=\"$ngx_module_order\"
     fi
 
+    srcs=
+    shrd=
+    for src in $ngx_module_srcs
+    do
+        found=no
+        for old in $DYNAMIC_MODULES_SRCS
+        do
+            if [ $src = $old ]; then
+                found=yes
+                break
+            fi
+        done
+
+        if [ $found = no ]; then
+            srcs="$srcs $src"
+        else
+            shrd="$shrd $src"
+        fi
+    done
+    eval ${ngx_module}_SRCS=\"$srcs\"
+    eval ${ngx_module}_SHRD=\"$shrd\"
+
+    DYNAMIC_MODULES_SRCS="$DYNAMIC_MODULES_SRCS $srcs"
+
     if test -n "$ngx_module_incs"; then
         CORE_INCS="$CORE_INCS $ngx_module_incs"
     fi
@@ -107,7 +130,24 @@ elif [ "$ngx_module_link" = ADDON ]; the
     eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \
                                       $ngx_module_name\"
 
-    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_module_srcs"
+    srcs=
+    for src in $ngx_module_srcs
+    do
+        found=no
+        for old in $NGX_ADDON_SRCS
+        do
+            if [ $src = $old ]; then
+                found=yes
+                break
+            fi
+        done
+
+        if [ $found = no ]; then
+            srcs="$srcs $src"
+        fi
+    done
+
+    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $srcs"
 
     if test -n "$ngx_module_incs"; then
         eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\"
diff -r 4a69fec53b2f -r 4b1299b1856a auto/options
--- a/auto/options	Tue Nov 10 17:13:17 2020 +0300
+++ b/auto/options	Tue Nov 10 17:13:20 2020 +0300
@@ -132,6 +132,7 @@ STREAM_UPSTREAM_ZONE=YES
 STREAM_SSL_PREREAD=NO
 
 DYNAMIC_MODULES=
+DYNAMIC_MODULES_SRCS=
 
 NGX_ADDONS=
 NGX_ADDON_SRCS=


More information about the nginx-devel mailing list