Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: this module can now be built as a dynamic module #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,17 @@ export LUAJIT_INC=/path/to/luajit/include/luajit-2.1
--add-module=/path/to/stream-lua-nginx-module
```

Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the
`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module)
directive, for example,

```nginx
load_module /path/to/modules/ngx_stream_lua_module.so;
```

Also, please notr, that if you have `stream` module itself also muilt as dynamic module, you MUST load it **before** `stream_lua` module.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: please notr -> please note



[Back to TOC](#table-of-contents)

Community
Expand Down
33 changes: 27 additions & 6 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -284,24 +284,28 @@ END
fi
fi


ngx_module_incs=
ngx_module_libs=
STREAM_LUA_SRCS=
STREAM_LUA_DEPS=

if [ $ngx_found = yes ]; then
# this is a hack to persuade nginx's build system to favor
# the paths set by our user environments:
CFLAGS="$ngx_lua_opt_I $CFLAGS"
NGX_LD_OPT="$ngx_lua_opt_L $NGX_LD_OPT"

CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
ngx_module_incs="$ngx_module_incs $ngx_feature_path"
ngx_module_libs="$ngx_module_libs $ngx_feature_libs"
else
cat << END
$0: error: ngx_stream_lua_module requires the Lua library.
END
exit 1
fi

ngx_addon_name=ngx_stream_lua_module
STREAM_MODULES="$STREAM_MODULES ngx_stream_lua_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
STREAM_LUA_SRCS="$STREAM_LUA_SRCS \
$ngx_addon_dir/src/ngx_stream_lua_module.c \
$ngx_addon_dir/src/ngx_stream_lua_directive.c \
$ngx_addon_dir/src/ngx_stream_lua_lex.c \
Expand Down Expand Up @@ -338,7 +342,7 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
$ngx_addon_dir/src/ngx_stream_lua_initworkerby.c \
"

NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
STREAM_LUA_DEPS="$STREAM_LUA_DEPS \
$ngx_addon_dir/src/ddebug.h \
$ngx_addon_dir/src/ngx_stream_lua_common.h \
$ngx_addon_dir/src/ngx_stream_lua_lex.h \
Expand Down Expand Up @@ -375,6 +379,23 @@ NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
$ngx_addon_dir/src/ngx_stream_lua_initworkerby.h \
"

ngx_addon_name=ngx_stream_lua_module
if test -n "$ngx_module_link"; then
ngx_module_type=STREAM
ngx_module_name="$ngx_addon_name"
ngx_module_deps="$STREAM_LUA_DEPS"
ngx_module_srcs="$STREAM_LUA_SRCS"

. auto/module
else
STREAM_MODULES="$STREAM_MODULES $ngx_addon_name"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $STREAM_LUA_SRCS"
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $STREAM_LUA_DEPS"

CORE_INCS="$CORE_INCS $ngx_module_incs"
CORE_LIBS="$CORE_LIBS $ngx_module_libs"
fi

ngx_feature="export symbols by default (-E)"
ngx_feature_libs="-Wl,-E"
ngx_feature_name=
Expand Down