From d0b63da2de9be76f14b426bceb2d1c14661a2a51 Mon Sep 17 00:00:00 2001
From: vdutta <vivek.dutta@iopsys.eu>
Date: Tue, 1 Jun 2021 00:24:17 +0530
Subject: [PATCH] nginx: Added nginx-upload-module

---
 net/nginx/Config_ssl.in |  7 +++++++
 net/nginx/Makefile      | 25 ++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/net/nginx/Config_ssl.in b/net/nginx/Config_ssl.in
index 1c53dab6aa..43378e9c81 100644
--- a/net/nginx/Config_ssl.in
+++ b/net/nginx/Config_ssl.in
@@ -22,6 +22,13 @@ config NGINX_UBUS
 		Enable UBUS api support directly from the server.
 	default y
 
+config NGINX_UPLOAD
+	bool
+	prompt "Enable Upload module"
+	help
+		Enable File upload module.
+	default y
+
 config NGINX_FLV
 	bool
 	prompt "Enable FLV module"
diff --git a/net/nginx/Makefile b/net/nginx/Makefile
index 37da27e151..170e4db167 100644
--- a/net/nginx/Makefile
+++ b/net/nginx/Makefile
@@ -28,6 +28,7 @@ PKG_CONFIG_DEPENDS := \
 	CONFIG_NGINX_DAV \
 	CONFIG_NGINX_FLV \
 	CONFIG_NGINX_UBUS \
+	CONFIG_NGINX_UPLOAD \
 	CONFIG_NGINX_STUB_STATUS \
 	CONFIG_NGINX_HTTP_CHARSET \
 	CONFIG_NGINX_HTTP_GZIP \
@@ -245,6 +246,9 @@ ifneq ($(BUILD_VARIANT),all-module)
   ifeq ($(CONFIG_NGINX_UBUS),y)
     ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module
   endif
+  ifeq ($(CONFIG_NGINX_UPLOAD),y)
+    ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-upload-module
+  endif
   ifeq ($(CONFIG_NGINX_HTTP_AUTH_REQUEST),y)
     ADDITIONAL_MODULES += --with-http_auth_request_module
   endif
@@ -290,6 +294,7 @@ else
   CONFIG_NGINX_LUA:=y
   CONFIG_NGINX_DAV:=y
   CONFIG_NGINX_UBUS:=y
+  CONFIG_NGINX_UPLOAD:=y
   ADDITIONAL_MODULES += --with-ipv6 --with-http_stub_status_module --with-http_flv_module \
 	--with-http_dav_module \
 	--with-http_auth_request_module --with-http_v2_module --with-http_realip_module \
@@ -300,7 +305,8 @@ else
 	--add-module=$(PKG_BUILD_DIR)/lua-nginx \
 	--add-module=$(PKG_BUILD_DIR)/nginx-dav-ext-module \
 	--add-module=$(PKG_BUILD_DIR)/nginx-brotli --add-module=$(PKG_BUILD_DIR)/nginx-rtmp \
-	--add-module=$(PKG_BUILD_DIR)/nginx-ts --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module
+	--add-module=$(PKG_BUILD_DIR)/nginx-ts --add-module=$(PKG_BUILD_DIR)/nginx-ubus-module \
+	--add-module=$(PKG_BUILD_DIR)/nginx-upload-module
   config_files += koi-utf koi-win win-utf fastcgi_params uwsgi_params
 endif
 
@@ -396,6 +402,7 @@ define Build/Prepare
 	$(Prepare/nginx-ts)
 	$(Prepare/nginx-dav-ext-module)
 	$(Prepare/nginx-ubus-module)
+	$(Prepare/nginx-upload-module)
 endef
 
 
@@ -542,6 +549,22 @@ ifeq ($(CONFIG_NGINX_UBUS),y)
 	xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
   endef
 endif
+ifeq ($(CONFIG_NGINX_UPLOAD),y)
+  define Download/nginx-upload-module
+    VERSION:=72ec037d13d0afb6b50e5cef5681d4e51e9eb85b
+    SUBDIR:=nginx-upload-module
+    FILE:=nginx-upload-module-$$(VERSION).tar.xz
+    URL:=https://github.com/Austinb/nginx-upload-module.git
+    MIRROR_HASH:=542758baffdb62000463ad00a77c664f7036ffc04332efeeef5357035341c852
+    PROTO:=git
+  endef
+  $(eval $(call Download,nginx-upload-module))
+
+  define Prepare/nginx-upload-module
+	$(eval $(Download/nginx-upload-module))
+	xzcat $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+  endef
+endif
 
 $(eval $(call BuildPackage,nginx-ssl))
 $(eval $(call BuildPackage,nginx-all-module))
-- 
GitLab