git: ef8818183ced - main - www/{nginx,nginx-devel,freenginx}: 3rd-party modules management

Jochen Neumeister <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch main has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ef8818183cede2aa0803634cd3e804c7a6ed943c

commit ef8818183cede2aa0803634cd3e804c7a6ed943c
Author:     Jochen Neumeister <[email protected]>
AuthorDate: 2026-08-19 08:26:05 +0000
Commit:     Jochen Neumeister <[email protected]>
CommitDate: 2026-08-19 08:26:51 +0000

    www/{nginx,nginx-devel,freenginx}: 3rd-party modules management
    
    Copy the module sources with cp instead of COPYTREE_SHARE in the
    LUA and LUASTREAM pre-configure targets. COPYTREE_SHARE hardlinks
    the files and then fails to chmod them when poudriere builds as an
    unprivileged user.
    
    Convert www/nginx-module-lua into a pure source-only port. The
    prebuilt DSO conflicted with the module built by the nginx ports.
    
    Add compat patches so lua-nginx-module builds against freenginx.
    
    PR:             297651
    Reported by:    Brad Ackerman
    Sponsored by:   Netzkommune GmbH
---
 www/freenginx/Makefile                             |  8 ++--
 www/nginx-devel/Makefile                           |  8 ++--
 www/nginx-module-lua/Makefile                      | 49 +++++-----------------
 www/nginx-module-lua/distinfo                      |  6 +--
 .../files/patch-src_ngx__http__lua__subrequest.c   | 16 +++++++
 .../files/patch-src_ngx__http__lua__time.c         | 14 +++++++
 www/nginx-module-lua/pkg-plist                     |  2 -
 www/nginx/Makefile                                 |  8 ++--
 8 files changed, 53 insertions(+), 58 deletions(-)

diff --git a/www/freenginx/Makefile b/www/freenginx/Makefile
index a3cfe740d382..09de3001e237 100644
--- a/www/freenginx/Makefile
+++ b/www/freenginx/Makefile
@@ -336,13 +336,13 @@ pre-configure-SMALL_LIGHT-on:
 
 pre-configure-LUA-on:
 	@${RM} -rf ${WRKSRC_lua}
-	@cd ${LOCALBASE}/share/nginx/modules/nginx-module-lua && \
-		${COPYTREE_SHARE} . ${WRKSRC_lua}
+	@${CP} -R ${LOCALBASE}/share/nginx/modules/nginx-module-lua ${WRKSRC_lua}
+	@${CHMOD} -R u+w ${WRKSRC_lua}
 
 pre-configure-LUASTREAM-on:
 	@${RM} -rf ${WRKSRC_luastream}
-	@cd ${LOCALBASE}/share/nginx/modules/nginx-module-lua-stream && \
-		${COPYTREE_SHARE} . ${WRKSRC_luastream}
+	@${CP} -R ${LOCALBASE}/share/nginx/modules/nginx-module-lua-stream ${WRKSRC_luastream}
+	@${CHMOD} -R u+w ${WRKSRC_luastream}
 
 do-configure-NJS-on:
 	( cd ${WRKSRC_njs} && ${SETENV} ${CONFIGURE_ENV} ${CONFIGURE_CMD} ${NJS_CONFIGURE_ARGS} )
diff --git a/www/nginx-devel/Makefile b/www/nginx-devel/Makefile
index bf32dd2b60e4..779f7fb190f9 100644
--- a/www/nginx-devel/Makefile
+++ b/www/nginx-devel/Makefile
@@ -335,13 +335,13 @@ pre-configure-SMALL_LIGHT-on:
 
 pre-configure-LUA-on:
 	@${RM} -rf ${WRKSRC_lua}
-	@cd ${LOCALBASE}/share/nginx/modules/nginx-module-lua && \
-		${COPYTREE_SHARE} . ${WRKSRC_lua}
+	@${CP} -R ${LOCALBASE}/share/nginx/modules/nginx-module-lua ${WRKSRC_lua}
+	@${CHMOD} -R u+w ${WRKSRC_lua}
 
 pre-configure-LUASTREAM-on:
 	@${RM} -rf ${WRKSRC_luastream}
-	@cd ${LOCALBASE}/share/nginx/modules/nginx-module-lua-stream && \
-		${COPYTREE_SHARE} . ${WRKSRC_luastream}
+	@${CP} -R ${LOCALBASE}/share/nginx/modules/nginx-module-lua-stream ${WRKSRC_luastream}
+	@${CHMOD} -R u+w ${WRKSRC_luastream}
 
 do-configure-NJS-on:
 	( cd ${WRKSRC_njs} && ${SETENV} ${CONFIGURE_ENV} ${CONFIGURE_CMD} ${NJS_CONFIGURE_ARGS} )
diff --git a/www/nginx-module-lua/Makefile b/www/nginx-module-lua/Makefile
index 9abb3fddccce..e32cd047131f 100644
--- a/www/nginx-module-lua/Makefile
+++ b/www/nginx-module-lua/Makefile
@@ -1,57 +1,28 @@
 PORTNAME=	nginx-module-lua
+DISTVERSIONPREFIX=	v
 DISTVERSION=	0.10.29
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	www
-MASTER_SITES=	https://nginx.org/download/:nginx
-DISTFILES=	nginx-${NGINX_VERSION}.tar.gz:nginx
 
 MAINTAINER=	[email protected]
-COMMENT=	Lua dynamic module for nginx
+COMMENT=	Lua module for the NGINX HTTP subsystem
 WWW=		https://github.com/openresty/lua-nginx-module
 
 LICENSE=	BSD2CLAUSE
 
-LIB_DEPENDS=	libpcre2-8.so:devel/pcre2
-RUN_DEPENDS=	lua-resty-core>=0.1.32:www/lua-resty-core
+USE_GITHUB=	yes
+GH_ACCOUNT=	openresty
+GH_PROJECT=	lua-nginx-module
 
-USES=		compiler:c11 gmake luajit:luajit-openresty ssl
-
-USE_GITHUB=	nodefault
-GH_TUPLE=	openresty:lua-nginx-module:v${DISTVERSION}:lua \
-		vision5:ngx_devel_kit:v0.3.4:ndk
-
-NGINX_VERSION=	1.30.4
-WRKSRC=		${WRKDIR}/nginx-${NGINX_VERSION}
+NO_ARCH=	yes
+NO_BUILD=	yes
 
 MODULESDIR=	${LOCALBASE}/share/nginx/modules/${PORTNAME}
 
-CONFIGURE_ENV=	LUAJIT_INC=${LOCALBASE}/include/luajit-2.1 \
-		LUAJIT_LIB=${LOCALBASE}/lib
-
-CONFIGURE_ARGS=	--with-compat \
-		--with-cc-opt="-I${LOCALBASE}/include" \
-		--with-ld-opt="-L${LOCALBASE}/lib" \
-		--add-dynamic-module=${WRKSRC_ndk} \
-		--add-dynamic-module=${WRKSRC_lua}
-
-do-configure:
-	cd ${WRKSRC} && \
-		${SETENV} ${CONFIGURE_ENV} ./configure ${CONFIGURE_ARGS}
-
-do-build:
-	cd ${WRKSRC} && \
-		${SETENV} ${MAKE_ENV} ${MAKE_CMD} modules
-
 do-install:
-	${MKDIR} ${STAGEDIR}${PREFIX}/libexec/nginx
-	${INSTALL_LIB} ${WRKSRC}/objs/ngx_http_lua_module.so \
-		${STAGEDIR}${PREFIX}/libexec/nginx/ngx_http_lua_module.so
 	@${MKDIR} ${STAGEDIR}${MODULESDIR}/src
-	${INSTALL_DATA} ${WRKSRC_lua}/config ${STAGEDIR}${MODULESDIR}
-	@cd ${WRKSRC_lua}/src && \
+	${INSTALL_DATA} ${WRKSRC}/config ${STAGEDIR}${MODULESDIR}
+	@cd ${WRKSRC}/src && \
 		${COPYTREE_SHARE} . ${STAGEDIR}${MODULESDIR}/src
 
-post-install:
-	${STRIP_CMD} ${STAGEDIR}${PREFIX}/libexec/nginx/ngx_http_lua_module.so
-
 .include <bsd.port.mk>
diff --git a/www/nginx-module-lua/distinfo b/www/nginx-module-lua/distinfo
index 41d851871d66..675fc120cf5f 100644
--- a/www/nginx-module-lua/distinfo
+++ b/www/nginx-module-lua/distinfo
@@ -1,7 +1,3 @@
-TIMESTAMP = 1784353030
-SHA256 (nginx-1.30.4.tar.gz) = 4261dc90e9e47c1c4041276e9aaa3d48ebe2e664f728e14fa95ae6c67d57a08b
-SIZE (nginx-1.30.4.tar.gz) = 1328314
+TIMESTAMP = 1787124505
 SHA256 (openresty-lua-nginx-module-v0.10.29_GH0.tar.gz) = ca2c2122b909529bf9d1a89e9a5763835a2bd2629def8cb279c550f638f0a78f
 SIZE (openresty-lua-nginx-module-v0.10.29_GH0.tar.gz) = 892502
-SHA256 (vision5-ngx_devel_kit-v0.3.4_GH0.tar.gz) = 14a28063294f645d457b1eb10e3c23bbba44398f1c5f021421b58b6f8ab31662
-SIZE (vision5-ngx_devel_kit-v0.3.4_GH0.tar.gz) = 66474
diff --git a/www/nginx-module-lua/files/patch-src_ngx__http__lua__subrequest.c b/www/nginx-module-lua/files/patch-src_ngx__http__lua__subrequest.c
new file mode 100644
index 000000000000..199bf1660bf1
--- /dev/null
+++ b/www/nginx-module-lua/files/patch-src_ngx__http__lua__subrequest.c
@@ -0,0 +1,16 @@
+--- src/ngx_http_lua_subrequest.c.orig
++++ src/ngx_http_lua_subrequest.c
+@@ -1502,8 +1502,13 @@
+ #endif
+ 
+     tp = ngx_timeofday();
++#if defined(freenginx)
++    (void) tp;
++    sr->start_time = ngx_current_msec;
++#else
+     sr->start_sec = tp->sec;
+     sr->start_msec = tp->msec;
++#endif
+ 
+     sr->method_name = r->method_name;
+     sr->loc_conf = clcf->loc_conf;
diff --git a/www/nginx-module-lua/files/patch-src_ngx__http__lua__time.c b/www/nginx-module-lua/files/patch-src_ngx__http__lua__time.c
new file mode 100644
index 000000000000..4170906d030b
--- /dev/null
+++ b/www/nginx-module-lua/files/patch-src_ngx__http__lua__time.c
@@ -0,0 +1,14 @@
+--- src/ngx_http_lua_time.c.orig
++++ src/ngx_http_lua_time.c
+@@ -28,7 +28,11 @@
+ double
+ ngx_http_lua_ffi_req_start_time(ngx_http_request_t *r)
+ {
++#if defined(freenginx)
++    return r->start_time / 1000.0;
++#else
+     return r->start_sec + r->start_msec / 1000.0;
++#endif
+ }
+ 
+ 
diff --git a/www/nginx-module-lua/pkg-plist b/www/nginx-module-lua/pkg-plist
index 8888a35677a7..7d85a39a00da 100644
--- a/www/nginx-module-lua/pkg-plist
+++ b/www/nginx-module-lua/pkg-plist
@@ -1,4 +1,3 @@
-libexec/nginx/ngx_http_lua_module.so
 share/nginx/modules/nginx-module-lua/config
 share/nginx/modules/nginx-module-lua/src/api/ngx_http_lua_api.h
 share/nginx/modules/nginx-module-lua/src/ddebug.h
@@ -7,7 +6,6 @@ share/nginx/modules/nginx-module-lua/src/ngx_http_lua_accessby.h
 share/nginx/modules/nginx-module-lua/src/ngx_http_lua_api.c
 share/nginx/modules/nginx-module-lua/src/ngx_http_lua_args.c
 share/nginx/modules/nginx-module-lua/src/ngx_http_lua_args.h
-share/nginx/modules/nginx-module-lua/src/ngx_http_lua_autoconf.h
 share/nginx/modules/nginx-module-lua/src/ngx_http_lua_balancer.c
 share/nginx/modules/nginx-module-lua/src/ngx_http_lua_balancer.h
 share/nginx/modules/nginx-module-lua/src/ngx_http_lua_bodyfilterby.c
diff --git a/www/nginx/Makefile b/www/nginx/Makefile
index 010a8638b11c..d90e5901ef59 100644
--- a/www/nginx/Makefile
+++ b/www/nginx/Makefile
@@ -332,13 +332,13 @@ pre-configure-SMALL_LIGHT-on:
 
 pre-configure-LUA-on:
 	@${RM} -rf ${WRKSRC_lua}
-	@cd ${LOCALBASE}/share/nginx/modules/nginx-module-lua && \
-		${COPYTREE_SHARE} . ${WRKSRC_lua}
+	@${CP} -R ${LOCALBASE}/share/nginx/modules/nginx-module-lua ${WRKSRC_lua}
+	@${CHMOD} -R u+w ${WRKSRC_lua}
 
 pre-configure-LUASTREAM-on:
 	@${RM} -rf ${WRKSRC_luastream}
-	@cd ${LOCALBASE}/share/nginx/modules/nginx-module-lua-stream && \
-		${COPYTREE_SHARE} . ${WRKSRC_luastream}
+	@${CP} -R ${LOCALBASE}/share/nginx/modules/nginx-module-lua-stream ${WRKSRC_luastream}
+	@${CHMOD} -R u+w ${WRKSRC_luastream}
 
 do-configure-NJS-on:
 	( cd ${WRKSRC_njs} && ${SETENV} ${CONFIGURE_ENV} ${CONFIGURE_CMD} ${NJS_CONFIGURE_ARGS} )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.