Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] nginx: use dynamic modules instead of options, add njs.
@ 2022-10-01 13:32 leahneukirchen
  2022-10-04 11:53 ` [PR PATCH] [Updated] " leahneukirchen
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: leahneukirchen @ 2022-10-01 13:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

There is a new pull request by leahneukirchen against master on the void-packages repository

https://github.com/leahneukirchen/void-packages dynamic-nginx
https://github.com/void-linux/void-packages/pull/39584

nginx: use dynamic modules instead of options, add njs.
The perl module will be coming after #39463 is merged.

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**


A patch file from https://github.com/void-linux/void-packages/pull/39584.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dynamic-nginx-39584.patch --]
[-- Type: text/x-diff, Size: 12243 bytes --]

From 64d9e47e4971da892948ce8114d423863191321d Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Fri, 30 Sep 2022 17:44:55 +0200
Subject: [PATCH 1/2] nginx: use dynamic modules instead of options, put them
 into subpackages.

- move tmp paths and homedir to /var/lib/nginx to ensure they keep existing
- use configure_args for consistency
---
 srcpkgs/nginx-mod-http-geoip       |   1 +
 srcpkgs/nginx-mod-http-xslt-filter |   1 +
 srcpkgs/nginx-mod-stream           |   1 +
 srcpkgs/nginx-mod-stream-geoip     |   1 +
 srcpkgs/nginx/template             | 129 +++++++++++++++++------------
 5 files changed, 82 insertions(+), 51 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-geoip
 create mode 120000 srcpkgs/nginx-mod-http-xslt-filter
 create mode 120000 srcpkgs/nginx-mod-stream
 create mode 120000 srcpkgs/nginx-mod-stream-geoip

diff --git a/srcpkgs/nginx-mod-http-geoip b/srcpkgs/nginx-mod-http-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-http-xslt-filter b/srcpkgs/nginx-mod-http-xslt-filter
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-xslt-filter
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream b/srcpkgs/nginx-mod-stream
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-geoip b/srcpkgs/nginx-mod-stream-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index a4324dd75df8..1a6142d49fc3 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -6,7 +6,46 @@ _tests_commit=18ac4d9e5a2a
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
-hostmakedepends="openssl-devel pcre2-devel $(vopt_if geoip geoip-devel)"
+_cfgdir=/etc/nginx
+_tmpdir=/var/lib/nginx/tmp
+configure_args="--prefix=${_cfgdir} \
+ --conf-path=${_cfgdir}/nginx.conf \
+ --sbin-path=/usr/bin/nginx \
+ --modules-path=/usr/lib/nginx/modules \
+ --pid-path=/run/nginx.pid \
+ --lock-path=/var/lock/nginx.lock \
+ --user=nginx \
+ --group=nginx \
+ --http-log-path=/var/log/nginx/access.log \
+ --error-log-path=/var/log/nginx/error.log \
+ --http-client-body-temp-path=${tmpdir}/client-body \
+ --http-proxy-temp-path=${tmpdir}/proxy \
+ --http-fastcgi-temp-path=${tmpdir}/fastcgi \
+ --http-scgi-temp-path=${tmpdir}/scgi \
+ --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --with-compat \
+ --with-file-aio \
+ --with-http_dav_module \
+ --with-http_gunzip_module \
+ --with-http_gzip_static_module \
+ --with-http_realip_module \
+ --with-http_ssl_module \
+ --with-http_slice_module \
+ --with-http_stub_status_module \
+ --with-http_sub_module \
+ --with-http_v2_module \
+ --with-http_xslt_module=dynamic \
+ --with-http_geoip_module=dynamic \
+ --with-stream=dynamic \
+ --with-stream_geoip_module=dynamic \
+ --with-stream_realip_module \
+ --with-stream_ssl_module \
+ --with-stream_ssl_preread_module \
+ --with-mail \
+ --with-mail_ssl_module \
+ --with-pcre-jit \
+ --with-threads"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -34,64 +73,18 @@ conf_files="/etc/nginx/fastcgi.conf
  /etc/nginx/uwsgi_params
  /etc/nginx/win-utf"
 system_accounts="nginx"
-nginx_homedir="/var/tmp/nginx"
+nginx_homedir="/var/lib/nginx"
 make_dirs="/var/log/nginx 0750 root root
- /var/tmp 1777 root root
- /var/tmp/nginx 0750 nginx root"
-
-build_options="geoip stream slice"
-desc_option_stream="Enable support for stream proxies"
-desc_option_slice="Enable support for slice filters"
-build_options_default="geoip stream slice"
+ /var/lib/nginx 1777 root root
+ /var/lib/nginx/tmp 0750 nginx root"
 
 do_configure() {
-	local cfgdir=/etc/nginx
-	local tmpdir=/var/tmp/nginx
-
 	if [ "$CROSS_BUILD" ]; then
 		# fake configure run on host
 		unset CC CPP LD CFLAGS CPPFLAGS LDFLAGS
 	fi
 
-	local stream_modules="\
-		--with-stream \
-		--with-stream_realip_module \
-		--with-stream_ssl_module \
-		--with-stream_ssl_preread_module \
-		$(vopt_if geoip --with-stream_geoip_module) \
-	"
-
-	./configure --prefix=${cfgdir} \
-		--conf-path=${cfgdir}/nginx.conf \
-		--sbin-path=/usr/bin/nginx \
-		--pid-path=/run/nginx.pid \
-		--lock-path=/var/lock/nginx.lock \
-		--user=nginx --group=nginx \
-		--http-log-path=/var/log/nginx/access.log \
-		--error-log-path=/var/log/nginx/error.log \
-		--http-client-body-temp-path=${tmpdir}/client-body \
-		--http-proxy-temp-path=${tmpdir}/proxy \
-		--http-fastcgi-temp-path=${tmpdir}/fastcgi \
-		--http-scgi-temp-path=${tmpdir}/scgi \
-		--http-uwsgi-temp-path=${tmpdir}/uwsgi \
-		--with-compat \
-		--with-file-aio \
-		--with-http_dav_module \
-		--with-http_gunzip_module \
-		--with-http_gzip_static_module \
-		--with-http_realip_module \
-		--with-http_ssl_module \
-		--with-http_stub_status_module \
-		--with-http_sub_module \
-		--with-http_v2_module \
-		--with-mail \
-		--with-mail_ssl_module \
-		--with-pcre-jit \
-		--with-threads \
-		$(vopt_if geoip --with-http_geoip_module) \
-		$(vopt_if stream "$stream_modules") \
-		$(vopt_if slice --with-http_slice_module)
-
+	./configure ${configure_args}
 }
 
 pre_build() {
@@ -103,6 +96,8 @@ pre_build() {
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
+
+	export LD="$CC"
 }
 
 do_check() {
@@ -125,3 +120,35 @@ post_install() {
 	vlicense LICENSE
 	vsv nginx
 }
+
+nginx-mod-http-geoip_package() {
+	short_desc+=" - HTTP GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_geoip_module.so
+	}
+}
+
+nginx-mod-http-xslt-filter_package() {
+	short_desc+=" - XSLT filter module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_xslt_filter_module.so
+	}
+}
+
+nginx-mod-stream_package() {
+	short_desc+=" - Stream module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_module.so
+	}
+}
+
+nginx-mod-stream-geoip_package() {
+	short_desc+=" - Stream GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_geoip_module.so
+	}
+}

From 9d478a54640cdce9ffebfdb2cca61db59ce95c22 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Sat, 1 Oct 2022 14:47:15 +0200
Subject: [PATCH 2/2] nginx: add njs modules.

---
 srcpkgs/nginx-mod-http-js   |  1 +
 srcpkgs/nginx-mod-stream-js |  1 +
 srcpkgs/nginx/INSTALL.msg   |  7 +++++
 srcpkgs/nginx/template      | 59 +++++++++++++++++++++++++++++--------
 4 files changed, 56 insertions(+), 12 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-js
 create mode 120000 srcpkgs/nginx-mod-stream-js
 create mode 100644 srcpkgs/nginx/INSTALL.msg

diff --git a/srcpkgs/nginx-mod-http-js b/srcpkgs/nginx-mod-http-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-js b/srcpkgs/nginx-mod-stream-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/INSTALL.msg b/srcpkgs/nginx/INSTALL.msg
new file mode 100644
index 000000000000..9505dd5607a2
--- /dev/null
+++ b/srcpkgs/nginx/INSTALL.msg
@@ -0,0 +1,7 @@
+nginx has been converted to use dynamic modules.
+
+If you used the stream or geoip modules before, you now need
+to install nginx-mod-$MODULE and add this to the main context of nginx.conf:
+
+  load_module modules/ngx_$MODULE_module.so;
+
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 1a6142d49fc3..2b1d472d7a8f 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,8 +1,9 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=1
+revision=2
 _tests_commit=18ac4d9e5a2a
+_njs_version=0.7.7
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
@@ -18,11 +19,11 @@ configure_args="--prefix=${_cfgdir} \
  --group=nginx \
  --http-log-path=/var/log/nginx/access.log \
  --error-log-path=/var/log/nginx/error.log \
- --http-client-body-temp-path=${tmpdir}/client-body \
- --http-proxy-temp-path=${tmpdir}/proxy \
- --http-fastcgi-temp-path=${tmpdir}/fastcgi \
- --http-scgi-temp-path=${tmpdir}/scgi \
- --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --http-client-body-temp-path=${_tmpdir}/client-body \
+ --http-proxy-temp-path=${_tmpdir}/proxy \
+ --http-fastcgi-temp-path=${_tmpdir}/fastcgi \
+ --http-scgi-temp-path=${_tmpdir}/scgi \
+ --http-uwsgi-temp-path=${_tmpdir}/uwsgi \
  --with-compat \
  --with-file-aio \
  --with-http_dav_module \
@@ -44,8 +45,10 @@ configure_args="--prefix=${_cfgdir} \
  --with-mail \
  --with-mail_ssl_module \
  --with-pcre-jit \
- --with-threads"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
+ --with-threads
+ --add-dynamic-module=../njs-${_njs_version}/nginx"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+ which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -53,9 +56,11 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
 license="BSD-2-Clause"
 homepage="https://nginx.org"
 distfiles="https://nginx.org/download/nginx-${version}.tar.gz
- https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz"
+ https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz
+ https://hg.nginx.org/njs/archive/${_njs_version}.tar.gz"
 checksum="b33d569a6f11a01433a57ce17e83935e953ad4dc77cdd4d40f896c88ac26eb53
- e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228"
+ e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228
+ 4dac9cbf071e5a7dfe135b4d87e20112d207fcbf5fb620854af8dab44ec3e7bd"
 # Tests fail when nginx run as root and there is no nginx user
 make_check=ci-skip
 
@@ -85,19 +90,33 @@ do_configure() {
 	fi
 
 	./configure ${configure_args}
+	( cd ../njs-${_njs_version} && ./configure )
 }
 
 pre_build() {
 	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ../njs-${_njs_version}/build
 		case "$XBPS_TARGET_MACHINE" in
-			arm*) cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h;;
-			aarch64*) cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h;;
+		arm*)
+			cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.armv6l" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
+		aarch64*)
+			cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
 		esac
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
 
 	export LD="$CC"
+
+	(
+		cd ../njs-${_njs_version}
+		make ${makejobs} NJS_CC="$CC" NJS_CFLAGS="$CFLAGS -fPIC" \
+			NJS_STATIC_LINK="$AR -r -c" NJS_LINK="$CC -O"
+	)
 }
 
 do_check() {
@@ -129,6 +148,14 @@ nginx-mod-http-geoip_package() {
 	}
 }
 
+nginx-mod-http-js_package() {
+	short_desc+=" - HTTP njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_js_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"
@@ -145,6 +172,14 @@ nginx-mod-stream_package() {
 	}
 }
 
+nginx-mod-stream-js_package() {
+	short_desc+=" - Stream njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_js_module.so
+	}
+}
+
 nginx-mod-stream-geoip_package() {
 	short_desc+=" - Stream GeoIP module"
 	depends="${sourcepkg}>=${version}_${revision}"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR PATCH] [Updated] nginx: use dynamic modules instead of options, add njs.
  2022-10-01 13:32 [PR PATCH] nginx: use dynamic modules instead of options, add njs leahneukirchen
@ 2022-10-04 11:53 ` leahneukirchen
  2022-10-04 12:38 ` leahneukirchen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: leahneukirchen @ 2022-10-04 11:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

There is an updated pull request by leahneukirchen against master on the void-packages repository

https://github.com/leahneukirchen/void-packages dynamic-nginx
https://github.com/void-linux/void-packages/pull/39584

nginx: use dynamic modules instead of options, add njs.
The perl module will be coming after #39463 is merged.

#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**


A patch file from https://github.com/void-linux/void-packages/pull/39584.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dynamic-nginx-39584.patch --]
[-- Type: text/x-diff, Size: 21606 bytes --]

From 768b933ec802b573d3123e764bf2e21619d182fc Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Fri, 30 Sep 2022 17:44:55 +0200
Subject: [PATCH 1/3] nginx: use dynamic modules instead of options, put them
 into subpackages.

- move tmp paths and homedir to /var/lib/nginx to ensure they keep existing
- use configure_args for consistency
---
 srcpkgs/nginx-mod-http-geoip       |   1 +
 srcpkgs/nginx-mod-http-xslt-filter |   1 +
 srcpkgs/nginx-mod-stream           |   1 +
 srcpkgs/nginx-mod-stream-geoip     |   1 +
 srcpkgs/nginx/template             | 129 +++++++++++++++++------------
 5 files changed, 82 insertions(+), 51 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-geoip
 create mode 120000 srcpkgs/nginx-mod-http-xslt-filter
 create mode 120000 srcpkgs/nginx-mod-stream
 create mode 120000 srcpkgs/nginx-mod-stream-geoip

diff --git a/srcpkgs/nginx-mod-http-geoip b/srcpkgs/nginx-mod-http-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-http-xslt-filter b/srcpkgs/nginx-mod-http-xslt-filter
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-xslt-filter
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream b/srcpkgs/nginx-mod-stream
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-geoip b/srcpkgs/nginx-mod-stream-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index a4324dd75df8..1a6142d49fc3 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -6,7 +6,46 @@ _tests_commit=18ac4d9e5a2a
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
-hostmakedepends="openssl-devel pcre2-devel $(vopt_if geoip geoip-devel)"
+_cfgdir=/etc/nginx
+_tmpdir=/var/lib/nginx/tmp
+configure_args="--prefix=${_cfgdir} \
+ --conf-path=${_cfgdir}/nginx.conf \
+ --sbin-path=/usr/bin/nginx \
+ --modules-path=/usr/lib/nginx/modules \
+ --pid-path=/run/nginx.pid \
+ --lock-path=/var/lock/nginx.lock \
+ --user=nginx \
+ --group=nginx \
+ --http-log-path=/var/log/nginx/access.log \
+ --error-log-path=/var/log/nginx/error.log \
+ --http-client-body-temp-path=${tmpdir}/client-body \
+ --http-proxy-temp-path=${tmpdir}/proxy \
+ --http-fastcgi-temp-path=${tmpdir}/fastcgi \
+ --http-scgi-temp-path=${tmpdir}/scgi \
+ --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --with-compat \
+ --with-file-aio \
+ --with-http_dav_module \
+ --with-http_gunzip_module \
+ --with-http_gzip_static_module \
+ --with-http_realip_module \
+ --with-http_ssl_module \
+ --with-http_slice_module \
+ --with-http_stub_status_module \
+ --with-http_sub_module \
+ --with-http_v2_module \
+ --with-http_xslt_module=dynamic \
+ --with-http_geoip_module=dynamic \
+ --with-stream=dynamic \
+ --with-stream_geoip_module=dynamic \
+ --with-stream_realip_module \
+ --with-stream_ssl_module \
+ --with-stream_ssl_preread_module \
+ --with-mail \
+ --with-mail_ssl_module \
+ --with-pcre-jit \
+ --with-threads"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -34,64 +73,18 @@ conf_files="/etc/nginx/fastcgi.conf
  /etc/nginx/uwsgi_params
  /etc/nginx/win-utf"
 system_accounts="nginx"
-nginx_homedir="/var/tmp/nginx"
+nginx_homedir="/var/lib/nginx"
 make_dirs="/var/log/nginx 0750 root root
- /var/tmp 1777 root root
- /var/tmp/nginx 0750 nginx root"
-
-build_options="geoip stream slice"
-desc_option_stream="Enable support for stream proxies"
-desc_option_slice="Enable support for slice filters"
-build_options_default="geoip stream slice"
+ /var/lib/nginx 1777 root root
+ /var/lib/nginx/tmp 0750 nginx root"
 
 do_configure() {
-	local cfgdir=/etc/nginx
-	local tmpdir=/var/tmp/nginx
-
 	if [ "$CROSS_BUILD" ]; then
 		# fake configure run on host
 		unset CC CPP LD CFLAGS CPPFLAGS LDFLAGS
 	fi
 
-	local stream_modules="\
-		--with-stream \
-		--with-stream_realip_module \
-		--with-stream_ssl_module \
-		--with-stream_ssl_preread_module \
-		$(vopt_if geoip --with-stream_geoip_module) \
-	"
-
-	./configure --prefix=${cfgdir} \
-		--conf-path=${cfgdir}/nginx.conf \
-		--sbin-path=/usr/bin/nginx \
-		--pid-path=/run/nginx.pid \
-		--lock-path=/var/lock/nginx.lock \
-		--user=nginx --group=nginx \
-		--http-log-path=/var/log/nginx/access.log \
-		--error-log-path=/var/log/nginx/error.log \
-		--http-client-body-temp-path=${tmpdir}/client-body \
-		--http-proxy-temp-path=${tmpdir}/proxy \
-		--http-fastcgi-temp-path=${tmpdir}/fastcgi \
-		--http-scgi-temp-path=${tmpdir}/scgi \
-		--http-uwsgi-temp-path=${tmpdir}/uwsgi \
-		--with-compat \
-		--with-file-aio \
-		--with-http_dav_module \
-		--with-http_gunzip_module \
-		--with-http_gzip_static_module \
-		--with-http_realip_module \
-		--with-http_ssl_module \
-		--with-http_stub_status_module \
-		--with-http_sub_module \
-		--with-http_v2_module \
-		--with-mail \
-		--with-mail_ssl_module \
-		--with-pcre-jit \
-		--with-threads \
-		$(vopt_if geoip --with-http_geoip_module) \
-		$(vopt_if stream "$stream_modules") \
-		$(vopt_if slice --with-http_slice_module)
-
+	./configure ${configure_args}
 }
 
 pre_build() {
@@ -103,6 +96,8 @@ pre_build() {
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
+
+	export LD="$CC"
 }
 
 do_check() {
@@ -125,3 +120,35 @@ post_install() {
 	vlicense LICENSE
 	vsv nginx
 }
+
+nginx-mod-http-geoip_package() {
+	short_desc+=" - HTTP GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_geoip_module.so
+	}
+}
+
+nginx-mod-http-xslt-filter_package() {
+	short_desc+=" - XSLT filter module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_xslt_filter_module.so
+	}
+}
+
+nginx-mod-stream_package() {
+	short_desc+=" - Stream module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_module.so
+	}
+}
+
+nginx-mod-stream-geoip_package() {
+	short_desc+=" - Stream GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_geoip_module.so
+	}
+}

From 0268498f94cde3da303e98fb45abc7e1b8a9d344 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Sat, 1 Oct 2022 14:47:15 +0200
Subject: [PATCH 2/3] nginx: add njs modules.

---
 srcpkgs/nginx-mod-http-js   |  1 +
 srcpkgs/nginx-mod-stream-js |  1 +
 srcpkgs/nginx/INSTALL.msg   |  7 +++++
 srcpkgs/nginx/template      | 59 +++++++++++++++++++++++++++++--------
 4 files changed, 56 insertions(+), 12 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-js
 create mode 120000 srcpkgs/nginx-mod-stream-js
 create mode 100644 srcpkgs/nginx/INSTALL.msg

diff --git a/srcpkgs/nginx-mod-http-js b/srcpkgs/nginx-mod-http-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-js b/srcpkgs/nginx-mod-stream-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/INSTALL.msg b/srcpkgs/nginx/INSTALL.msg
new file mode 100644
index 000000000000..9505dd5607a2
--- /dev/null
+++ b/srcpkgs/nginx/INSTALL.msg
@@ -0,0 +1,7 @@
+nginx has been converted to use dynamic modules.
+
+If you used the stream or geoip modules before, you now need
+to install nginx-mod-$MODULE and add this to the main context of nginx.conf:
+
+  load_module modules/ngx_$MODULE_module.so;
+
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 1a6142d49fc3..2b1d472d7a8f 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,8 +1,9 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=1
+revision=2
 _tests_commit=18ac4d9e5a2a
+_njs_version=0.7.7
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
@@ -18,11 +19,11 @@ configure_args="--prefix=${_cfgdir} \
  --group=nginx \
  --http-log-path=/var/log/nginx/access.log \
  --error-log-path=/var/log/nginx/error.log \
- --http-client-body-temp-path=${tmpdir}/client-body \
- --http-proxy-temp-path=${tmpdir}/proxy \
- --http-fastcgi-temp-path=${tmpdir}/fastcgi \
- --http-scgi-temp-path=${tmpdir}/scgi \
- --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --http-client-body-temp-path=${_tmpdir}/client-body \
+ --http-proxy-temp-path=${_tmpdir}/proxy \
+ --http-fastcgi-temp-path=${_tmpdir}/fastcgi \
+ --http-scgi-temp-path=${_tmpdir}/scgi \
+ --http-uwsgi-temp-path=${_tmpdir}/uwsgi \
  --with-compat \
  --with-file-aio \
  --with-http_dav_module \
@@ -44,8 +45,10 @@ configure_args="--prefix=${_cfgdir} \
  --with-mail \
  --with-mail_ssl_module \
  --with-pcre-jit \
- --with-threads"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
+ --with-threads
+ --add-dynamic-module=../njs-${_njs_version}/nginx"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+ which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -53,9 +56,11 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
 license="BSD-2-Clause"
 homepage="https://nginx.org"
 distfiles="https://nginx.org/download/nginx-${version}.tar.gz
- https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz"
+ https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz
+ https://hg.nginx.org/njs/archive/${_njs_version}.tar.gz"
 checksum="b33d569a6f11a01433a57ce17e83935e953ad4dc77cdd4d40f896c88ac26eb53
- e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228"
+ e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228
+ 4dac9cbf071e5a7dfe135b4d87e20112d207fcbf5fb620854af8dab44ec3e7bd"
 # Tests fail when nginx run as root and there is no nginx user
 make_check=ci-skip
 
@@ -85,19 +90,33 @@ do_configure() {
 	fi
 
 	./configure ${configure_args}
+	( cd ../njs-${_njs_version} && ./configure )
 }
 
 pre_build() {
 	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ../njs-${_njs_version}/build
 		case "$XBPS_TARGET_MACHINE" in
-			arm*) cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h;;
-			aarch64*) cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h;;
+		arm*)
+			cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.armv6l" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
+		aarch64*)
+			cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
 		esac
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
 
 	export LD="$CC"
+
+	(
+		cd ../njs-${_njs_version}
+		make ${makejobs} NJS_CC="$CC" NJS_CFLAGS="$CFLAGS -fPIC" \
+			NJS_STATIC_LINK="$AR -r -c" NJS_LINK="$CC -O"
+	)
 }
 
 do_check() {
@@ -129,6 +148,14 @@ nginx-mod-http-geoip_package() {
 	}
 }
 
+nginx-mod-http-js_package() {
+	short_desc+=" - HTTP njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_js_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"
@@ -145,6 +172,14 @@ nginx-mod-stream_package() {
 	}
 }
 
+nginx-mod-stream-js_package() {
+	short_desc+=" - Stream njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_js_module.so
+	}
+}
+
 nginx-mod-stream-geoip_package() {
 	short_desc+=" - Stream GeoIP module"
 	depends="${sourcepkg}>=${version}_${revision}"

From babed87851d25489e0d91584108bcf62c2d4ffa4 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 4 Oct 2022 13:34:08 +0200
Subject: [PATCH 3/3] nginx: enable perl module.

---
 srcpkgs/nginx/files/ngx_auto_config.h.aarch64 | 22 ++++++++++++++-----
 srcpkgs/nginx/files/ngx_auto_config.h.armv6l  | 22 ++++++++++++++-----
 srcpkgs/nginx/template                        | 15 +++++++++++--
 3 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/srcpkgs/nginx/files/ngx_auto_config.h.aarch64 b/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
index 7dd53d712857..809e031b2000 100644
--- a/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
+++ b/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
@@ -1,4 +1,4 @@
-#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/tmp/nginx/client-body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --with-http_geoip_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module --with-http_slice_module"
+#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --modules-path=/usr/lib/nginx/modules --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/tmp/client-body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --add-dynamic-module=../njs-0.7.7/nginx"
 
 #ifndef NGX_HAVE_GCC_ATOMIC
 #define NGX_HAVE_GCC_ATOMIC  1
@@ -528,6 +528,16 @@
 #endif
 
 
+#ifndef NGX_HAVE_EXSLT
+#define NGX_HAVE_EXSLT  1
+#endif
+
+
+#ifndef NGX_HAVE_PERL_MULTIPLICITY
+#define NGX_HAVE_PERL_MULTIPLICITY  1
+#endif
+
+
 #ifndef NGX_HAVE_GEOIP_V6
 #define NGX_HAVE_GEOIP_V6  1
 #endif
@@ -574,27 +584,27 @@
 
 
 #ifndef NGX_HTTP_CLIENT_TEMP_PATH
-#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/tmp/nginx/client-body"
+#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/lib/nginx/tmp/client-body"
 #endif
 
 
 #ifndef NGX_HTTP_PROXY_TEMP_PATH
-#define NGX_HTTP_PROXY_TEMP_PATH  "/var/tmp/nginx/proxy"
+#define NGX_HTTP_PROXY_TEMP_PATH  "/var/lib/nginx/tmp/proxy"
 #endif
 
 
 #ifndef NGX_HTTP_FASTCGI_TEMP_PATH
-#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/tmp/nginx/fastcgi"
+#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/lib/nginx/tmp/fastcgi"
 #endif
 
 
 #ifndef NGX_HTTP_UWSGI_TEMP_PATH
-#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/tmp/nginx/uwsgi"
+#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/lib/nginx/tmp/uwsgi"
 #endif
 
 
 #ifndef NGX_HTTP_SCGI_TEMP_PATH
-#define NGX_HTTP_SCGI_TEMP_PATH  "/var/tmp/nginx/scgi"
+#define NGX_HTTP_SCGI_TEMP_PATH  "/var/lib/nginx/tmp/scgi"
 #endif
 
 
diff --git a/srcpkgs/nginx/files/ngx_auto_config.h.armv6l b/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
index 5b32a6948ce3..df88ec2e35ac 100644
--- a/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
+++ b/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
@@ -1,4 +1,4 @@
-#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/tmp/nginx/client-body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --with-http_geoip_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module --with-http_slice_module"
+#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --modules-path=/usr/lib/nginx/modules --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/tmp/client-body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --add-dynamic-module=../njs-0.7.7/nginx"
 
 #ifndef NGX_HAVE_GCC_ATOMIC
 #define NGX_HAVE_GCC_ATOMIC  1
@@ -528,6 +528,16 @@
 #endif
 
 
+#ifndef NGX_HAVE_EXSLT
+#define NGX_HAVE_EXSLT  1
+#endif
+
+
+#ifndef NGX_HAVE_PERL_MULTIPLICITY
+#define NGX_HAVE_PERL_MULTIPLICITY  1
+#endif
+
+
 #ifndef NGX_HAVE_GEOIP_V6
 #define NGX_HAVE_GEOIP_V6  1
 #endif
@@ -574,27 +584,27 @@
 
 
 #ifndef NGX_HTTP_CLIENT_TEMP_PATH
-#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/tmp/nginx/client-body"
+#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/lib/nginx/tmp/client-body"
 #endif
 
 
 #ifndef NGX_HTTP_PROXY_TEMP_PATH
-#define NGX_HTTP_PROXY_TEMP_PATH  "/var/tmp/nginx/proxy"
+#define NGX_HTTP_PROXY_TEMP_PATH  "/var/lib/nginx/tmp/proxy"
 #endif
 
 
 #ifndef NGX_HTTP_FASTCGI_TEMP_PATH
-#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/tmp/nginx/fastcgi"
+#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/lib/nginx/tmp/fastcgi"
 #endif
 
 
 #ifndef NGX_HTTP_UWSGI_TEMP_PATH
-#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/tmp/nginx/uwsgi"
+#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/lib/nginx/tmp/uwsgi"
 #endif
 
 
 #ifndef NGX_HTTP_SCGI_TEMP_PATH
-#define NGX_HTTP_SCGI_TEMP_PATH  "/var/tmp/nginx/scgi"
+#define NGX_HTTP_SCGI_TEMP_PATH  "/var/lib/nginx/tmp/scgi"
 #endif
 
 
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 2b1d472d7a8f..8107afd0f3e0 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,7 +1,7 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=2
+revision=3
 _tests_commit=18ac4d9e5a2a
 _njs_version=0.7.7
 create_wrksrc=yes
@@ -37,6 +37,7 @@ configure_args="--prefix=${_cfgdir} \
  --with-http_v2_module \
  --with-http_xslt_module=dynamic \
  --with-http_geoip_module=dynamic \
+ --with-http_perl_module=dynamic \
  --with-stream=dynamic \
  --with-stream_geoip_module=dynamic \
  --with-stream_realip_module \
@@ -47,7 +48,7 @@ configure_args="--prefix=${_cfgdir} \
  --with-pcre-jit \
  --with-threads
  --add-dynamic-module=../njs-${_njs_version}/nginx"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel perl libxslt-devel
  which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
@@ -106,6 +107,8 @@ pre_build() {
 			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
 			;;
 		esac
+
+		sed -i "s:-I/usr:-I${XBPS_CROSS_BASE}/usr:" objs/Makefile
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
@@ -156,6 +159,14 @@ nginx-mod-http-js_package() {
 	}
 }
 
+nginx-mod-http-perl_package() {
+	short_desc+=" - Perl module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_perl_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR PATCH] [Updated] nginx: use dynamic modules instead of options, add njs.
  2022-10-01 13:32 [PR PATCH] nginx: use dynamic modules instead of options, add njs leahneukirchen
  2022-10-04 11:53 ` [PR PATCH] [Updated] " leahneukirchen
@ 2022-10-04 12:38 ` leahneukirchen
  2022-10-04 19:20 ` leahneukirchen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: leahneukirchen @ 2022-10-04 12:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

There is an updated pull request by leahneukirchen against master on the void-packages repository

https://github.com/leahneukirchen/void-packages dynamic-nginx
https://github.com/void-linux/void-packages/pull/39584

nginx: use dynamic modules instead of options, add njs.


#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**


A patch file from https://github.com/void-linux/void-packages/pull/39584.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dynamic-nginx-39584.patch --]
[-- Type: text/x-diff, Size: 27203 bytes --]

From 4a3bc264190c2733a5bd4f0c8dc8e230dfe64331 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Fri, 30 Sep 2022 17:44:55 +0200
Subject: [PATCH 1/3] nginx: use dynamic modules instead of options, put them
 into subpackages.

- move tmp paths and homedir to /var/lib/nginx to ensure they keep existing
- use configure_args for consistency
---
 srcpkgs/nginx-mod-http-geoip       |   1 +
 srcpkgs/nginx-mod-http-xslt-filter |   1 +
 srcpkgs/nginx-mod-stream           |   1 +
 srcpkgs/nginx-mod-stream-geoip     |   1 +
 srcpkgs/nginx/template             | 129 +++++++++++++++++------------
 5 files changed, 82 insertions(+), 51 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-geoip
 create mode 120000 srcpkgs/nginx-mod-http-xslt-filter
 create mode 120000 srcpkgs/nginx-mod-stream
 create mode 120000 srcpkgs/nginx-mod-stream-geoip

diff --git a/srcpkgs/nginx-mod-http-geoip b/srcpkgs/nginx-mod-http-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-http-xslt-filter b/srcpkgs/nginx-mod-http-xslt-filter
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-xslt-filter
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream b/srcpkgs/nginx-mod-stream
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-geoip b/srcpkgs/nginx-mod-stream-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index a4324dd75df8..1a6142d49fc3 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -6,7 +6,46 @@ _tests_commit=18ac4d9e5a2a
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
-hostmakedepends="openssl-devel pcre2-devel $(vopt_if geoip geoip-devel)"
+_cfgdir=/etc/nginx
+_tmpdir=/var/lib/nginx/tmp
+configure_args="--prefix=${_cfgdir} \
+ --conf-path=${_cfgdir}/nginx.conf \
+ --sbin-path=/usr/bin/nginx \
+ --modules-path=/usr/lib/nginx/modules \
+ --pid-path=/run/nginx.pid \
+ --lock-path=/var/lock/nginx.lock \
+ --user=nginx \
+ --group=nginx \
+ --http-log-path=/var/log/nginx/access.log \
+ --error-log-path=/var/log/nginx/error.log \
+ --http-client-body-temp-path=${tmpdir}/client-body \
+ --http-proxy-temp-path=${tmpdir}/proxy \
+ --http-fastcgi-temp-path=${tmpdir}/fastcgi \
+ --http-scgi-temp-path=${tmpdir}/scgi \
+ --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --with-compat \
+ --with-file-aio \
+ --with-http_dav_module \
+ --with-http_gunzip_module \
+ --with-http_gzip_static_module \
+ --with-http_realip_module \
+ --with-http_ssl_module \
+ --with-http_slice_module \
+ --with-http_stub_status_module \
+ --with-http_sub_module \
+ --with-http_v2_module \
+ --with-http_xslt_module=dynamic \
+ --with-http_geoip_module=dynamic \
+ --with-stream=dynamic \
+ --with-stream_geoip_module=dynamic \
+ --with-stream_realip_module \
+ --with-stream_ssl_module \
+ --with-stream_ssl_preread_module \
+ --with-mail \
+ --with-mail_ssl_module \
+ --with-pcre-jit \
+ --with-threads"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -34,64 +73,18 @@ conf_files="/etc/nginx/fastcgi.conf
  /etc/nginx/uwsgi_params
  /etc/nginx/win-utf"
 system_accounts="nginx"
-nginx_homedir="/var/tmp/nginx"
+nginx_homedir="/var/lib/nginx"
 make_dirs="/var/log/nginx 0750 root root
- /var/tmp 1777 root root
- /var/tmp/nginx 0750 nginx root"
-
-build_options="geoip stream slice"
-desc_option_stream="Enable support for stream proxies"
-desc_option_slice="Enable support for slice filters"
-build_options_default="geoip stream slice"
+ /var/lib/nginx 1777 root root
+ /var/lib/nginx/tmp 0750 nginx root"
 
 do_configure() {
-	local cfgdir=/etc/nginx
-	local tmpdir=/var/tmp/nginx
-
 	if [ "$CROSS_BUILD" ]; then
 		# fake configure run on host
 		unset CC CPP LD CFLAGS CPPFLAGS LDFLAGS
 	fi
 
-	local stream_modules="\
-		--with-stream \
-		--with-stream_realip_module \
-		--with-stream_ssl_module \
-		--with-stream_ssl_preread_module \
-		$(vopt_if geoip --with-stream_geoip_module) \
-	"
-
-	./configure --prefix=${cfgdir} \
-		--conf-path=${cfgdir}/nginx.conf \
-		--sbin-path=/usr/bin/nginx \
-		--pid-path=/run/nginx.pid \
-		--lock-path=/var/lock/nginx.lock \
-		--user=nginx --group=nginx \
-		--http-log-path=/var/log/nginx/access.log \
-		--error-log-path=/var/log/nginx/error.log \
-		--http-client-body-temp-path=${tmpdir}/client-body \
-		--http-proxy-temp-path=${tmpdir}/proxy \
-		--http-fastcgi-temp-path=${tmpdir}/fastcgi \
-		--http-scgi-temp-path=${tmpdir}/scgi \
-		--http-uwsgi-temp-path=${tmpdir}/uwsgi \
-		--with-compat \
-		--with-file-aio \
-		--with-http_dav_module \
-		--with-http_gunzip_module \
-		--with-http_gzip_static_module \
-		--with-http_realip_module \
-		--with-http_ssl_module \
-		--with-http_stub_status_module \
-		--with-http_sub_module \
-		--with-http_v2_module \
-		--with-mail \
-		--with-mail_ssl_module \
-		--with-pcre-jit \
-		--with-threads \
-		$(vopt_if geoip --with-http_geoip_module) \
-		$(vopt_if stream "$stream_modules") \
-		$(vopt_if slice --with-http_slice_module)
-
+	./configure ${configure_args}
 }
 
 pre_build() {
@@ -103,6 +96,8 @@ pre_build() {
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
+
+	export LD="$CC"
 }
 
 do_check() {
@@ -125,3 +120,35 @@ post_install() {
 	vlicense LICENSE
 	vsv nginx
 }
+
+nginx-mod-http-geoip_package() {
+	short_desc+=" - HTTP GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_geoip_module.so
+	}
+}
+
+nginx-mod-http-xslt-filter_package() {
+	short_desc+=" - XSLT filter module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_xslt_filter_module.so
+	}
+}
+
+nginx-mod-stream_package() {
+	short_desc+=" - Stream module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_module.so
+	}
+}
+
+nginx-mod-stream-geoip_package() {
+	short_desc+=" - Stream GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_geoip_module.so
+	}
+}

From 2b206f9ea7b7009ef71c5653c41da43378f31c45 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Sat, 1 Oct 2022 14:47:15 +0200
Subject: [PATCH 2/3] nginx: add njs modules.

---
 srcpkgs/nginx-mod-http-js                     |   1 +
 srcpkgs/nginx-mod-stream-js                   |   1 +
 srcpkgs/nginx/INSTALL.msg                     |   7 +
 srcpkgs/nginx/files/njs_auto_config.h.aarch64 | 163 ++++++++++++++++++
 srcpkgs/nginx/files/njs_auto_config.h.armv6l  | 158 +++++++++++++++++
 srcpkgs/nginx/template                        |  59 +++++--
 6 files changed, 377 insertions(+), 12 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-js
 create mode 120000 srcpkgs/nginx-mod-stream-js
 create mode 100644 srcpkgs/nginx/INSTALL.msg
 create mode 100644 srcpkgs/nginx/files/njs_auto_config.h.aarch64
 create mode 100644 srcpkgs/nginx/files/njs_auto_config.h.armv6l

diff --git a/srcpkgs/nginx-mod-http-js b/srcpkgs/nginx-mod-http-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-js b/srcpkgs/nginx-mod-stream-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/INSTALL.msg b/srcpkgs/nginx/INSTALL.msg
new file mode 100644
index 000000000000..9505dd5607a2
--- /dev/null
+++ b/srcpkgs/nginx/INSTALL.msg
@@ -0,0 +1,7 @@
+nginx has been converted to use dynamic modules.
+
+If you used the stream or geoip modules before, you now need
+to install nginx-mod-$MODULE and add this to the main context of nginx.conf:
+
+  load_module modules/ngx_$MODULE_module.so;
+
diff --git a/srcpkgs/nginx/files/njs_auto_config.h.aarch64 b/srcpkgs/nginx/files/njs_auto_config.h.aarch64
new file mode 100644
index 000000000000..c4f62854ce53
--- /dev/null
+++ b/srcpkgs/nginx/files/njs_auto_config.h.aarch64
@@ -0,0 +1,163 @@
+
+/* This file is auto-generated by configure */
+
+
+#ifndef NJS_LINUX
+#define NJS_LINUX  1
+#endif
+
+
+#ifndef NJS_GCC
+#define NJS_GCC  1
+#endif
+
+
+#ifndef NJS_TEST262
+#define NJS_TEST262  1
+#endif
+
+
+#ifndef NJS_INT_SIZE
+#define NJS_INT_SIZE  4
+#endif
+
+
+#ifndef NJS_UINT_SIZE
+#define NJS_UINT_SIZE  4
+#endif
+
+
+#ifndef NJS_PTR_SIZE
+#define NJS_PTR_SIZE  8
+#endif
+
+
+#ifndef NJS_UINTPTR_T_SIZE
+#define NJS_UINTPTR_T_SIZE  8
+#endif
+
+
+#ifndef NJS_SIZE_T_SIZE
+#define NJS_SIZE_T_SIZE  8
+#endif
+
+
+#ifndef NJS_OFF_T_SIZE
+#define NJS_OFF_T_SIZE  8
+#endif
+
+
+#ifndef NJS_TIME_T_SIZE
+#define NJS_TIME_T_SIZE  8
+#endif
+
+
+#ifndef NJS_BYTE_ORDER
+#define NJS_BYTE_ORDER  little
+#endif
+
+
+#ifndef NJS_HAVE_LITTLE_ENDIAN
+#define NJS_HAVE_LITTLE_ENDIAN  1
+#endif
+
+
+#ifndef NJS_HAVE_UNSIGNED_INT128
+#define NJS_HAVE_UNSIGNED_INT128  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_EXPECT
+#define NJS_HAVE_BUILTIN_EXPECT  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_UNREACHABLE
+#define NJS_HAVE_BUILTIN_UNREACHABLE  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_PREFETCH
+#define NJS_HAVE_BUILTIN_PREFETCH  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZ
+#define NJS_HAVE_BUILTIN_CLZ  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZLL
+#define NJS_HAVE_BUILTIN_CLZLL  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY
+#define NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_MALLOC
+#define NJS_HAVE_GCC_ATTRIBUTE_MALLOC  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_ALIGNED
+#define NJS_HAVE_GCC_ATTRIBUTE_ALIGNED  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_PACKED
+#define NJS_HAVE_GCC_ATTRIBUTE_PACKED  1
+#endif
+
+
+#ifndef NJS_HAVE_CLOCK_MONOTONIC
+#define NJS_HAVE_CLOCK_MONOTONIC  1
+#endif
+
+
+#ifndef NJS_HAVE_TM_GMTOFF
+#define NJS_HAVE_TM_GMTOFF  1
+#endif
+
+
+#ifndef NJS_HAVE_POSIX_MEMALIGN
+#define NJS_HAVE_POSIX_MEMALIGN  1
+#endif
+
+
+#ifndef NJS_HAVE_GETRANDOM
+#define NJS_HAVE_GETRANDOM  1
+#endif
+
+
+#ifndef NJS_HAVE_STAT_ATIM
+#define NJS_HAVE_STAT_ATIM  1
+#endif
+
+
+#ifndef NJS_HAVE_EXPLICIT_BZERO
+#define NJS_HAVE_EXPLICIT_BZERO  1
+#endif
+
+
+#ifndef NJS_HAVE_PCRE2
+#define NJS_HAVE_PCRE2  1
+#endif
+
+
+#ifndef NJS_PCRE2_VERSION
+#define NJS_PCRE2_VERSION  10.39
+#endif
+
+
+#ifndef NJS_HAVE_OPENSSL
+#define NJS_HAVE_OPENSSL  1
+#endif
+
+
+#ifndef NJS_OPENSSL_VERSION
+#define NJS_OPENSSL_VERSION  "OpenSSL 1.1.1q  5 Jul 2022"
+#endif
+
diff --git a/srcpkgs/nginx/files/njs_auto_config.h.armv6l b/srcpkgs/nginx/files/njs_auto_config.h.armv6l
new file mode 100644
index 000000000000..f322c69b4544
--- /dev/null
+++ b/srcpkgs/nginx/files/njs_auto_config.h.armv6l
@@ -0,0 +1,158 @@
+
+/* This file is auto-generated by configure */
+
+
+#ifndef NJS_LINUX
+#define NJS_LINUX  1
+#endif
+
+
+#ifndef NJS_GCC
+#define NJS_GCC  1
+#endif
+
+
+#ifndef NJS_TEST262
+#define NJS_TEST262  1
+#endif
+
+
+#ifndef NJS_INT_SIZE
+#define NJS_INT_SIZE  4
+#endif
+
+
+#ifndef NJS_UINT_SIZE
+#define NJS_UINT_SIZE  4
+#endif
+
+
+#ifndef NJS_PTR_SIZE
+#define NJS_PTR_SIZE  4
+#endif
+
+
+#ifndef NJS_UINTPTR_T_SIZE
+#define NJS_UINTPTR_T_SIZE  4
+#endif
+
+
+#ifndef NJS_SIZE_T_SIZE
+#define NJS_SIZE_T_SIZE  4
+#endif
+
+
+#ifndef NJS_OFF_T_SIZE
+#define NJS_OFF_T_SIZE  8
+#endif
+
+
+#ifndef NJS_TIME_T_SIZE
+#define NJS_TIME_T_SIZE  4
+#endif
+
+
+#ifndef NJS_BYTE_ORDER
+#define NJS_BYTE_ORDER  little
+#endif
+
+
+#ifndef NJS_HAVE_LITTLE_ENDIAN
+#define NJS_HAVE_LITTLE_ENDIAN  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_EXPECT
+#define NJS_HAVE_BUILTIN_EXPECT  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_UNREACHABLE
+#define NJS_HAVE_BUILTIN_UNREACHABLE  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_PREFETCH
+#define NJS_HAVE_BUILTIN_PREFETCH  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZ
+#define NJS_HAVE_BUILTIN_CLZ  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZLL
+#define NJS_HAVE_BUILTIN_CLZLL  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY
+#define NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_MALLOC
+#define NJS_HAVE_GCC_ATTRIBUTE_MALLOC  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_ALIGNED
+#define NJS_HAVE_GCC_ATTRIBUTE_ALIGNED  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_PACKED
+#define NJS_HAVE_GCC_ATTRIBUTE_PACKED  1
+#endif
+
+
+#ifndef NJS_HAVE_CLOCK_MONOTONIC
+#define NJS_HAVE_CLOCK_MONOTONIC  1
+#endif
+
+
+#ifndef NJS_HAVE_TM_GMTOFF
+#define NJS_HAVE_TM_GMTOFF  1
+#endif
+
+
+#ifndef NJS_HAVE_POSIX_MEMALIGN
+#define NJS_HAVE_POSIX_MEMALIGN  1
+#endif
+
+
+#ifndef NJS_HAVE_GETRANDOM
+#define NJS_HAVE_GETRANDOM  1
+#endif
+
+
+#ifndef NJS_HAVE_STAT_ATIM
+#define NJS_HAVE_STAT_ATIM  1
+#endif
+
+
+#ifndef NJS_HAVE_EXPLICIT_BZERO
+#define NJS_HAVE_EXPLICIT_BZERO  1
+#endif
+
+
+#ifndef NJS_HAVE_PCRE2
+#define NJS_HAVE_PCRE2  1
+#endif
+
+
+#ifndef NJS_PCRE2_VERSION
+#define NJS_PCRE2_VERSION  10.39
+#endif
+
+
+#ifndef NJS_HAVE_OPENSSL
+#define NJS_HAVE_OPENSSL  1
+#endif
+
+
+#ifndef NJS_OPENSSL_VERSION
+#define NJS_OPENSSL_VERSION  "OpenSSL 1.1.1q  5 Jul 2022"
+#endif
+
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 1a6142d49fc3..2b1d472d7a8f 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,8 +1,9 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=1
+revision=2
 _tests_commit=18ac4d9e5a2a
+_njs_version=0.7.7
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
@@ -18,11 +19,11 @@ configure_args="--prefix=${_cfgdir} \
  --group=nginx \
  --http-log-path=/var/log/nginx/access.log \
  --error-log-path=/var/log/nginx/error.log \
- --http-client-body-temp-path=${tmpdir}/client-body \
- --http-proxy-temp-path=${tmpdir}/proxy \
- --http-fastcgi-temp-path=${tmpdir}/fastcgi \
- --http-scgi-temp-path=${tmpdir}/scgi \
- --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --http-client-body-temp-path=${_tmpdir}/client-body \
+ --http-proxy-temp-path=${_tmpdir}/proxy \
+ --http-fastcgi-temp-path=${_tmpdir}/fastcgi \
+ --http-scgi-temp-path=${_tmpdir}/scgi \
+ --http-uwsgi-temp-path=${_tmpdir}/uwsgi \
  --with-compat \
  --with-file-aio \
  --with-http_dav_module \
@@ -44,8 +45,10 @@ configure_args="--prefix=${_cfgdir} \
  --with-mail \
  --with-mail_ssl_module \
  --with-pcre-jit \
- --with-threads"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
+ --with-threads
+ --add-dynamic-module=../njs-${_njs_version}/nginx"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+ which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -53,9 +56,11 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
 license="BSD-2-Clause"
 homepage="https://nginx.org"
 distfiles="https://nginx.org/download/nginx-${version}.tar.gz
- https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz"
+ https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz
+ https://hg.nginx.org/njs/archive/${_njs_version}.tar.gz"
 checksum="b33d569a6f11a01433a57ce17e83935e953ad4dc77cdd4d40f896c88ac26eb53
- e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228"
+ e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228
+ 4dac9cbf071e5a7dfe135b4d87e20112d207fcbf5fb620854af8dab44ec3e7bd"
 # Tests fail when nginx run as root and there is no nginx user
 make_check=ci-skip
 
@@ -85,19 +90,33 @@ do_configure() {
 	fi
 
 	./configure ${configure_args}
+	( cd ../njs-${_njs_version} && ./configure )
 }
 
 pre_build() {
 	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ../njs-${_njs_version}/build
 		case "$XBPS_TARGET_MACHINE" in
-			arm*) cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h;;
-			aarch64*) cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h;;
+		arm*)
+			cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.armv6l" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
+		aarch64*)
+			cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
 		esac
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
 
 	export LD="$CC"
+
+	(
+		cd ../njs-${_njs_version}
+		make ${makejobs} NJS_CC="$CC" NJS_CFLAGS="$CFLAGS -fPIC" \
+			NJS_STATIC_LINK="$AR -r -c" NJS_LINK="$CC -O"
+	)
 }
 
 do_check() {
@@ -129,6 +148,14 @@ nginx-mod-http-geoip_package() {
 	}
 }
 
+nginx-mod-http-js_package() {
+	short_desc+=" - HTTP njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_js_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"
@@ -145,6 +172,14 @@ nginx-mod-stream_package() {
 	}
 }
 
+nginx-mod-stream-js_package() {
+	short_desc+=" - Stream njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_js_module.so
+	}
+}
+
 nginx-mod-stream-geoip_package() {
 	short_desc+=" - Stream GeoIP module"
 	depends="${sourcepkg}>=${version}_${revision}"

From 8bc1d5237e46fdb7335bb6260458a02e10d94421 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 4 Oct 2022 13:34:08 +0200
Subject: [PATCH 3/3] nginx: enable perl module.

---
 srcpkgs/nginx/files/ngx_auto_config.h.aarch64 | 22 ++++++++++++++-----
 srcpkgs/nginx/files/ngx_auto_config.h.armv6l  | 22 ++++++++++++++-----
 srcpkgs/nginx/template                        | 15 +++++++++++--
 3 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/srcpkgs/nginx/files/ngx_auto_config.h.aarch64 b/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
index 7dd53d712857..809e031b2000 100644
--- a/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
+++ b/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
@@ -1,4 +1,4 @@
-#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/tmp/nginx/client-body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --with-http_geoip_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module --with-http_slice_module"
+#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --modules-path=/usr/lib/nginx/modules --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/tmp/client-body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --add-dynamic-module=../njs-0.7.7/nginx"
 
 #ifndef NGX_HAVE_GCC_ATOMIC
 #define NGX_HAVE_GCC_ATOMIC  1
@@ -528,6 +528,16 @@
 #endif
 
 
+#ifndef NGX_HAVE_EXSLT
+#define NGX_HAVE_EXSLT  1
+#endif
+
+
+#ifndef NGX_HAVE_PERL_MULTIPLICITY
+#define NGX_HAVE_PERL_MULTIPLICITY  1
+#endif
+
+
 #ifndef NGX_HAVE_GEOIP_V6
 #define NGX_HAVE_GEOIP_V6  1
 #endif
@@ -574,27 +584,27 @@
 
 
 #ifndef NGX_HTTP_CLIENT_TEMP_PATH
-#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/tmp/nginx/client-body"
+#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/lib/nginx/tmp/client-body"
 #endif
 
 
 #ifndef NGX_HTTP_PROXY_TEMP_PATH
-#define NGX_HTTP_PROXY_TEMP_PATH  "/var/tmp/nginx/proxy"
+#define NGX_HTTP_PROXY_TEMP_PATH  "/var/lib/nginx/tmp/proxy"
 #endif
 
 
 #ifndef NGX_HTTP_FASTCGI_TEMP_PATH
-#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/tmp/nginx/fastcgi"
+#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/lib/nginx/tmp/fastcgi"
 #endif
 
 
 #ifndef NGX_HTTP_UWSGI_TEMP_PATH
-#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/tmp/nginx/uwsgi"
+#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/lib/nginx/tmp/uwsgi"
 #endif
 
 
 #ifndef NGX_HTTP_SCGI_TEMP_PATH
-#define NGX_HTTP_SCGI_TEMP_PATH  "/var/tmp/nginx/scgi"
+#define NGX_HTTP_SCGI_TEMP_PATH  "/var/lib/nginx/tmp/scgi"
 #endif
 
 
diff --git a/srcpkgs/nginx/files/ngx_auto_config.h.armv6l b/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
index 5b32a6948ce3..df88ec2e35ac 100644
--- a/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
+++ b/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
@@ -1,4 +1,4 @@
-#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/tmp/nginx/client-body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --with-http_geoip_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module --with-http_slice_module"
+#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --modules-path=/usr/lib/nginx/modules --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/tmp/client-body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --add-dynamic-module=../njs-0.7.7/nginx"
 
 #ifndef NGX_HAVE_GCC_ATOMIC
 #define NGX_HAVE_GCC_ATOMIC  1
@@ -528,6 +528,16 @@
 #endif
 
 
+#ifndef NGX_HAVE_EXSLT
+#define NGX_HAVE_EXSLT  1
+#endif
+
+
+#ifndef NGX_HAVE_PERL_MULTIPLICITY
+#define NGX_HAVE_PERL_MULTIPLICITY  1
+#endif
+
+
 #ifndef NGX_HAVE_GEOIP_V6
 #define NGX_HAVE_GEOIP_V6  1
 #endif
@@ -574,27 +584,27 @@
 
 
 #ifndef NGX_HTTP_CLIENT_TEMP_PATH
-#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/tmp/nginx/client-body"
+#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/lib/nginx/tmp/client-body"
 #endif
 
 
 #ifndef NGX_HTTP_PROXY_TEMP_PATH
-#define NGX_HTTP_PROXY_TEMP_PATH  "/var/tmp/nginx/proxy"
+#define NGX_HTTP_PROXY_TEMP_PATH  "/var/lib/nginx/tmp/proxy"
 #endif
 
 
 #ifndef NGX_HTTP_FASTCGI_TEMP_PATH
-#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/tmp/nginx/fastcgi"
+#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/lib/nginx/tmp/fastcgi"
 #endif
 
 
 #ifndef NGX_HTTP_UWSGI_TEMP_PATH
-#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/tmp/nginx/uwsgi"
+#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/lib/nginx/tmp/uwsgi"
 #endif
 
 
 #ifndef NGX_HTTP_SCGI_TEMP_PATH
-#define NGX_HTTP_SCGI_TEMP_PATH  "/var/tmp/nginx/scgi"
+#define NGX_HTTP_SCGI_TEMP_PATH  "/var/lib/nginx/tmp/scgi"
 #endif
 
 
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 2b1d472d7a8f..8107afd0f3e0 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,7 +1,7 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=2
+revision=3
 _tests_commit=18ac4d9e5a2a
 _njs_version=0.7.7
 create_wrksrc=yes
@@ -37,6 +37,7 @@ configure_args="--prefix=${_cfgdir} \
  --with-http_v2_module \
  --with-http_xslt_module=dynamic \
  --with-http_geoip_module=dynamic \
+ --with-http_perl_module=dynamic \
  --with-stream=dynamic \
  --with-stream_geoip_module=dynamic \
  --with-stream_realip_module \
@@ -47,7 +48,7 @@ configure_args="--prefix=${_cfgdir} \
  --with-pcre-jit \
  --with-threads
  --add-dynamic-module=../njs-${_njs_version}/nginx"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel perl libxslt-devel
  which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
@@ -106,6 +107,8 @@ pre_build() {
 			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
 			;;
 		esac
+
+		sed -i "s:-I/usr:-I${XBPS_CROSS_BASE}/usr:" objs/Makefile
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
@@ -156,6 +159,14 @@ nginx-mod-http-js_package() {
 	}
 }
 
+nginx-mod-http-perl_package() {
+	short_desc+=" - Perl module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_perl_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR PATCH] [Updated] nginx: use dynamic modules instead of options, add njs.
  2022-10-01 13:32 [PR PATCH] nginx: use dynamic modules instead of options, add njs leahneukirchen
  2022-10-04 11:53 ` [PR PATCH] [Updated] " leahneukirchen
  2022-10-04 12:38 ` leahneukirchen
@ 2022-10-04 19:20 ` leahneukirchen
  2022-10-07  9:13 ` leahneukirchen
  2022-10-26 12:50 ` [PR PATCH] [Merged]: " leahneukirchen
  4 siblings, 0 replies; 6+ messages in thread
From: leahneukirchen @ 2022-10-04 19:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

There is an updated pull request by leahneukirchen against master on the void-packages repository

https://github.com/leahneukirchen/void-packages dynamic-nginx
https://github.com/void-linux/void-packages/pull/39584

nginx: use dynamic modules instead of options, add njs.


#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**


A patch file from https://github.com/void-linux/void-packages/pull/39584.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dynamic-nginx-39584.patch --]
[-- Type: text/x-diff, Size: 27527 bytes --]

From 4a3bc264190c2733a5bd4f0c8dc8e230dfe64331 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Fri, 30 Sep 2022 17:44:55 +0200
Subject: [PATCH 1/3] nginx: use dynamic modules instead of options, put them
 into subpackages.

- move tmp paths and homedir to /var/lib/nginx to ensure they keep existing
- use configure_args for consistency
---
 srcpkgs/nginx-mod-http-geoip       |   1 +
 srcpkgs/nginx-mod-http-xslt-filter |   1 +
 srcpkgs/nginx-mod-stream           |   1 +
 srcpkgs/nginx-mod-stream-geoip     |   1 +
 srcpkgs/nginx/template             | 129 +++++++++++++++++------------
 5 files changed, 82 insertions(+), 51 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-geoip
 create mode 120000 srcpkgs/nginx-mod-http-xslt-filter
 create mode 120000 srcpkgs/nginx-mod-stream
 create mode 120000 srcpkgs/nginx-mod-stream-geoip

diff --git a/srcpkgs/nginx-mod-http-geoip b/srcpkgs/nginx-mod-http-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-http-xslt-filter b/srcpkgs/nginx-mod-http-xslt-filter
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-xslt-filter
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream b/srcpkgs/nginx-mod-stream
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-geoip b/srcpkgs/nginx-mod-stream-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index a4324dd75df8..1a6142d49fc3 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -6,7 +6,46 @@ _tests_commit=18ac4d9e5a2a
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
-hostmakedepends="openssl-devel pcre2-devel $(vopt_if geoip geoip-devel)"
+_cfgdir=/etc/nginx
+_tmpdir=/var/lib/nginx/tmp
+configure_args="--prefix=${_cfgdir} \
+ --conf-path=${_cfgdir}/nginx.conf \
+ --sbin-path=/usr/bin/nginx \
+ --modules-path=/usr/lib/nginx/modules \
+ --pid-path=/run/nginx.pid \
+ --lock-path=/var/lock/nginx.lock \
+ --user=nginx \
+ --group=nginx \
+ --http-log-path=/var/log/nginx/access.log \
+ --error-log-path=/var/log/nginx/error.log \
+ --http-client-body-temp-path=${tmpdir}/client-body \
+ --http-proxy-temp-path=${tmpdir}/proxy \
+ --http-fastcgi-temp-path=${tmpdir}/fastcgi \
+ --http-scgi-temp-path=${tmpdir}/scgi \
+ --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --with-compat \
+ --with-file-aio \
+ --with-http_dav_module \
+ --with-http_gunzip_module \
+ --with-http_gzip_static_module \
+ --with-http_realip_module \
+ --with-http_ssl_module \
+ --with-http_slice_module \
+ --with-http_stub_status_module \
+ --with-http_sub_module \
+ --with-http_v2_module \
+ --with-http_xslt_module=dynamic \
+ --with-http_geoip_module=dynamic \
+ --with-stream=dynamic \
+ --with-stream_geoip_module=dynamic \
+ --with-stream_realip_module \
+ --with-stream_ssl_module \
+ --with-stream_ssl_preread_module \
+ --with-mail \
+ --with-mail_ssl_module \
+ --with-pcre-jit \
+ --with-threads"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -34,64 +73,18 @@ conf_files="/etc/nginx/fastcgi.conf
  /etc/nginx/uwsgi_params
  /etc/nginx/win-utf"
 system_accounts="nginx"
-nginx_homedir="/var/tmp/nginx"
+nginx_homedir="/var/lib/nginx"
 make_dirs="/var/log/nginx 0750 root root
- /var/tmp 1777 root root
- /var/tmp/nginx 0750 nginx root"
-
-build_options="geoip stream slice"
-desc_option_stream="Enable support for stream proxies"
-desc_option_slice="Enable support for slice filters"
-build_options_default="geoip stream slice"
+ /var/lib/nginx 1777 root root
+ /var/lib/nginx/tmp 0750 nginx root"
 
 do_configure() {
-	local cfgdir=/etc/nginx
-	local tmpdir=/var/tmp/nginx
-
 	if [ "$CROSS_BUILD" ]; then
 		# fake configure run on host
 		unset CC CPP LD CFLAGS CPPFLAGS LDFLAGS
 	fi
 
-	local stream_modules="\
-		--with-stream \
-		--with-stream_realip_module \
-		--with-stream_ssl_module \
-		--with-stream_ssl_preread_module \
-		$(vopt_if geoip --with-stream_geoip_module) \
-	"
-
-	./configure --prefix=${cfgdir} \
-		--conf-path=${cfgdir}/nginx.conf \
-		--sbin-path=/usr/bin/nginx \
-		--pid-path=/run/nginx.pid \
-		--lock-path=/var/lock/nginx.lock \
-		--user=nginx --group=nginx \
-		--http-log-path=/var/log/nginx/access.log \
-		--error-log-path=/var/log/nginx/error.log \
-		--http-client-body-temp-path=${tmpdir}/client-body \
-		--http-proxy-temp-path=${tmpdir}/proxy \
-		--http-fastcgi-temp-path=${tmpdir}/fastcgi \
-		--http-scgi-temp-path=${tmpdir}/scgi \
-		--http-uwsgi-temp-path=${tmpdir}/uwsgi \
-		--with-compat \
-		--with-file-aio \
-		--with-http_dav_module \
-		--with-http_gunzip_module \
-		--with-http_gzip_static_module \
-		--with-http_realip_module \
-		--with-http_ssl_module \
-		--with-http_stub_status_module \
-		--with-http_sub_module \
-		--with-http_v2_module \
-		--with-mail \
-		--with-mail_ssl_module \
-		--with-pcre-jit \
-		--with-threads \
-		$(vopt_if geoip --with-http_geoip_module) \
-		$(vopt_if stream "$stream_modules") \
-		$(vopt_if slice --with-http_slice_module)
-
+	./configure ${configure_args}
 }
 
 pre_build() {
@@ -103,6 +96,8 @@ pre_build() {
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
+
+	export LD="$CC"
 }
 
 do_check() {
@@ -125,3 +120,35 @@ post_install() {
 	vlicense LICENSE
 	vsv nginx
 }
+
+nginx-mod-http-geoip_package() {
+	short_desc+=" - HTTP GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_geoip_module.so
+	}
+}
+
+nginx-mod-http-xslt-filter_package() {
+	short_desc+=" - XSLT filter module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_xslt_filter_module.so
+	}
+}
+
+nginx-mod-stream_package() {
+	short_desc+=" - Stream module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_module.so
+	}
+}
+
+nginx-mod-stream-geoip_package() {
+	short_desc+=" - Stream GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_geoip_module.so
+	}
+}

From 2b206f9ea7b7009ef71c5653c41da43378f31c45 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Sat, 1 Oct 2022 14:47:15 +0200
Subject: [PATCH 2/3] nginx: add njs modules.

---
 srcpkgs/nginx-mod-http-js                     |   1 +
 srcpkgs/nginx-mod-stream-js                   |   1 +
 srcpkgs/nginx/INSTALL.msg                     |   7 +
 srcpkgs/nginx/files/njs_auto_config.h.aarch64 | 163 ++++++++++++++++++
 srcpkgs/nginx/files/njs_auto_config.h.armv6l  | 158 +++++++++++++++++
 srcpkgs/nginx/template                        |  59 +++++--
 6 files changed, 377 insertions(+), 12 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-js
 create mode 120000 srcpkgs/nginx-mod-stream-js
 create mode 100644 srcpkgs/nginx/INSTALL.msg
 create mode 100644 srcpkgs/nginx/files/njs_auto_config.h.aarch64
 create mode 100644 srcpkgs/nginx/files/njs_auto_config.h.armv6l

diff --git a/srcpkgs/nginx-mod-http-js b/srcpkgs/nginx-mod-http-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-js b/srcpkgs/nginx-mod-stream-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/INSTALL.msg b/srcpkgs/nginx/INSTALL.msg
new file mode 100644
index 000000000000..9505dd5607a2
--- /dev/null
+++ b/srcpkgs/nginx/INSTALL.msg
@@ -0,0 +1,7 @@
+nginx has been converted to use dynamic modules.
+
+If you used the stream or geoip modules before, you now need
+to install nginx-mod-$MODULE and add this to the main context of nginx.conf:
+
+  load_module modules/ngx_$MODULE_module.so;
+
diff --git a/srcpkgs/nginx/files/njs_auto_config.h.aarch64 b/srcpkgs/nginx/files/njs_auto_config.h.aarch64
new file mode 100644
index 000000000000..c4f62854ce53
--- /dev/null
+++ b/srcpkgs/nginx/files/njs_auto_config.h.aarch64
@@ -0,0 +1,163 @@
+
+/* This file is auto-generated by configure */
+
+
+#ifndef NJS_LINUX
+#define NJS_LINUX  1
+#endif
+
+
+#ifndef NJS_GCC
+#define NJS_GCC  1
+#endif
+
+
+#ifndef NJS_TEST262
+#define NJS_TEST262  1
+#endif
+
+
+#ifndef NJS_INT_SIZE
+#define NJS_INT_SIZE  4
+#endif
+
+
+#ifndef NJS_UINT_SIZE
+#define NJS_UINT_SIZE  4
+#endif
+
+
+#ifndef NJS_PTR_SIZE
+#define NJS_PTR_SIZE  8
+#endif
+
+
+#ifndef NJS_UINTPTR_T_SIZE
+#define NJS_UINTPTR_T_SIZE  8
+#endif
+
+
+#ifndef NJS_SIZE_T_SIZE
+#define NJS_SIZE_T_SIZE  8
+#endif
+
+
+#ifndef NJS_OFF_T_SIZE
+#define NJS_OFF_T_SIZE  8
+#endif
+
+
+#ifndef NJS_TIME_T_SIZE
+#define NJS_TIME_T_SIZE  8
+#endif
+
+
+#ifndef NJS_BYTE_ORDER
+#define NJS_BYTE_ORDER  little
+#endif
+
+
+#ifndef NJS_HAVE_LITTLE_ENDIAN
+#define NJS_HAVE_LITTLE_ENDIAN  1
+#endif
+
+
+#ifndef NJS_HAVE_UNSIGNED_INT128
+#define NJS_HAVE_UNSIGNED_INT128  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_EXPECT
+#define NJS_HAVE_BUILTIN_EXPECT  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_UNREACHABLE
+#define NJS_HAVE_BUILTIN_UNREACHABLE  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_PREFETCH
+#define NJS_HAVE_BUILTIN_PREFETCH  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZ
+#define NJS_HAVE_BUILTIN_CLZ  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZLL
+#define NJS_HAVE_BUILTIN_CLZLL  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY
+#define NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_MALLOC
+#define NJS_HAVE_GCC_ATTRIBUTE_MALLOC  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_ALIGNED
+#define NJS_HAVE_GCC_ATTRIBUTE_ALIGNED  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_PACKED
+#define NJS_HAVE_GCC_ATTRIBUTE_PACKED  1
+#endif
+
+
+#ifndef NJS_HAVE_CLOCK_MONOTONIC
+#define NJS_HAVE_CLOCK_MONOTONIC  1
+#endif
+
+
+#ifndef NJS_HAVE_TM_GMTOFF
+#define NJS_HAVE_TM_GMTOFF  1
+#endif
+
+
+#ifndef NJS_HAVE_POSIX_MEMALIGN
+#define NJS_HAVE_POSIX_MEMALIGN  1
+#endif
+
+
+#ifndef NJS_HAVE_GETRANDOM
+#define NJS_HAVE_GETRANDOM  1
+#endif
+
+
+#ifndef NJS_HAVE_STAT_ATIM
+#define NJS_HAVE_STAT_ATIM  1
+#endif
+
+
+#ifndef NJS_HAVE_EXPLICIT_BZERO
+#define NJS_HAVE_EXPLICIT_BZERO  1
+#endif
+
+
+#ifndef NJS_HAVE_PCRE2
+#define NJS_HAVE_PCRE2  1
+#endif
+
+
+#ifndef NJS_PCRE2_VERSION
+#define NJS_PCRE2_VERSION  10.39
+#endif
+
+
+#ifndef NJS_HAVE_OPENSSL
+#define NJS_HAVE_OPENSSL  1
+#endif
+
+
+#ifndef NJS_OPENSSL_VERSION
+#define NJS_OPENSSL_VERSION  "OpenSSL 1.1.1q  5 Jul 2022"
+#endif
+
diff --git a/srcpkgs/nginx/files/njs_auto_config.h.armv6l b/srcpkgs/nginx/files/njs_auto_config.h.armv6l
new file mode 100644
index 000000000000..f322c69b4544
--- /dev/null
+++ b/srcpkgs/nginx/files/njs_auto_config.h.armv6l
@@ -0,0 +1,158 @@
+
+/* This file is auto-generated by configure */
+
+
+#ifndef NJS_LINUX
+#define NJS_LINUX  1
+#endif
+
+
+#ifndef NJS_GCC
+#define NJS_GCC  1
+#endif
+
+
+#ifndef NJS_TEST262
+#define NJS_TEST262  1
+#endif
+
+
+#ifndef NJS_INT_SIZE
+#define NJS_INT_SIZE  4
+#endif
+
+
+#ifndef NJS_UINT_SIZE
+#define NJS_UINT_SIZE  4
+#endif
+
+
+#ifndef NJS_PTR_SIZE
+#define NJS_PTR_SIZE  4
+#endif
+
+
+#ifndef NJS_UINTPTR_T_SIZE
+#define NJS_UINTPTR_T_SIZE  4
+#endif
+
+
+#ifndef NJS_SIZE_T_SIZE
+#define NJS_SIZE_T_SIZE  4
+#endif
+
+
+#ifndef NJS_OFF_T_SIZE
+#define NJS_OFF_T_SIZE  8
+#endif
+
+
+#ifndef NJS_TIME_T_SIZE
+#define NJS_TIME_T_SIZE  4
+#endif
+
+
+#ifndef NJS_BYTE_ORDER
+#define NJS_BYTE_ORDER  little
+#endif
+
+
+#ifndef NJS_HAVE_LITTLE_ENDIAN
+#define NJS_HAVE_LITTLE_ENDIAN  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_EXPECT
+#define NJS_HAVE_BUILTIN_EXPECT  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_UNREACHABLE
+#define NJS_HAVE_BUILTIN_UNREACHABLE  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_PREFETCH
+#define NJS_HAVE_BUILTIN_PREFETCH  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZ
+#define NJS_HAVE_BUILTIN_CLZ  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZLL
+#define NJS_HAVE_BUILTIN_CLZLL  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY
+#define NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_MALLOC
+#define NJS_HAVE_GCC_ATTRIBUTE_MALLOC  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_ALIGNED
+#define NJS_HAVE_GCC_ATTRIBUTE_ALIGNED  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_PACKED
+#define NJS_HAVE_GCC_ATTRIBUTE_PACKED  1
+#endif
+
+
+#ifndef NJS_HAVE_CLOCK_MONOTONIC
+#define NJS_HAVE_CLOCK_MONOTONIC  1
+#endif
+
+
+#ifndef NJS_HAVE_TM_GMTOFF
+#define NJS_HAVE_TM_GMTOFF  1
+#endif
+
+
+#ifndef NJS_HAVE_POSIX_MEMALIGN
+#define NJS_HAVE_POSIX_MEMALIGN  1
+#endif
+
+
+#ifndef NJS_HAVE_GETRANDOM
+#define NJS_HAVE_GETRANDOM  1
+#endif
+
+
+#ifndef NJS_HAVE_STAT_ATIM
+#define NJS_HAVE_STAT_ATIM  1
+#endif
+
+
+#ifndef NJS_HAVE_EXPLICIT_BZERO
+#define NJS_HAVE_EXPLICIT_BZERO  1
+#endif
+
+
+#ifndef NJS_HAVE_PCRE2
+#define NJS_HAVE_PCRE2  1
+#endif
+
+
+#ifndef NJS_PCRE2_VERSION
+#define NJS_PCRE2_VERSION  10.39
+#endif
+
+
+#ifndef NJS_HAVE_OPENSSL
+#define NJS_HAVE_OPENSSL  1
+#endif
+
+
+#ifndef NJS_OPENSSL_VERSION
+#define NJS_OPENSSL_VERSION  "OpenSSL 1.1.1q  5 Jul 2022"
+#endif
+
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 1a6142d49fc3..2b1d472d7a8f 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,8 +1,9 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=1
+revision=2
 _tests_commit=18ac4d9e5a2a
+_njs_version=0.7.7
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
@@ -18,11 +19,11 @@ configure_args="--prefix=${_cfgdir} \
  --group=nginx \
  --http-log-path=/var/log/nginx/access.log \
  --error-log-path=/var/log/nginx/error.log \
- --http-client-body-temp-path=${tmpdir}/client-body \
- --http-proxy-temp-path=${tmpdir}/proxy \
- --http-fastcgi-temp-path=${tmpdir}/fastcgi \
- --http-scgi-temp-path=${tmpdir}/scgi \
- --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --http-client-body-temp-path=${_tmpdir}/client-body \
+ --http-proxy-temp-path=${_tmpdir}/proxy \
+ --http-fastcgi-temp-path=${_tmpdir}/fastcgi \
+ --http-scgi-temp-path=${_tmpdir}/scgi \
+ --http-uwsgi-temp-path=${_tmpdir}/uwsgi \
  --with-compat \
  --with-file-aio \
  --with-http_dav_module \
@@ -44,8 +45,10 @@ configure_args="--prefix=${_cfgdir} \
  --with-mail \
  --with-mail_ssl_module \
  --with-pcre-jit \
- --with-threads"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
+ --with-threads
+ --add-dynamic-module=../njs-${_njs_version}/nginx"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+ which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -53,9 +56,11 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
 license="BSD-2-Clause"
 homepage="https://nginx.org"
 distfiles="https://nginx.org/download/nginx-${version}.tar.gz
- https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz"
+ https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz
+ https://hg.nginx.org/njs/archive/${_njs_version}.tar.gz"
 checksum="b33d569a6f11a01433a57ce17e83935e953ad4dc77cdd4d40f896c88ac26eb53
- e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228"
+ e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228
+ 4dac9cbf071e5a7dfe135b4d87e20112d207fcbf5fb620854af8dab44ec3e7bd"
 # Tests fail when nginx run as root and there is no nginx user
 make_check=ci-skip
 
@@ -85,19 +90,33 @@ do_configure() {
 	fi
 
 	./configure ${configure_args}
+	( cd ../njs-${_njs_version} && ./configure )
 }
 
 pre_build() {
 	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ../njs-${_njs_version}/build
 		case "$XBPS_TARGET_MACHINE" in
-			arm*) cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h;;
-			aarch64*) cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h;;
+		arm*)
+			cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.armv6l" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
+		aarch64*)
+			cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
 		esac
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
 
 	export LD="$CC"
+
+	(
+		cd ../njs-${_njs_version}
+		make ${makejobs} NJS_CC="$CC" NJS_CFLAGS="$CFLAGS -fPIC" \
+			NJS_STATIC_LINK="$AR -r -c" NJS_LINK="$CC -O"
+	)
 }
 
 do_check() {
@@ -129,6 +148,14 @@ nginx-mod-http-geoip_package() {
 	}
 }
 
+nginx-mod-http-js_package() {
+	short_desc+=" - HTTP njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_js_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"
@@ -145,6 +172,14 @@ nginx-mod-stream_package() {
 	}
 }
 
+nginx-mod-stream-js_package() {
+	short_desc+=" - Stream njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_js_module.so
+	}
+}
+
 nginx-mod-stream-geoip_package() {
 	short_desc+=" - Stream GeoIP module"
 	depends="${sourcepkg}>=${version}_${revision}"

From f4d05d033e731bf560b5a42f885ce94d8ca2b580 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 4 Oct 2022 13:34:08 +0200
Subject: [PATCH 3/3] nginx: enable perl module.

---
 srcpkgs/nginx-mod-http-perl                   |  1 +
 srcpkgs/nginx/files/ngx_auto_config.h.aarch64 | 22 ++++++++++++++-----
 srcpkgs/nginx/files/ngx_auto_config.h.armv6l  | 22 ++++++++++++++-----
 srcpkgs/nginx/template                        | 15 +++++++++++--
 4 files changed, 46 insertions(+), 14 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-perl

diff --git a/srcpkgs/nginx-mod-http-perl b/srcpkgs/nginx-mod-http-perl
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-perl
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/files/ngx_auto_config.h.aarch64 b/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
index 7dd53d712857..809e031b2000 100644
--- a/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
+++ b/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
@@ -1,4 +1,4 @@
-#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/tmp/nginx/client-body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --with-http_geoip_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module --with-http_slice_module"
+#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --modules-path=/usr/lib/nginx/modules --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/tmp/client-body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --add-dynamic-module=../njs-0.7.7/nginx"
 
 #ifndef NGX_HAVE_GCC_ATOMIC
 #define NGX_HAVE_GCC_ATOMIC  1
@@ -528,6 +528,16 @@
 #endif
 
 
+#ifndef NGX_HAVE_EXSLT
+#define NGX_HAVE_EXSLT  1
+#endif
+
+
+#ifndef NGX_HAVE_PERL_MULTIPLICITY
+#define NGX_HAVE_PERL_MULTIPLICITY  1
+#endif
+
+
 #ifndef NGX_HAVE_GEOIP_V6
 #define NGX_HAVE_GEOIP_V6  1
 #endif
@@ -574,27 +584,27 @@
 
 
 #ifndef NGX_HTTP_CLIENT_TEMP_PATH
-#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/tmp/nginx/client-body"
+#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/lib/nginx/tmp/client-body"
 #endif
 
 
 #ifndef NGX_HTTP_PROXY_TEMP_PATH
-#define NGX_HTTP_PROXY_TEMP_PATH  "/var/tmp/nginx/proxy"
+#define NGX_HTTP_PROXY_TEMP_PATH  "/var/lib/nginx/tmp/proxy"
 #endif
 
 
 #ifndef NGX_HTTP_FASTCGI_TEMP_PATH
-#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/tmp/nginx/fastcgi"
+#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/lib/nginx/tmp/fastcgi"
 #endif
 
 
 #ifndef NGX_HTTP_UWSGI_TEMP_PATH
-#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/tmp/nginx/uwsgi"
+#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/lib/nginx/tmp/uwsgi"
 #endif
 
 
 #ifndef NGX_HTTP_SCGI_TEMP_PATH
-#define NGX_HTTP_SCGI_TEMP_PATH  "/var/tmp/nginx/scgi"
+#define NGX_HTTP_SCGI_TEMP_PATH  "/var/lib/nginx/tmp/scgi"
 #endif
 
 
diff --git a/srcpkgs/nginx/files/ngx_auto_config.h.armv6l b/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
index 5b32a6948ce3..df88ec2e35ac 100644
--- a/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
+++ b/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
@@ -1,4 +1,4 @@
-#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/tmp/nginx/client-body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --with-http_geoip_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module --with-http_slice_module"
+#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --modules-path=/usr/lib/nginx/modules --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/tmp/client-body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --add-dynamic-module=../njs-0.7.7/nginx"
 
 #ifndef NGX_HAVE_GCC_ATOMIC
 #define NGX_HAVE_GCC_ATOMIC  1
@@ -528,6 +528,16 @@
 #endif
 
 
+#ifndef NGX_HAVE_EXSLT
+#define NGX_HAVE_EXSLT  1
+#endif
+
+
+#ifndef NGX_HAVE_PERL_MULTIPLICITY
+#define NGX_HAVE_PERL_MULTIPLICITY  1
+#endif
+
+
 #ifndef NGX_HAVE_GEOIP_V6
 #define NGX_HAVE_GEOIP_V6  1
 #endif
@@ -574,27 +584,27 @@
 
 
 #ifndef NGX_HTTP_CLIENT_TEMP_PATH
-#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/tmp/nginx/client-body"
+#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/lib/nginx/tmp/client-body"
 #endif
 
 
 #ifndef NGX_HTTP_PROXY_TEMP_PATH
-#define NGX_HTTP_PROXY_TEMP_PATH  "/var/tmp/nginx/proxy"
+#define NGX_HTTP_PROXY_TEMP_PATH  "/var/lib/nginx/tmp/proxy"
 #endif
 
 
 #ifndef NGX_HTTP_FASTCGI_TEMP_PATH
-#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/tmp/nginx/fastcgi"
+#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/lib/nginx/tmp/fastcgi"
 #endif
 
 
 #ifndef NGX_HTTP_UWSGI_TEMP_PATH
-#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/tmp/nginx/uwsgi"
+#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/lib/nginx/tmp/uwsgi"
 #endif
 
 
 #ifndef NGX_HTTP_SCGI_TEMP_PATH
-#define NGX_HTTP_SCGI_TEMP_PATH  "/var/tmp/nginx/scgi"
+#define NGX_HTTP_SCGI_TEMP_PATH  "/var/lib/nginx/tmp/scgi"
 #endif
 
 
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 2b1d472d7a8f..8107afd0f3e0 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,7 +1,7 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=2
+revision=3
 _tests_commit=18ac4d9e5a2a
 _njs_version=0.7.7
 create_wrksrc=yes
@@ -37,6 +37,7 @@ configure_args="--prefix=${_cfgdir} \
  --with-http_v2_module \
  --with-http_xslt_module=dynamic \
  --with-http_geoip_module=dynamic \
+ --with-http_perl_module=dynamic \
  --with-stream=dynamic \
  --with-stream_geoip_module=dynamic \
  --with-stream_realip_module \
@@ -47,7 +48,7 @@ configure_args="--prefix=${_cfgdir} \
  --with-pcre-jit \
  --with-threads
  --add-dynamic-module=../njs-${_njs_version}/nginx"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel perl libxslt-devel
  which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
@@ -106,6 +107,8 @@ pre_build() {
 			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
 			;;
 		esac
+
+		sed -i "s:-I/usr:-I${XBPS_CROSS_BASE}/usr:" objs/Makefile
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
@@ -156,6 +159,14 @@ nginx-mod-http-js_package() {
 	}
 }
 
+nginx-mod-http-perl_package() {
+	short_desc+=" - Perl module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_perl_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR PATCH] [Updated] nginx: use dynamic modules instead of options, add njs.
  2022-10-01 13:32 [PR PATCH] nginx: use dynamic modules instead of options, add njs leahneukirchen
                   ` (2 preceding siblings ...)
  2022-10-04 19:20 ` leahneukirchen
@ 2022-10-07  9:13 ` leahneukirchen
  2022-10-26 12:50 ` [PR PATCH] [Merged]: " leahneukirchen
  4 siblings, 0 replies; 6+ messages in thread
From: leahneukirchen @ 2022-10-07  9:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

There is an updated pull request by leahneukirchen against master on the void-packages repository

https://github.com/leahneukirchen/void-packages dynamic-nginx
https://github.com/void-linux/void-packages/pull/39584

nginx: use dynamic modules instead of options, add njs.


#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**


A patch file from https://github.com/void-linux/void-packages/pull/39584.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dynamic-nginx-39584.patch --]
[-- Type: text/x-diff, Size: 28384 bytes --]

From 84e32856428aaa2d1bd06eb67e2d64225321bbee Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Fri, 30 Sep 2022 17:44:55 +0200
Subject: [PATCH 1/3] nginx: use dynamic modules instead of options, put them
 into subpackages.

- move tmp paths and homedir to /var/lib/nginx to ensure they keep existing
- use configure_args for consistency
---
 srcpkgs/nginx-mod-http-geoip       |   1 +
 srcpkgs/nginx-mod-http-xslt-filter |   1 +
 srcpkgs/nginx-mod-stream           |   1 +
 srcpkgs/nginx-mod-stream-geoip     |   1 +
 srcpkgs/nginx/template             | 129 +++++++++++++++++------------
 5 files changed, 82 insertions(+), 51 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-geoip
 create mode 120000 srcpkgs/nginx-mod-http-xslt-filter
 create mode 120000 srcpkgs/nginx-mod-stream
 create mode 120000 srcpkgs/nginx-mod-stream-geoip

diff --git a/srcpkgs/nginx-mod-http-geoip b/srcpkgs/nginx-mod-http-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-http-xslt-filter b/srcpkgs/nginx-mod-http-xslt-filter
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-xslt-filter
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream b/srcpkgs/nginx-mod-stream
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-geoip b/srcpkgs/nginx-mod-stream-geoip
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-geoip
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index a4324dd75df8..1a6142d49fc3 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -6,7 +6,46 @@ _tests_commit=18ac4d9e5a2a
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
-hostmakedepends="openssl-devel pcre2-devel $(vopt_if geoip geoip-devel)"
+_cfgdir=/etc/nginx
+_tmpdir=/var/lib/nginx/tmp
+configure_args="--prefix=${_cfgdir} \
+ --conf-path=${_cfgdir}/nginx.conf \
+ --sbin-path=/usr/bin/nginx \
+ --modules-path=/usr/lib/nginx/modules \
+ --pid-path=/run/nginx.pid \
+ --lock-path=/var/lock/nginx.lock \
+ --user=nginx \
+ --group=nginx \
+ --http-log-path=/var/log/nginx/access.log \
+ --error-log-path=/var/log/nginx/error.log \
+ --http-client-body-temp-path=${tmpdir}/client-body \
+ --http-proxy-temp-path=${tmpdir}/proxy \
+ --http-fastcgi-temp-path=${tmpdir}/fastcgi \
+ --http-scgi-temp-path=${tmpdir}/scgi \
+ --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --with-compat \
+ --with-file-aio \
+ --with-http_dav_module \
+ --with-http_gunzip_module \
+ --with-http_gzip_static_module \
+ --with-http_realip_module \
+ --with-http_ssl_module \
+ --with-http_slice_module \
+ --with-http_stub_status_module \
+ --with-http_sub_module \
+ --with-http_v2_module \
+ --with-http_xslt_module=dynamic \
+ --with-http_geoip_module=dynamic \
+ --with-stream=dynamic \
+ --with-stream_geoip_module=dynamic \
+ --with-stream_realip_module \
+ --with-stream_ssl_module \
+ --with-stream_ssl_preread_module \
+ --with-mail \
+ --with-mail_ssl_module \
+ --with-pcre-jit \
+ --with-threads"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -34,64 +73,18 @@ conf_files="/etc/nginx/fastcgi.conf
  /etc/nginx/uwsgi_params
  /etc/nginx/win-utf"
 system_accounts="nginx"
-nginx_homedir="/var/tmp/nginx"
+nginx_homedir="/var/lib/nginx"
 make_dirs="/var/log/nginx 0750 root root
- /var/tmp 1777 root root
- /var/tmp/nginx 0750 nginx root"
-
-build_options="geoip stream slice"
-desc_option_stream="Enable support for stream proxies"
-desc_option_slice="Enable support for slice filters"
-build_options_default="geoip stream slice"
+ /var/lib/nginx 1777 root root
+ /var/lib/nginx/tmp 0750 nginx root"
 
 do_configure() {
-	local cfgdir=/etc/nginx
-	local tmpdir=/var/tmp/nginx
-
 	if [ "$CROSS_BUILD" ]; then
 		# fake configure run on host
 		unset CC CPP LD CFLAGS CPPFLAGS LDFLAGS
 	fi
 
-	local stream_modules="\
-		--with-stream \
-		--with-stream_realip_module \
-		--with-stream_ssl_module \
-		--with-stream_ssl_preread_module \
-		$(vopt_if geoip --with-stream_geoip_module) \
-	"
-
-	./configure --prefix=${cfgdir} \
-		--conf-path=${cfgdir}/nginx.conf \
-		--sbin-path=/usr/bin/nginx \
-		--pid-path=/run/nginx.pid \
-		--lock-path=/var/lock/nginx.lock \
-		--user=nginx --group=nginx \
-		--http-log-path=/var/log/nginx/access.log \
-		--error-log-path=/var/log/nginx/error.log \
-		--http-client-body-temp-path=${tmpdir}/client-body \
-		--http-proxy-temp-path=${tmpdir}/proxy \
-		--http-fastcgi-temp-path=${tmpdir}/fastcgi \
-		--http-scgi-temp-path=${tmpdir}/scgi \
-		--http-uwsgi-temp-path=${tmpdir}/uwsgi \
-		--with-compat \
-		--with-file-aio \
-		--with-http_dav_module \
-		--with-http_gunzip_module \
-		--with-http_gzip_static_module \
-		--with-http_realip_module \
-		--with-http_ssl_module \
-		--with-http_stub_status_module \
-		--with-http_sub_module \
-		--with-http_v2_module \
-		--with-mail \
-		--with-mail_ssl_module \
-		--with-pcre-jit \
-		--with-threads \
-		$(vopt_if geoip --with-http_geoip_module) \
-		$(vopt_if stream "$stream_modules") \
-		$(vopt_if slice --with-http_slice_module)
-
+	./configure ${configure_args}
 }
 
 pre_build() {
@@ -103,6 +96,8 @@ pre_build() {
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
+
+	export LD="$CC"
 }
 
 do_check() {
@@ -125,3 +120,35 @@ post_install() {
 	vlicense LICENSE
 	vsv nginx
 }
+
+nginx-mod-http-geoip_package() {
+	short_desc+=" - HTTP GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_geoip_module.so
+	}
+}
+
+nginx-mod-http-xslt-filter_package() {
+	short_desc+=" - XSLT filter module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_xslt_filter_module.so
+	}
+}
+
+nginx-mod-stream_package() {
+	short_desc+=" - Stream module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_module.so
+	}
+}
+
+nginx-mod-stream-geoip_package() {
+	short_desc+=" - Stream GeoIP module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_geoip_module.so
+	}
+}

From 95308b1b3d6bb61b65830f0b3cbe9e7d9b13de52 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Sat, 1 Oct 2022 14:47:15 +0200
Subject: [PATCH 2/3] nginx: add njs modules.

---
 srcpkgs/nginx-mod-http-js                     |   1 +
 srcpkgs/nginx-mod-stream-js                   |   1 +
 srcpkgs/nginx/INSTALL.msg                     |   7 +
 srcpkgs/nginx/files/njs_auto_config.h.aarch64 | 163 ++++++++++++++++++
 srcpkgs/nginx/files/njs_auto_config.h.armv6l  | 158 +++++++++++++++++
 srcpkgs/nginx/template                        |  59 +++++--
 6 files changed, 377 insertions(+), 12 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-js
 create mode 120000 srcpkgs/nginx-mod-stream-js
 create mode 100644 srcpkgs/nginx/INSTALL.msg
 create mode 100644 srcpkgs/nginx/files/njs_auto_config.h.aarch64
 create mode 100644 srcpkgs/nginx/files/njs_auto_config.h.armv6l

diff --git a/srcpkgs/nginx-mod-http-js b/srcpkgs/nginx-mod-http-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx-mod-stream-js b/srcpkgs/nginx-mod-stream-js
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-stream-js
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/INSTALL.msg b/srcpkgs/nginx/INSTALL.msg
new file mode 100644
index 000000000000..9505dd5607a2
--- /dev/null
+++ b/srcpkgs/nginx/INSTALL.msg
@@ -0,0 +1,7 @@
+nginx has been converted to use dynamic modules.
+
+If you used the stream or geoip modules before, you now need
+to install nginx-mod-$MODULE and add this to the main context of nginx.conf:
+
+  load_module modules/ngx_$MODULE_module.so;
+
diff --git a/srcpkgs/nginx/files/njs_auto_config.h.aarch64 b/srcpkgs/nginx/files/njs_auto_config.h.aarch64
new file mode 100644
index 000000000000..c4f62854ce53
--- /dev/null
+++ b/srcpkgs/nginx/files/njs_auto_config.h.aarch64
@@ -0,0 +1,163 @@
+
+/* This file is auto-generated by configure */
+
+
+#ifndef NJS_LINUX
+#define NJS_LINUX  1
+#endif
+
+
+#ifndef NJS_GCC
+#define NJS_GCC  1
+#endif
+
+
+#ifndef NJS_TEST262
+#define NJS_TEST262  1
+#endif
+
+
+#ifndef NJS_INT_SIZE
+#define NJS_INT_SIZE  4
+#endif
+
+
+#ifndef NJS_UINT_SIZE
+#define NJS_UINT_SIZE  4
+#endif
+
+
+#ifndef NJS_PTR_SIZE
+#define NJS_PTR_SIZE  8
+#endif
+
+
+#ifndef NJS_UINTPTR_T_SIZE
+#define NJS_UINTPTR_T_SIZE  8
+#endif
+
+
+#ifndef NJS_SIZE_T_SIZE
+#define NJS_SIZE_T_SIZE  8
+#endif
+
+
+#ifndef NJS_OFF_T_SIZE
+#define NJS_OFF_T_SIZE  8
+#endif
+
+
+#ifndef NJS_TIME_T_SIZE
+#define NJS_TIME_T_SIZE  8
+#endif
+
+
+#ifndef NJS_BYTE_ORDER
+#define NJS_BYTE_ORDER  little
+#endif
+
+
+#ifndef NJS_HAVE_LITTLE_ENDIAN
+#define NJS_HAVE_LITTLE_ENDIAN  1
+#endif
+
+
+#ifndef NJS_HAVE_UNSIGNED_INT128
+#define NJS_HAVE_UNSIGNED_INT128  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_EXPECT
+#define NJS_HAVE_BUILTIN_EXPECT  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_UNREACHABLE
+#define NJS_HAVE_BUILTIN_UNREACHABLE  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_PREFETCH
+#define NJS_HAVE_BUILTIN_PREFETCH  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZ
+#define NJS_HAVE_BUILTIN_CLZ  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZLL
+#define NJS_HAVE_BUILTIN_CLZLL  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY
+#define NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_MALLOC
+#define NJS_HAVE_GCC_ATTRIBUTE_MALLOC  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_ALIGNED
+#define NJS_HAVE_GCC_ATTRIBUTE_ALIGNED  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_PACKED
+#define NJS_HAVE_GCC_ATTRIBUTE_PACKED  1
+#endif
+
+
+#ifndef NJS_HAVE_CLOCK_MONOTONIC
+#define NJS_HAVE_CLOCK_MONOTONIC  1
+#endif
+
+
+#ifndef NJS_HAVE_TM_GMTOFF
+#define NJS_HAVE_TM_GMTOFF  1
+#endif
+
+
+#ifndef NJS_HAVE_POSIX_MEMALIGN
+#define NJS_HAVE_POSIX_MEMALIGN  1
+#endif
+
+
+#ifndef NJS_HAVE_GETRANDOM
+#define NJS_HAVE_GETRANDOM  1
+#endif
+
+
+#ifndef NJS_HAVE_STAT_ATIM
+#define NJS_HAVE_STAT_ATIM  1
+#endif
+
+
+#ifndef NJS_HAVE_EXPLICIT_BZERO
+#define NJS_HAVE_EXPLICIT_BZERO  1
+#endif
+
+
+#ifndef NJS_HAVE_PCRE2
+#define NJS_HAVE_PCRE2  1
+#endif
+
+
+#ifndef NJS_PCRE2_VERSION
+#define NJS_PCRE2_VERSION  10.39
+#endif
+
+
+#ifndef NJS_HAVE_OPENSSL
+#define NJS_HAVE_OPENSSL  1
+#endif
+
+
+#ifndef NJS_OPENSSL_VERSION
+#define NJS_OPENSSL_VERSION  "OpenSSL 1.1.1q  5 Jul 2022"
+#endif
+
diff --git a/srcpkgs/nginx/files/njs_auto_config.h.armv6l b/srcpkgs/nginx/files/njs_auto_config.h.armv6l
new file mode 100644
index 000000000000..f322c69b4544
--- /dev/null
+++ b/srcpkgs/nginx/files/njs_auto_config.h.armv6l
@@ -0,0 +1,158 @@
+
+/* This file is auto-generated by configure */
+
+
+#ifndef NJS_LINUX
+#define NJS_LINUX  1
+#endif
+
+
+#ifndef NJS_GCC
+#define NJS_GCC  1
+#endif
+
+
+#ifndef NJS_TEST262
+#define NJS_TEST262  1
+#endif
+
+
+#ifndef NJS_INT_SIZE
+#define NJS_INT_SIZE  4
+#endif
+
+
+#ifndef NJS_UINT_SIZE
+#define NJS_UINT_SIZE  4
+#endif
+
+
+#ifndef NJS_PTR_SIZE
+#define NJS_PTR_SIZE  4
+#endif
+
+
+#ifndef NJS_UINTPTR_T_SIZE
+#define NJS_UINTPTR_T_SIZE  4
+#endif
+
+
+#ifndef NJS_SIZE_T_SIZE
+#define NJS_SIZE_T_SIZE  4
+#endif
+
+
+#ifndef NJS_OFF_T_SIZE
+#define NJS_OFF_T_SIZE  8
+#endif
+
+
+#ifndef NJS_TIME_T_SIZE
+#define NJS_TIME_T_SIZE  4
+#endif
+
+
+#ifndef NJS_BYTE_ORDER
+#define NJS_BYTE_ORDER  little
+#endif
+
+
+#ifndef NJS_HAVE_LITTLE_ENDIAN
+#define NJS_HAVE_LITTLE_ENDIAN  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_EXPECT
+#define NJS_HAVE_BUILTIN_EXPECT  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_UNREACHABLE
+#define NJS_HAVE_BUILTIN_UNREACHABLE  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_PREFETCH
+#define NJS_HAVE_BUILTIN_PREFETCH  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZ
+#define NJS_HAVE_BUILTIN_CLZ  1
+#endif
+
+
+#ifndef NJS_HAVE_BUILTIN_CLZLL
+#define NJS_HAVE_BUILTIN_CLZLL  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY
+#define NJS_HAVE_GCC_ATTRIBUTE_VISIBILITY  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_MALLOC
+#define NJS_HAVE_GCC_ATTRIBUTE_MALLOC  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_ALIGNED
+#define NJS_HAVE_GCC_ATTRIBUTE_ALIGNED  1
+#endif
+
+
+#ifndef NJS_HAVE_GCC_ATTRIBUTE_PACKED
+#define NJS_HAVE_GCC_ATTRIBUTE_PACKED  1
+#endif
+
+
+#ifndef NJS_HAVE_CLOCK_MONOTONIC
+#define NJS_HAVE_CLOCK_MONOTONIC  1
+#endif
+
+
+#ifndef NJS_HAVE_TM_GMTOFF
+#define NJS_HAVE_TM_GMTOFF  1
+#endif
+
+
+#ifndef NJS_HAVE_POSIX_MEMALIGN
+#define NJS_HAVE_POSIX_MEMALIGN  1
+#endif
+
+
+#ifndef NJS_HAVE_GETRANDOM
+#define NJS_HAVE_GETRANDOM  1
+#endif
+
+
+#ifndef NJS_HAVE_STAT_ATIM
+#define NJS_HAVE_STAT_ATIM  1
+#endif
+
+
+#ifndef NJS_HAVE_EXPLICIT_BZERO
+#define NJS_HAVE_EXPLICIT_BZERO  1
+#endif
+
+
+#ifndef NJS_HAVE_PCRE2
+#define NJS_HAVE_PCRE2  1
+#endif
+
+
+#ifndef NJS_PCRE2_VERSION
+#define NJS_PCRE2_VERSION  10.39
+#endif
+
+
+#ifndef NJS_HAVE_OPENSSL
+#define NJS_HAVE_OPENSSL  1
+#endif
+
+
+#ifndef NJS_OPENSSL_VERSION
+#define NJS_OPENSSL_VERSION  "OpenSSL 1.1.1q  5 Jul 2022"
+#endif
+
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 1a6142d49fc3..2b1d472d7a8f 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,8 +1,9 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=1
+revision=2
 _tests_commit=18ac4d9e5a2a
+_njs_version=0.7.7
 create_wrksrc=yes
 build_wrksrc="nginx-${version}"
 build_style=gnu-makefile
@@ -18,11 +19,11 @@ configure_args="--prefix=${_cfgdir} \
  --group=nginx \
  --http-log-path=/var/log/nginx/access.log \
  --error-log-path=/var/log/nginx/error.log \
- --http-client-body-temp-path=${tmpdir}/client-body \
- --http-proxy-temp-path=${tmpdir}/proxy \
- --http-fastcgi-temp-path=${tmpdir}/fastcgi \
- --http-scgi-temp-path=${tmpdir}/scgi \
- --http-uwsgi-temp-path=${tmpdir}/uwsgi \
+ --http-client-body-temp-path=${_tmpdir}/client-body \
+ --http-proxy-temp-path=${_tmpdir}/proxy \
+ --http-fastcgi-temp-path=${_tmpdir}/fastcgi \
+ --http-scgi-temp-path=${_tmpdir}/scgi \
+ --http-uwsgi-temp-path=${_tmpdir}/uwsgi \
  --with-compat \
  --with-file-aio \
  --with-http_dav_module \
@@ -44,8 +45,10 @@ configure_args="--prefix=${_cfgdir} \
  --with-mail \
  --with-mail_ssl_module \
  --with-pcre-jit \
- --with-threads"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel"
+ --with-threads
+ --add-dynamic-module=../njs-${_njs_version}/nginx"
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+ which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
 short_desc="High performance web and reverse proxy server"
@@ -53,9 +56,11 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
 license="BSD-2-Clause"
 homepage="https://nginx.org"
 distfiles="https://nginx.org/download/nginx-${version}.tar.gz
- https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz"
+ https://hg.nginx.org/nginx-tests/archive/${_tests_commit}.tar.gz
+ https://hg.nginx.org/njs/archive/${_njs_version}.tar.gz"
 checksum="b33d569a6f11a01433a57ce17e83935e953ad4dc77cdd4d40f896c88ac26eb53
- e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228"
+ e34ef2f38512e1c04ee201c3b68f7ba7ec8f1537dc6a500278bc2219ab435228
+ 4dac9cbf071e5a7dfe135b4d87e20112d207fcbf5fb620854af8dab44ec3e7bd"
 # Tests fail when nginx run as root and there is no nginx user
 make_check=ci-skip
 
@@ -85,19 +90,33 @@ do_configure() {
 	fi
 
 	./configure ${configure_args}
+	( cd ../njs-${_njs_version} && ./configure )
 }
 
 pre_build() {
 	if [ "$CROSS_BUILD" ]; then
+		mkdir -p ../njs-${_njs_version}/build
 		case "$XBPS_TARGET_MACHINE" in
-			arm*) cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h;;
-			aarch64*) cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h;;
+		arm*)
+			cp "${FILESDIR}/ngx_auto_config.h.armv6l" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.armv6l" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
+		aarch64*)
+			cp "${FILESDIR}/ngx_auto_config.h.aarch64" objs/ngx_auto_config.h
+			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
+			;;
 		esac
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
 
 	export LD="$CC"
+
+	(
+		cd ../njs-${_njs_version}
+		make ${makejobs} NJS_CC="$CC" NJS_CFLAGS="$CFLAGS -fPIC" \
+			NJS_STATIC_LINK="$AR -r -c" NJS_LINK="$CC -O"
+	)
 }
 
 do_check() {
@@ -129,6 +148,14 @@ nginx-mod-http-geoip_package() {
 	}
 }
 
+nginx-mod-http-js_package() {
+	short_desc+=" - HTTP njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_js_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"
@@ -145,6 +172,14 @@ nginx-mod-stream_package() {
 	}
 }
 
+nginx-mod-stream-js_package() {
+	short_desc+=" - Stream njs module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_stream_js_module.so
+	}
+}
+
 nginx-mod-stream-geoip_package() {
 	short_desc+=" - Stream GeoIP module"
 	depends="${sourcepkg}>=${version}_${revision}"

From 31bf62f33bdf3de2d8cf3b0e29b16a8c46dfa197 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Tue, 4 Oct 2022 13:34:08 +0200
Subject: [PATCH 3/3] nginx: enable perl module.

---
 srcpkgs/nginx-mod-http-perl                   |  1 +
 srcpkgs/nginx/files/ngx_auto_config.h.aarch64 | 22 ++++++++++----
 srcpkgs/nginx/files/ngx_auto_config.h.armv6l  | 22 ++++++++++----
 srcpkgs/nginx/template                        | 30 +++++++++++++++++--
 4 files changed, 61 insertions(+), 14 deletions(-)
 create mode 120000 srcpkgs/nginx-mod-http-perl

diff --git a/srcpkgs/nginx-mod-http-perl b/srcpkgs/nginx-mod-http-perl
new file mode 120000
index 000000000000..da70e2081bc0
--- /dev/null
+++ b/srcpkgs/nginx-mod-http-perl
@@ -0,0 +1 @@
+nginx
\ No newline at end of file
diff --git a/srcpkgs/nginx/files/ngx_auto_config.h.aarch64 b/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
index 7dd53d712857..809e031b2000 100644
--- a/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
+++ b/srcpkgs/nginx/files/ngx_auto_config.h.aarch64
@@ -1,4 +1,4 @@
-#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/tmp/nginx/client-body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --with-http_geoip_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module --with-http_slice_module"
+#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --modules-path=/usr/lib/nginx/modules --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/tmp/client-body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --add-dynamic-module=../njs-0.7.7/nginx"
 
 #ifndef NGX_HAVE_GCC_ATOMIC
 #define NGX_HAVE_GCC_ATOMIC  1
@@ -528,6 +528,16 @@
 #endif
 
 
+#ifndef NGX_HAVE_EXSLT
+#define NGX_HAVE_EXSLT  1
+#endif
+
+
+#ifndef NGX_HAVE_PERL_MULTIPLICITY
+#define NGX_HAVE_PERL_MULTIPLICITY  1
+#endif
+
+
 #ifndef NGX_HAVE_GEOIP_V6
 #define NGX_HAVE_GEOIP_V6  1
 #endif
@@ -574,27 +584,27 @@
 
 
 #ifndef NGX_HTTP_CLIENT_TEMP_PATH
-#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/tmp/nginx/client-body"
+#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/lib/nginx/tmp/client-body"
 #endif
 
 
 #ifndef NGX_HTTP_PROXY_TEMP_PATH
-#define NGX_HTTP_PROXY_TEMP_PATH  "/var/tmp/nginx/proxy"
+#define NGX_HTTP_PROXY_TEMP_PATH  "/var/lib/nginx/tmp/proxy"
 #endif
 
 
 #ifndef NGX_HTTP_FASTCGI_TEMP_PATH
-#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/tmp/nginx/fastcgi"
+#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/lib/nginx/tmp/fastcgi"
 #endif
 
 
 #ifndef NGX_HTTP_UWSGI_TEMP_PATH
-#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/tmp/nginx/uwsgi"
+#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/lib/nginx/tmp/uwsgi"
 #endif
 
 
 #ifndef NGX_HTTP_SCGI_TEMP_PATH
-#define NGX_HTTP_SCGI_TEMP_PATH  "/var/tmp/nginx/scgi"
+#define NGX_HTTP_SCGI_TEMP_PATH  "/var/lib/nginx/tmp/scgi"
 #endif
 
 
diff --git a/srcpkgs/nginx/files/ngx_auto_config.h.armv6l b/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
index 5b32a6948ce3..df88ec2e35ac 100644
--- a/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
+++ b/srcpkgs/nginx/files/ngx_auto_config.h.armv6l
@@ -1,4 +1,4 @@
-#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/tmp/nginx/client-body --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --with-http_geoip_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module --with-http_slice_module"
+#define NGX_CONFIGURE " --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --modules-path=/usr/lib/nginx/modules --pid-path=/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/tmp/client-body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-http_slice_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-threads --add-dynamic-module=../njs-0.7.7/nginx"
 
 #ifndef NGX_HAVE_GCC_ATOMIC
 #define NGX_HAVE_GCC_ATOMIC  1
@@ -528,6 +528,16 @@
 #endif
 
 
+#ifndef NGX_HAVE_EXSLT
+#define NGX_HAVE_EXSLT  1
+#endif
+
+
+#ifndef NGX_HAVE_PERL_MULTIPLICITY
+#define NGX_HAVE_PERL_MULTIPLICITY  1
+#endif
+
+
 #ifndef NGX_HAVE_GEOIP_V6
 #define NGX_HAVE_GEOIP_V6  1
 #endif
@@ -574,27 +584,27 @@
 
 
 #ifndef NGX_HTTP_CLIENT_TEMP_PATH
-#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/tmp/nginx/client-body"
+#define NGX_HTTP_CLIENT_TEMP_PATH  "/var/lib/nginx/tmp/client-body"
 #endif
 
 
 #ifndef NGX_HTTP_PROXY_TEMP_PATH
-#define NGX_HTTP_PROXY_TEMP_PATH  "/var/tmp/nginx/proxy"
+#define NGX_HTTP_PROXY_TEMP_PATH  "/var/lib/nginx/tmp/proxy"
 #endif
 
 
 #ifndef NGX_HTTP_FASTCGI_TEMP_PATH
-#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/tmp/nginx/fastcgi"
+#define NGX_HTTP_FASTCGI_TEMP_PATH  "/var/lib/nginx/tmp/fastcgi"
 #endif
 
 
 #ifndef NGX_HTTP_UWSGI_TEMP_PATH
-#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/tmp/nginx/uwsgi"
+#define NGX_HTTP_UWSGI_TEMP_PATH  "/var/lib/nginx/tmp/uwsgi"
 #endif
 
 
 #ifndef NGX_HTTP_SCGI_TEMP_PATH
-#define NGX_HTTP_SCGI_TEMP_PATH  "/var/tmp/nginx/scgi"
+#define NGX_HTTP_SCGI_TEMP_PATH  "/var/lib/nginx/tmp/scgi"
 #endif
 
 
diff --git a/srcpkgs/nginx/template b/srcpkgs/nginx/template
index 2b1d472d7a8f..8508e6c4246e 100644
--- a/srcpkgs/nginx/template
+++ b/srcpkgs/nginx/template
@@ -1,7 +1,7 @@
 # Template file for 'nginx'
 pkgname=nginx
 version=1.22.0
-revision=2
+revision=3
 _tests_commit=18ac4d9e5a2a
 _njs_version=0.7.7
 create_wrksrc=yes
@@ -37,6 +37,7 @@ configure_args="--prefix=${_cfgdir} \
  --with-http_v2_module \
  --with-http_xslt_module=dynamic \
  --with-http_geoip_module=dynamic \
+ --with-http_perl_module=dynamic \
  --with-stream=dynamic \
  --with-stream_geoip_module=dynamic \
  --with-stream_realip_module \
@@ -47,7 +48,7 @@ configure_args="--prefix=${_cfgdir} \
  --with-pcre-jit \
  --with-threads
  --add-dynamic-module=../njs-${_njs_version}/nginx"
-hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel libxslt-devel
+hostmakedepends="geoip geoip-devel openssl-devel pcre2-devel perl libxslt-devel
  which"
 makedepends="${hostmakedepends}"
 checkdepends="perl perl-IO-Socket-SSL perl-GD perl-FCGI which"
@@ -87,6 +88,21 @@ do_configure() {
 	if [ "$CROSS_BUILD" ]; then
 		# fake configure run on host
 		unset CC CPP LD CFLAGS CPPFLAGS LDFLAGS
+
+		local perlprefix=${XBPS_STATEDIR}/perlprefix-${XBPS_TARGET_MACHINE}
+		mkdir -p $perlprefix
+		if [ -d "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl" ]; then
+			cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
+			cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
+			sed -i -e "s;archlibexp => '\(.*\)';archlibexp => '${XBPS_CROSS_BASE}\1';" \
+				${perlprefix}/Config.pm
+			sed -i -e "s;^archlibexp='\(.*\)';archlibexp='${XBPS_CROSS_BASE}\1';" \
+				${perlprefix}/Config_heavy.pl
+		else
+			cp "/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
+			cp "/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
+		fi
+		export PERL5LIB=$perlprefix
 	fi
 
 	./configure ${configure_args}
@@ -106,6 +122,8 @@ pre_build() {
 			cp "${FILESDIR}/njs_auto_config.h.aarch64" ../njs-${_njs_version}/build/njs_auto_config.h
 			;;
 		esac
+
+		sed -i "s:-I/usr:-I${XBPS_CROSS_BASE}/usr:" objs/Makefile
 	fi
 
 	sed -i 's/-lcrypt/$(LDFLAGS) &/' objs/Makefile
@@ -156,6 +174,14 @@ nginx-mod-http-js_package() {
 	}
 }
 
+nginx-mod-http-perl_package() {
+	short_desc+=" - Perl module"
+	depends="${sourcepkg}>=${version}_${revision}"
+	pkg_install() {
+		vmove usr/lib/nginx/modules/ngx_http_perl_module.so
+	}
+}
+
 nginx-mod-http-xslt-filter_package() {
 	short_desc+=" - XSLT filter module"
 	depends="${sourcepkg}>=${version}_${revision}"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PR PATCH] [Merged]: nginx: use dynamic modules instead of options, add njs.
  2022-10-01 13:32 [PR PATCH] nginx: use dynamic modules instead of options, add njs leahneukirchen
                   ` (3 preceding siblings ...)
  2022-10-07  9:13 ` leahneukirchen
@ 2022-10-26 12:50 ` leahneukirchen
  4 siblings, 0 replies; 6+ messages in thread
From: leahneukirchen @ 2022-10-26 12:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

There's a merged pull request on the void-packages repository

nginx: use dynamic modules instead of options, add njs.
https://github.com/void-linux/void-packages/pull/39584

Description:


#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-26 12:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-01 13:32 [PR PATCH] nginx: use dynamic modules instead of options, add njs leahneukirchen
2022-10-04 11:53 ` [PR PATCH] [Updated] " leahneukirchen
2022-10-04 12:38 ` leahneukirchen
2022-10-04 19:20 ` leahneukirchen
2022-10-07  9:13 ` leahneukirchen
2022-10-26 12:50 ` [PR PATCH] [Merged]: " leahneukirchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).