[packages/nginx] Add nginx-devel for out-of-tree dynamic modules; rel 2
arekm
arekm at pld-linux.org
Fri Aug 28 11:21:00 CEST 2026
commit 4d6d4147dced27aafafe7a4abeef03e11a21070a
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Fri Aug 28 11:16:46 2026 +0200
Add nginx-devel for out-of-tree dynamic modules; rel 2
Based on debian solution.
--with-compat makes modules built against it loadable.
macros.nginx | 24 ++++++++++++++++++++++++
nginx.spec | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 83 insertions(+), 1 deletion(-)
---
diff --git a/nginx.spec b/nginx.spec
index c715a5a..9e51c23 100644
--- a/nginx.spec
+++ b/nginx.spec
@@ -52,7 +52,7 @@ Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności
# http://nginx.org/en/download.html
Name: nginx
Version: 1.31.4
-Release: 1
+Release: 2
License: BSD-like
Group: Networking/Daemons/HTTP
Source0: https://nginx.org/download/%{name}-%{version}.tar.gz
@@ -67,6 +67,7 @@ Source7: %{name}.init
Source14: %{name}.conf
Source17: %{name}-mime.types.sh
Source18: %{name}.service
+Source19: macros.%{name}
Source33: https://github.com/SpiderLabs/ModSecurity-nginx/releases/download/v%{modsecurity_version}/modsecurity-%{name}-v%{modsecurity_version}.tar.gz
# Source33-md5: 500c37fefb2e3c8afa1245fff3b0d86d
Source101: https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}/%{name}-rtmp-module-%{rtmp_version}.tar.gz
@@ -115,6 +116,8 @@ BuildRequires: libxslt-devel
%endif
Provides: group(http)
Provides: group(nginx)
+# out-of-tree modules pin this; ngx_load_module() rejects a version mismatch
+Provides: nginx(modules-api) = %{version}
Provides: user(nginx)
Provides: webserver
Provides: webserver(access)
@@ -149,6 +152,10 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _sysconfdir /etc/%{name}
%define _nginxdir /home/services/%{name}
+# stops perl deps from the shipped tree; %{name} would be the subpackage name here
+%define _noautoprovfiles %{_datadir}/nginx/src/.*
+%define _noautoreqfiles %{_datadir}/nginx/src/.*
+
# minimizing restarts logics. we restart webserver:
#
# 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
@@ -203,6 +210,36 @@ opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
prostej konfiguracji oraz małej "zasobożerności".
+%package devel
+Summary: Source tree and rpm macros for building nginx dynamic modules
+Summary(pl.UTF-8): Drzewo źródeł i makra rpm do budowania modułów dynamicznych nginksa
+Group: Development/Building
+# what the shipped configure hard-requires
+Requires: pcre2-8-devel
+Requires: rpmbuild(macros) >= 1.644
+Requires: zlib-devel
+
+%description devel
+The nginx source tree and rpm macros needed to build a dynamic module
+outside this spec, the way Debian's nginx-dev works. nginx here is
+configured with --with-compat, so a module configured the same way
+loads into this build without repeating any of its configure options.
+
+A module still has to be rebuilt for every nginx version, since
+ngx_load_module() compares nginx_version; %{name}(modules-api)
+expresses that.
+
+%description devel -l pl.UTF-8
+Drzewo źródeł nginksa oraz makra rpm potrzebne do zbudowania modułu
+dynamicznego poza tym plikiem spec, na zasadzie debianowego
+nginx-dev. nginx budowany jest tutaj z --with-compat, więc moduł
+skonfigurowany tak samo ładuje się do tej kompilacji bez powtarzania
+którejkolwiek z jej opcji configure.
+
+Moduł nadal wymaga przebudowy przy każdej wersji nginksa, ponieważ
+ngx_load_module() porównuje nginx_version; wyraża to
+%{name}(modules-api).
+
%package mod_headers_more
Summary: Nginx HTTP headers more module
Group: Daemons
@@ -355,6 +392,7 @@ cp -f configure auto/
%{__make} -C quickjs CFLAGS='-fPIC %{rpmcflags} -D_GNU_SOURCE -DCONFIG_VERSION=\"%{quickjs_commit}\"' libquickjs.a
%endif
+# --with-compat keeps NGX_MODULE_SIGNATURE stable; nginx-devel relies on it
./configure \
--prefix=%{_prefix} \
--modules-path=%{_libdir}/%{name}/modules \
@@ -435,6 +473,17 @@ install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/*.default
+# source tree for out-of-tree module builds; objs/ is regenerated by the module
+install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/src
+cp -a auto src configure $RPM_BUILD_ROOT%{_datadir}/%{name}/src
+# %build copied configure into auto/; only the top-level one is used
+%{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/src/auto/configure
+
+install -d $RPM_BUILD_ROOT%{_rpmmacrodir}
+sed -e 's|@VERSION@|%{version}|' \
+ -e 's|@SRCDIR@|%{_datadir}/%{name}/src|' \
+ %{SOURCE19} > $RPM_BUILD_ROOT%{_rpmmacrodir}/macros.%{name}
+
cp -p %{_sourcedir}/%{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}
cp -p %{_sourcedir}/%{name}.service $RPM_BUILD_ROOT%{systemdunitdir}
cp -p %{_sourcedir}/%{name}.monitrc $RPM_BUILD_ROOT/etc/monit
@@ -576,6 +625,15 @@ fi
%config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
%config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
+%files devel
+%defattr(644,root,root,755)
+%dir %{_datadir}/%{name}
+%dir %{_datadir}/%{name}/src
+%attr(755,root,root) %{_datadir}/%{name}/src/configure
+%{_datadir}/%{name}/src/auto
+%{_datadir}/%{name}/src/src
+%{_rpmmacrodir}/macros.%{name}
+
%if %{with geoip}
%files mod_http_geoip
%defattr(644,root,root,755)
diff --git a/macros.nginx b/macros.nginx
new file mode 100644
index 0000000..e10112a
--- /dev/null
+++ b/macros.nginx
@@ -0,0 +1,24 @@
+# Build environment for nginx dynamic modules packaged outside nginx.spec.
+
+# nginx_version ngx_load_module() compares against; changes force module rebuilds
+%nginx_modules_api @VERSION@
+
+# run nginx's own configure here, with --with-compat --add-dynamic-module=<dir>
+%nginx_srcdir @SRCDIR@
+
+# resolved at use time, so one arch-independent file serves every arch
+%nginx_moduledir %{_libdir}/nginx/modules
+
+# reload the server once at end of transaction, as nginx.spec does for its own
+%nginx_module_scripts() \
+%post -n %1 \
+if [ "$1" = "1" ]; then \
+ %systemd_post nginx.service \
+ %service nginx force-reload \
+fi \
+\
+%postun -n %1 \
+if [ "$1" = "0" ]; then \
+ %systemd_post nginx.service \
+ %service nginx force-reload \
+fi
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/nginx.git/commitdiff/4d6d4147dced27aafafe7a4abeef03e11a21070a
More information about the pld-cvs-commit
mailing list