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

Conversation

msva
Copy link

@msva msva commented Mar 26, 2017

// ping @agentzh, just in case 😸

@defanator
Copy link

@msva this PR is quite outdated and can't be applied to current master. Care to provide the fix?

@i2dcarrasco
Copy link

i2dcarrasco commented Sep 4, 2019

Hello,

How I can provide a fix for this?. I've modified my config to be compiled as dynamic module and looks like is working, but I'm not really a programmer and I don't know how to do it. Also the fix is very similar to this one (maybe just changing one line will work).

index f524267..7f52aa0 100644
--- a/config
+++ b/config
@@ -228,7 +228,7 @@ fi
 # ----------------------------------------
 
 ngx_addon_name=ngx_stream_lua_module
-NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
+STREAM_LUA_SRCS="$STREAM_LUA_SRCS \
                 $ngx_addon_dir/src/ngx_stream_lua_api.c \
                 $ngx_addon_dir/src/ngx_stream_lua_request.c \
                 $ngx_addon_dir/src/ngx_stream_lua_module.c \
@@ -274,7 +274,7 @@ NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
                 $ngx_addon_dir/src/ngx_stream_lua_input_filters.c \
                 "
 
-NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
+STREAM_LUA_DEPS="$STREAM_LUA_DEPS \
                 $ngx_addon_dir/src/ddebug.h \
                 $ngx_addon_dir/src/api/ngx_stream_lua_api.h \
                 $ngx_addon_dir/src/ngx_stream_lua_request.h \
@@ -316,7 +316,6 @@ NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
                 $ngx_addon_dir/src/ngx_stream_lua_input_filters.h \
                 "
 
-STREAM_MODULES="$STREAM_MODULES $ngx_addon_name"
 
 # ----------------------------------------
 
@@ -424,7 +423,23 @@ USE_SHA1=YES
 #NGX_DTRACE_PROVIDERS="$NGX_DTRACE_PROVIDERS $ngx_addon_dir/dtrace/ngx_lua_provider.d"
 #NGX_TAPSET_SRCS="$NGX_TAPSET_SRCS $ngx_addon_dir/tapset/ngx_lua.stp"
 
-CORE_INCS="$CORE_INCS $ngx_addon_dir/src/api"
-
 #CFLAGS=$"$CFLAGS -DLUA_DEFAULT_PATH='\"/usr/local/openresty/lualib/?.lua\"'"
 #CFLAGS=$"$CFLAGS -DLUA_DEFAULT_CPATH='\"/usr/local/openresty/lualib/?.so\"'"
+
+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
+
+CORE_INCS="$CORE_INCS $ngx_addon_dir/src/api"

Greetings!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants