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

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).