Skip to content

Commit

Permalink
Dynamic modules: auto/module script.
Browse files Browse the repository at this point in the history
This script simplifies configuration of additional modules,
including 3rd party ones.  The script is extensible, and
will be used to introduce dynamic linking of modules in upcoming
changes.

3rd party module config scripts are called with ngx_module_link
preset to "ADDON" - this allows config scripts to call auto/module
without ngx_module_link explicitly defined, as well as testing if
new interface is in place if compatibility with older nginx versions
is desired.

In collaboration with Ruslan Ermilov.
  • Loading branch information
mdounin committed Feb 4, 2016
1 parent 359803e commit 0805ba1
Show file tree
Hide file tree
Showing 4 changed files with 848 additions and 558 deletions.
6 changes: 3 additions & 3 deletions auto/make
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ END
fi


ngx_all_srcs="$ngx_all_srcs $NGX_MISC_SRCS"
ngx_all_srcs="$ngx_all_srcs $MISC_SRCS"


if test -n "$NGX_ADDON_SRCS"; then
Expand Down Expand Up @@ -365,11 +365,11 @@ fi

# the misc sources

if test -n "$NGX_MISC_SRCS"; then
if test -n "$MISC_SRCS"; then

ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"

for ngx_src in $NGX_MISC_SRCS
for ngx_src in $MISC_SRCS
do
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
ngx_obj=`echo $ngx_src \
Expand Down
71 changes: 71 additions & 0 deletions auto/module
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

# Copyright (C) Ruslan Ermilov
# Copyright (C) Nginx, Inc.


case $ngx_module_type in
HTTP_*) ngx_var=HTTP ;;
*) ngx_var=$ngx_module_type ;;
esac


if [ "$ngx_module_link" = YES ]; then

eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \
$ngx_module_name\"

eval ${ngx_var}_SRCS=\"\$${ngx_var}_SRCS $ngx_module_srcs\"

if test -n "$ngx_module_incs"; then
eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\"
fi

if test -n "$ngx_module_deps"; then
eval ${ngx_var}_DEPS=\"\$${ngx_var}_DEPS $ngx_module_deps\"
fi

for lib in $ngx_module_libs
do
case $lib in

PCRE | OPENSSL | MD5 | SHA1 | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP)
eval USE_${lib}=YES
;;

*)
CORE_LIBS="$CORE_LIBS $lib"
;;

esac
done

elif [ "$ngx_module_link" = ADDON ]; then

eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \
$ngx_module_name\"

NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_module_srcs"

if test -n "$ngx_module_incs"; then
eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\"
fi

if test -n "$ngx_module_deps"; then
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_module_deps"
fi

for lib in $ngx_module_libs
do
case $lib in

PCRE | OPENSSL | MD5 | SHA1 | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP)
eval USE_${lib}=YES
;;

*)
CORE_LIBS="$CORE_LIBS $lib"
;;

esac
done
fi
Loading

0 comments on commit 0805ba1

Please sign in to comment.