diff --git a/net/nginx/Config.in b/net/nginx/Config.in index bf6b834c2..349f69315 100644 --- a/net/nginx/Config.in +++ b/net/nginx/Config.in @@ -177,7 +177,7 @@ config NGINX_NAXSI prompt "Enable NAXSI module" default y -config NGINX_LUA +config NGINX_MODULE_LUA bool prompt "Enable Lua module" default n diff --git a/net/nginx/Makefile b/net/nginx/Makefile index fa26de80f..c4e9f0b56 100644 --- a/net/nginx/Makefile +++ b/net/nginx/Makefile @@ -56,7 +56,7 @@ PKG_CONFIG_DEPENDS := \ CONFIG_NGINX_HTTP_CACHE \ CONFIG_NGINX_PCRE \ CONFIG_NGINX_NAXSI \ - CONFIG_NGINX_LUA + CONFIG_NGINX_MODULE_LUA include $(INCLUDE_DIR)/package.mk @@ -66,7 +66,7 @@ define Package/nginx SUBMENU:=Web Servers/Proxies TITLE:=Nginx web server URL:=http://nginx.org/ - DEPENDS:=+NGINX_PCRE:libpcre +(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC):libopenssl +NGINX_HTTP_GZIP:zlib +NGINX_LUA:liblua +libpthread + DEPENDS:=+NGINX_PCRE:libpcre +(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC):libopenssl +NGINX_HTTP_GZIP:zlib +NGINX_MODULE_LUA:liblua +libpthread MENU:=1 endef @@ -192,6 +192,12 @@ endif ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_KEEPALIVE),y) ADDITIONAL_MODULES += --without-http_upstream_keepalive_module endif +ifeq ($(CONFIG_NGINX_MODULE_LUA),y) + ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx +endif + +TARGET_CFLAGS += -ffunction-sections -fdata-sections -DNGX_LUA_NO_BY_LUA_BLOCK +TARGET_LDFLAGS += -Wl,--gc-sections TARGET_CFLAGS += -fvisibility=hidden -ffunction-sections -fdata-sections -DNGX_LUA_NO_BY_LUA_BLOCK TARGET_LDFLAGS += -Wl,--gc-sections @@ -241,7 +247,7 @@ define Build/Prepare endef define Download/nginx-naxsi - VERSION:=6358c3d2e68a0c9e3ad11661c2a1f63fadc9b4f2 + VERSION:=5ab2309f0dc93d33e1443a15db519f8bfed8b455 SUBDIR:=nginx-naxsi FILE:=nginx-naxsi-module-$(PKG_VERSION)-$$(VERSION).tar.gz URL:=https://github.com/nbs-system/naxsi.git @@ -267,4 +273,24 @@ define Prepare/lua-nginx $(call PatchDir,$(PKG_BUILD_DIR),./patches-lua-nginx) endef +define Build/Prepare + $(call Build/Prepare/Default) + $(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi)) + $(if $(CONFIG_NGINX_MODULE_LUA),$(call Prepare/lua-nginx)) +endef + +define Download/lua-nginx + VERSION:=1967998b0eedab1ff51bff8fafa5fc3db47976aa + SUBDIR:=lua-nginx + FILE:=lua-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz + URL:=git://github.com/openresty/lua-nginx-module.git + PROTO:=git +endef + +define Prepare/lua-nginx + $(eval $(call Download,lua-nginx)) + gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS) + $(call PatchDir,$(PKG_BUILD_DIR),./patches-lua-nginx) +endef + $(eval $(call BuildPackage,nginx)) diff --git a/net/nginx/patches-lua-nginx/100-dont_export_symbols.patch b/net/nginx/patches-lua-nginx/100-dont_export_symbols.patch new file mode 100644 index 000000000..8011069ad --- /dev/null +++ b/net/nginx/patches-lua-nginx/100-dont_export_symbols.patch @@ -0,0 +1,65 @@ +--- a/lua-nginx/config ++++ b/lua-nginx/config +@@ -409,35 +409,35 @@ NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ + + CFLAGS="$CFLAGS -DNDK_SET_VAR" + +-ngx_feature="export symbols by default (-E)" +-ngx_feature_libs="-Wl,-E" +-ngx_feature_name= +-ngx_feature_run=no +-ngx_feature_incs="#include " +-ngx_feature_path= +-ngx_feature_test='printf("hello");' +- +-. auto/feature +- +-if [ $ngx_found = yes ]; then +- CORE_LIBS="-Wl,-E $CORE_LIBS" +-fi ++#ngx_feature="export symbols by default (-E)" ++#ngx_feature_libs="-Wl,-E" ++#ngx_feature_name= ++#ngx_feature_run=no ++#ngx_feature_incs="#include " ++#ngx_feature_path= ++#ngx_feature_test='printf("hello");' ++# ++#. auto/feature ++# ++#if [ $ngx_found = yes ]; then ++# CORE_LIBS="-Wl,-E $CORE_LIBS" ++#fi + + # for Cygwin +-ngx_feature="export symbols by default (--export-all-symbols)" +-ngx_feature_libs="-Wl,--export-all-symbols" +-ngx_feature_name= +-ngx_feature_run=no +-ngx_feature_incs="#include " +-ngx_feature_path= +-ngx_feature_test='printf("hello");' +- +-. auto/feature +- +-if [ $ngx_found = yes ]; then +- CORE_LIBS="-Wl,--export-all-symbols $CORE_LIBS" +-fi +- ++#ngx_feature="export symbols by default (--export-all-symbols)" ++#ngx_feature_libs="-Wl,--export-all-symbols" ++#ngx_feature_name= ++#ngx_feature_run=no ++#ngx_feature_incs="#include " ++#ngx_feature_path= ++#ngx_feature_test='printf("hello");' ++# ++#. auto/feature ++# ++#if [ $ngx_found = yes ]; then ++# CORE_LIBS="-Wl,--export-all-symbols $CORE_LIBS" ++#fi ++# + 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" + diff --git a/net/nginx/patches-lua-nginx/100-by-lua-block.patch b/net/nginx/patches-lua-nginx/101-no_by_lua_block.patch similarity index 62% rename from net/nginx/patches-lua-nginx/100-by-lua-block.patch rename to net/nginx/patches-lua-nginx/101-no_by_lua_block.patch index cf9fa0993..72d0d9182 100644 --- a/net/nginx/patches-lua-nginx/100-by-lua-block.patch +++ b/net/nginx/patches-lua-nginx/101-no_by_lua_block.patch @@ -1,6 +1,6 @@ --- a/lua-nginx/src/ngx_http_lua_module.c +++ b/lua-nginx/src/ngx_http_lua_module.c -@@ -150,14 +150,14 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -148,14 +148,14 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, offsetof(ngx_http_lua_loc_conf_t, log_socket_errors), NULL }, @@ -17,7 +17,7 @@ { ngx_string("init_by_lua"), NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, ngx_http_lua_init_by_lua, -@@ -171,14 +171,14 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -169,14 +169,14 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_MAIN_CONF_OFFSET, 0, (void *) ngx_http_lua_init_by_file }, @@ -34,24 +34,7 @@ { ngx_string("init_worker_by_lua"), NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, ngx_http_lua_init_worker_by_lua, -@@ -194,6 +194,7 @@ static ngx_command_t ngx_http_lua_cmds[] - (void *) ngx_http_lua_init_worker_by_file }, - - #if defined(NDK) && NDK -+#ifndef NGX_LUA_NO_BY_LUA_BLOCK - /* set_by_lua $res { inline Lua code } [$arg1 [$arg2 [...]]] */ - { ngx_string("set_by_lua_block"), - NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -202,7 +203,7 @@ static ngx_command_t ngx_http_lua_cmds[] - NGX_HTTP_LOC_CONF_OFFSET, - 0, - (void *) ngx_http_lua_filter_set_by_lua_inline }, -- -+#endif - /* set_by_lua $res [$arg1 [$arg2 [...]]] */ - { ngx_string("set_by_lua"), - NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -230,7 +231,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -228,7 +228,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_rewrite_handler_inline }, @@ -60,7 +43,7 @@ /* rewrite_by_lua_block { } */ { ngx_string("rewrite_by_lua_block"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -239,7 +240,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -237,7 +237,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_rewrite_handler_inline }, @@ -69,7 +52,7 @@ /* access_by_lua "" */ { ngx_string("access_by_lua"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -248,7 +249,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -246,7 +246,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_access_handler_inline }, @@ -78,7 +61,7 @@ /* access_by_lua_block { } */ { ngx_string("access_by_lua_block"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -257,7 +258,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -255,7 +255,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_access_handler_inline }, @@ -87,7 +70,7 @@ /* content_by_lua "" */ { ngx_string("content_by_lua"), NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, -@@ -265,7 +266,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -263,7 +263,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_content_handler_inline }, @@ -96,7 +79,7 @@ /* content_by_lua_block { } */ { ngx_string("content_by_lua_block"), NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, -@@ -273,7 +274,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -271,7 +271,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_content_handler_inline }, @@ -105,7 +88,7 @@ /* log_by_lua */ { ngx_string("log_by_lua"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -282,7 +283,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -280,7 +280,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_log_handler_inline }, @@ -114,7 +97,7 @@ /* log_by_lua_block { } */ { ngx_string("log_by_lua_block"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -291,7 +292,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -289,7 +289,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_log_handler_inline }, @@ -123,7 +106,7 @@ { ngx_string("rewrite_by_lua_file"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |NGX_CONF_TAKE1, -@@ -346,7 +347,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -337,7 +337,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_header_filter_inline }, @@ -132,7 +115,7 @@ /* header_filter_by_lua_block { } */ { ngx_string("header_filter_by_lua_block"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -355,7 +356,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -346,7 +346,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_header_filter_inline }, @@ -141,7 +124,7 @@ { ngx_string("header_filter_by_lua_file"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |NGX_CONF_TAKE1, -@@ -371,7 +372,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -362,7 +362,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_body_filter_inline }, @@ -150,7 +133,7 @@ /* body_filter_by_lua_block { } */ { ngx_string("body_filter_by_lua_block"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF -@@ -380,7 +381,7 @@ static ngx_command_t ngx_http_lua_cmds[] +@@ -371,7 +371,7 @@ static ngx_command_t ngx_http_lua_cmds[] NGX_HTTP_LOC_CONF_OFFSET, 0, (void *) ngx_http_lua_body_filter_inline }, @@ -159,37 +142,3 @@ { ngx_string("body_filter_by_lua_file"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF |NGX_CONF_TAKE1, -@@ -388,14 +389,14 @@ static ngx_command_t ngx_http_lua_cmds[] - NGX_HTTP_LOC_CONF_OFFSET, - 0, - (void *) ngx_http_lua_body_filter_file }, -- -+#ifndef NGX_LUA_NO_BY_LUA_BLOCK - { ngx_string("balancer_by_lua_block"), - NGX_HTTP_UPS_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, - ngx_http_lua_balancer_by_lua_block, - NGX_HTTP_SRV_CONF_OFFSET, - 0, - (void *) ngx_http_lua_balancer_handler_inline }, -- -+#endif - { ngx_string("balancer_by_lua_file"), - NGX_HTTP_UPS_CONF|NGX_CONF_TAKE1, - ngx_http_lua_balancer_by_lua, -@@ -502,14 +503,14 @@ static ngx_command_t ngx_http_lua_cmds[] - NGX_HTTP_LOC_CONF_OFFSET, - offsetof(ngx_http_lua_loc_conf_t, ssl_ciphers), - NULL }, -- -+#ifndef NGX_LUA_NO_BY_LUA_BLOCK - { ngx_string("ssl_certificate_by_lua_block"), - NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, - ngx_http_lua_ssl_cert_by_lua_block, - NGX_HTTP_SRV_CONF_OFFSET, - 0, - (void *) ngx_http_lua_ssl_cert_handler_inline }, -- -+#endif - { ngx_string("ssl_certificate_by_lua_file"), - NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, - ngx_http_lua_ssl_cert_by_lua,