[OpenWrt-Devel] package nginx add support for ngx_http_substitutions_filter_module
diff mbox

Message ID CAG2YnVmoKtE4nSb8S9ftM=RxUmCdVmLyNTKou70Cayg2iRh8oA@mail.gmail.com
State Not Applicable
Headers show

Commit Message

cruze guo Feb. 2, 2015, 5:58 a.m. UTC
From: cruze guo <gyb997 at gmail.com>

This patch add support for nginx substitutions.
nginx_substitutions_filter is a filter module which can do both regular
expression and fixed string substitutions on response bodies.
https://github.com/yaoweibin/ngx_http_substitutions_filter_module

Signed-off-by: cruze guo <gyb997 at gmail.com>
---


 endef
@@ -218,6 +226,7 @@ define Build/Prepare
     $(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi))
     $(if $(CONFIG_NGINX_SYSLOG),$(call Prepare/nginx-syslog))
     $(if $(CONFIG_NGINX_HTTP_UPSTREAM_CHECK),$(call
Prepare/nginx-upstream-check))
+    $(if $(CONFIG_NGINX_SUB_MULTIFILTER),$(call Prepare/sub-nginx))
 endef

 define Download/lua-nginx
@@ -228,12 +237,26 @@ define Download/lua-nginx
     PROTO:=git
 endef

+define Download/sub-nginx
+    VERSION:=131c030cbb284c7eb22a1c5184236d0983391441
+    SUBDIR:=sub-nginx
+    FILE:=sub-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz
+    URL:=https://github.com/yaoweibin/ngx_http_substitutions_filter_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

+define  Prepare/sub-nginx
+    $(eval $(call Download,sub-nginx))
+    gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+endef
+
+
 define Download/nginx-upstream-check
     VERSION:=d40b9f956d9d978005bb15616d2f283d4e3d2031
     SUBDIR:=nginx-upstream-check

Comments

John Crispin Feb. 3, 2015, 8:06 a.m. UTC | #1
On 02/02/2015 06:58, cruze guo wrote:
> From: cruze guo <gyb997 at gmail.com>
> 
> This patch add support for nginx substitutions.
> nginx_substitutions_filter is a filter module which can do both regular
> expression and fixed string substitutions on response bodies.
> https://github.com/yaoweibin/ngx_http_substitutions_filter_module
> 

please send a pull request via github. the mailing list is only for
trunk packages.




> Signed-off-by: cruze guo <gyb997 at gmail.com>
> ---
> 
> 
> diff --git a/net/nginx/Config.in b/net/nginx/Config.in
> index b135e42..de61de9 100644
> --- a/net/nginx/Config.in
> +++ b/net/nginx/Config.in
> @@ -38,6 +38,12 @@ config NGINX_LUA
>      help
>          Enable support for LUA scripts.
> 
> +config NGINX_SUB_MULTIFILTER
> +    bool
> +    prompt "Enable SUB_MULTIFILTER module"
> +    help
> +        Enable support for ngx_http_substitutions_filter_
> module.
> +
>  config NGINX_PCRE
>      bool
>      prompt "Enable PCRE library usage"
> diff --git a/net/nginx/Makefile b/net/nginx/Makefile
> index e93326e..eb74d24 100644
> --- a/net/nginx/Makefile
> +++ b/net/nginx/Makefile
> @@ -49,7 +49,8 @@ PKG_CONFIG_DEPENDS := \
>      CONFIG_NGINX_HTTP_LIMIT_REQ \
>      CONFIG_NGINX_HTTP_EMPTY_GIF \
>      CONFIG_NGINX_HTTP_BROWSER \
> -    CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH
> +    CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \
> +    CONFIG_NGINX_SUB_MULTIFILTER
> 
>  include $(INCLUDE_DIR)/package.mk
> 
> @@ -100,6 +101,10 @@ endif
>  ifeq ($(CONFIG_NGINX_LUA),y)
>    ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx
>  endif
> +ifeq ($(CONFIG_NGINX_SUB_MULTIFILTER),y)
> +  ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/sub-nginx
> +endif
> +
>  ifneq ($(CONFIG_NGINX_HTTP_CACHE),y)
>    ADDITIONAL_MODULES += --without-http-cache
>  endif
> @@ -208,6 +213,9 @@ define Package/nginx/install
>      $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
>      $(INSTALL_DIR) $(1)/etc/nginx
>      $(INSTALL_DATA) $(addprefix
> $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/
> +    $(INSTALL_BIN) ./files/bf.lua $(1)/etc/nginx/bf.lua
> +    $(INSTALL_BIN) ./files/hf.lua $(1)/etc/nginx/hf.lua
> +    $(INSTALL_BIN) ./files/nginx_wifi.conf $(1)/etc/nginx/nginx.conf
>      $(INSTALL_DIR) $(1)/etc/init.d
>      $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
>  endef
> @@ -218,6 +226,7 @@ define Build/Prepare
>      $(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi))
>      $(if $(CONFIG_NGINX_SYSLOG),$(call Prepare/nginx-syslog))
>      $(if $(CONFIG_NGINX_HTTP_UPSTREAM_CHECK),$(call
> Prepare/nginx-upstream-check))
> +    $(if $(CONFIG_NGINX_SUB_MULTIFILTER),$(call Prepare/sub-nginx))
>  endef
> 
>  define Download/lua-nginx
> @@ -228,12 +237,26 @@ define Download/lua-nginx
>      PROTO:=git
>  endef
> 
> +define Download/sub-nginx
> +    VERSION:=131c030cbb284c7eb22a1c5184236d0983391441
> +    SUBDIR:=sub-nginx
> +    FILE:=sub-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz
> +    URL:=https://github.com/yaoweibin/ngx_http_substitutions_filter_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
> 
> +define  Prepare/sub-nginx
> +    $(eval $(call Download,sub-nginx))
> +    gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
> +endef
> +
> +
>  define Download/nginx-upstream-check
>      VERSION:=d40b9f956d9d978005bb15616d2f283d4e3d2031
>      SUBDIR:=nginx-upstream-check
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>

Patch
diff mbox

diff --git a/net/nginx/Config.in b/net/nginx/Config.in
index b135e42..de61de9 100644
--- a/net/nginx/Config.in
+++ b/net/nginx/Config.in
@@ -38,6 +38,12 @@  config NGINX_LUA
     help
         Enable support for LUA scripts.

+config NGINX_SUB_MULTIFILTER
+    bool
+    prompt "Enable SUB_MULTIFILTER module"
+    help
+        Enable support for ngx_http_substitutions_filter_
module.
+
 config NGINX_PCRE
     bool
     prompt "Enable PCRE library usage"
diff --git a/net/nginx/Makefile b/net/nginx/Makefile
index e93326e..eb74d24 100644
--- a/net/nginx/Makefile
+++ b/net/nginx/Makefile
@@ -49,7 +49,8 @@  PKG_CONFIG_DEPENDS := \
     CONFIG_NGINX_HTTP_LIMIT_REQ \
     CONFIG_NGINX_HTTP_EMPTY_GIF \
     CONFIG_NGINX_HTTP_BROWSER \
-    CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH
+    CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH \
+    CONFIG_NGINX_SUB_MULTIFILTER

 include $(INCLUDE_DIR)/package.mk

@@ -100,6 +101,10 @@  endif
 ifeq ($(CONFIG_NGINX_LUA),y)
   ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx
 endif
+ifeq ($(CONFIG_NGINX_SUB_MULTIFILTER),y)
+  ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/sub-nginx
+endif
+
 ifneq ($(CONFIG_NGINX_HTTP_CACHE),y)
   ADDITIONAL_MODULES += --without-http-cache
 endif
@@ -208,6 +213,9 @@  define Package/nginx/install
     $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
     $(INSTALL_DIR) $(1)/etc/nginx
     $(INSTALL_DATA) $(addprefix
$(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/
+    $(INSTALL_BIN) ./files/bf.lua $(1)/etc/nginx/bf.lua
+    $(INSTALL_BIN) ./files/hf.lua $(1)/etc/nginx/hf.lua
+    $(INSTALL_BIN) ./files/nginx_wifi.conf $(1)/etc/nginx/nginx.conf
     $(INSTALL_DIR) $(1)/etc/init.d
     $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx