From 6bfca042d365614ebc63172f7e56d393dde2d844 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Wed, 29 Jul 2026 18:47:28 -0700 Subject: [PATCH 1/5] alpine: drop prerequisites-for-module targets They're not used anywhere and are a dead code (cherry picked from commit f56a01b35da6a140e6707fd64a83bccc356e2651) --- alpine/Makefile.module-acme | 2 -- alpine/Makefile.module-auth-spnego | 2 -- alpine/Makefile.module-encrypted-session | 2 -- alpine/Makefile.module-fips-check | 2 -- alpine/Makefile.module-geoip2 | 2 -- alpine/Makefile.module-headers-more | 2 -- alpine/Makefile.module-lua | 2 -- alpine/Makefile.module-ndk | 2 -- alpine/Makefile.module-otel | 2 -- alpine/Makefile.module-passenger | 2 -- alpine/Makefile.module-rtmp | 2 -- alpine/Makefile.module-set-misc | 2 -- alpine/Makefile.module-subs-filter | 2 -- 13 files changed, 26 deletions(-) diff --git a/alpine/Makefile.module-acme b/alpine/Makefile.module-acme index 30986048..cd8fd805 100644 --- a/alpine/Makefile.module-acme +++ b/alpine/Makefile.module-acme @@ -16,8 +16,6 @@ MODULE_SOURCES_acme= nginx-acme-$(NGINX_ACME_VERSION).tar.gz \ MODULE_CONFARGS_acme= --add-dynamic-module=$(MODSRC_PREFIX)nginx-acme-$(NGINX_ACME_VERSION) -prerequisites-for-module-acme: - # fixes module dependencies build using rustup-provided rustc/cargo define MODULE_PREBUILD_acme export NGX_ACME_STATE_PREFIX=/var/cache/nginx \&\& \ diff --git a/alpine/Makefile.module-auth-spnego b/alpine/Makefile.module-auth-spnego index e7b6016f..55f3272b 100644 --- a/alpine/Makefile.module-auth-spnego +++ b/alpine/Makefile.module-auth-spnego @@ -17,8 +17,6 @@ MODULE_PATCHES_auth_spnego= MODULE_CONFARGS_auth_spnego= --add-dynamic-module=$(MODSRC_PREFIX)spnego-http-auth-nginx-module-$(SPNEGO_HTTP_AUTH_NGINX_MODULE_GITHASH) -prerequisites-for-module-auth-spnego: - MODULE_BUILD_DEPENDS_auth_spnego=krb5-dev define MODULE_POST_auth_spnego diff --git a/alpine/Makefile.module-encrypted-session b/alpine/Makefile.module-encrypted-session index 8d251aea..b7a2f0f3 100644 --- a/alpine/Makefile.module-encrypted-session +++ b/alpine/Makefile.module-encrypted-session @@ -18,8 +18,6 @@ MODULE_SOURCES_encrypted_session= ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz MODULE_CONFARGS_encrypted_session= --add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) \ --add-dynamic-module=$(MODSRC_PREFIX)encrypted-session-nginx-module-$(ENCRYPTED_SESSION_NGINX_MODULE_VERSION) -prerequisites-for-module-encrypted-session: module-ndk - MODULE_DEPENDS_encrypted_session=$(NDK_DEPENDENCY_TAG) define MODULE_PREINSTALL_encrypted_session diff --git a/alpine/Makefile.module-fips-check b/alpine/Makefile.module-fips-check index d0d1378c..d215d46b 100644 --- a/alpine/Makefile.module-fips-check +++ b/alpine/Makefile.module-fips-check @@ -17,8 +17,6 @@ MODULE_PATCHES_fips_check= $(CONTRIB)/src/nginx-fips-check-module/0001-Added-sup MODULE_CONFARGS_fips_check= --add-dynamic-module=$(MODSRC_PREFIX)nginx-fips-check-module-$(NGINX_FIPS_CHECK_MODULE_VERSION) -prerequisites-for-module-fips-check: - define MODULE_POST_fips_check cat < Date: Thu, 13 Aug 2026 12:59:57 -0700 Subject: [PATCH 2/5] contrib: added pkg-oss-tests This repository holds the tests for third party modules (cherry picked from commit fefe0d70b23cfb5c9b25865f7ef58c38a7ac1a99) --- contrib/src/pkg-oss-tests/Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 contrib/src/pkg-oss-tests/Makefile diff --git a/contrib/src/pkg-oss-tests/Makefile b/contrib/src/pkg-oss-tests/Makefile new file mode 100644 index 00000000..b538e115 --- /dev/null +++ b/contrib/src/pkg-oss-tests/Makefile @@ -0,0 +1,13 @@ +# pkg-oss-tests + +PKG_OSS_TESTS_URL := https://github.com/nginx/pkg-oss-tests + +$(TARBALLS)/pkg-oss-tests: + git clone $(PKG_OSS_TESTS_URL) $@ + +.sum-pkg-oss-tests: pkg-oss-tests ; + +clean: clean-pkg-oss-tests + +clean-pkg-oss-tests: + $(RM) -R $(TARBALLS)/pkg-oss-tests From b5225a8d1e3f088f91b97e1eb3ba67e5538ea343 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Wed, 26 Aug 2026 12:41:03 -0700 Subject: [PATCH 3/5] CI: Split the jobs to base and modules This allows us to cache the nginx binary so the modules dont have to build it all over again (cherry picked from commit a2b75f2706e351c2ab25d3a1354899db2aad22ad) --- .github/workflows/ci.yml | 159 +++++++++++++++++++++++++++++++++++---- 1 file changed, 145 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee3e6bd3..8fa0a780 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: for target in $(make list-all-modules | cut -d ' ' -f 1); do targets="$targets module-$target"; done - echo targets="base $targets" >> $GITHUB_ENV + echo targets="$targets" >> $GITHUB_ENV - name: set-matrix id: set-matrix @@ -38,8 +38,58 @@ jobs: jq -nRr '"matrix-" + $os +"=" + ( { include: [ $ARGS.positional[] | {target: . } ] } | tojson)' --arg os $os --args ${targets/ module-geoip/} >> $GITHUB_OUTPUT done - alpine: + alpine-base: + runs-on: ubuntu-24.04 + container: alpine:3.24 + defaults: + run: + shell: sh -e {0} needs: generate-matrix + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Setup Alpine Linux + run: | + apk add \ + abuild \ + build-base \ + coreutils \ + curl \ + findutils \ + git \ + make \ + xz + printf "#!/bin/sh\\nSETFATTR=true /usr/bin/abuild -F \"\$@\"\\n" > /usr/local/bin/abuild + chmod +x /usr/local/bin/abuild + + - name: Create build depends for base + working-directory: alpine + run: | + make abuild-base + + - name: Install build depends for base + working-directory: alpine + run: | + apk add $(. ./abuild-base/APKBUILD; echo $makedepends;) + + - name: Build base + working-directory: alpine + run: | + make base + + - name: Upload nginx binary + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: nginx-binary-alpine + path: alpine/base/nginx + + - name: List what has been built + if: ${{ !cancelled() }} + run: | + find ~/packages/alpine -type f | xargs ls -ld + + alpine: + needs: [generate-matrix, alpine-base] runs-on: ubuntu-24.04 container: alpine:3.24 defaults: @@ -93,9 +143,52 @@ jobs: run: | find ~/packages/alpine -type f | xargs ls -ld - ubuntu: + ubuntu-base: runs-on: ubuntu-24.04 needs: generate-matrix + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Setup Ubuntu + run: | + sudo apt-get update + sudo apt-get install -y --no-install-suggests --no-install-recommends \ + curl \ + devscripts \ + equivs \ + git \ + libxml2-utils \ + lsb-release \ + xsltproc + + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 #v1 + with: + toolchain: 1.86.0 + + - name: Build base + working-directory: debian + run: | + NGINX_VERSION=$(make --eval 'nv:; @echo $(BASE_VERSION)' nv) + make rules-base + sudo mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \ + debuild-base/nginx-${NGINX_VERSION}/debian/control + make base + + - name: Upload nginx binary + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: nginx-binary-ubuntu + path: debian/base/nginx + + - name: List what has been built + if: ${{ !cancelled() }} + run: | + find .. -mindepth 1 -maxdepth 1 -name "*.deb" | xargs ls -ld + + ubuntu: + runs-on: ubuntu-24.04 + needs: [generate-matrix, ubuntu-base] strategy: fail-fast: false matrix: ${{fromJson(needs.generate-matrix.outputs.matrix-ubuntu)}} @@ -134,8 +227,54 @@ jobs: run: | find .. -mindepth 1 -maxdepth 1 -name "*.deb" | xargs ls -ld - redhat: + redhat-base: + runs-on: ubuntu-24.04 needs: generate-matrix + container: almalinux:9 + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Setup AlmaLinux + run: | + dnf makecache + dnf install -y \ + g++ \ + gcc \ + git \ + epel-release \ + libxslt \ + make \ + rpm-build \ + which \ + xz \ + 'dnf-command(config-manager)' + dnf config-manager --set-enabled crb + + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 #v1 + with: + toolchain: 1.86.0 + + - name: Build base + working-directory: rpm/SPECS + run: | + make nginx.spec + dnf -y builddep ./nginx.spec + make base + + - name: Upload nginx binary + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: nginx-binary-redhat + path: rpm/SPECS/base/nginx + + - name: List what has been built + if: ${{ !cancelled() }} + run: | + find rpm/RPMS -type f | xargs ls -ld + + redhat: + needs: [generate-matrix, redhat-base] runs-on: ubuntu-24.04 container: almalinux:9 strategy: @@ -169,16 +308,8 @@ jobs: - name: Create and install build depends for ${{ matrix.target }} and build it working-directory: rpm/SPECS run: | - case ${{ matrix.target }} in - base) - spec="nginx.spec" - ;; - *) - spec="nginx-${{ matrix.target }}.spec" - ;; - esac - make $spec - dnf -y builddep ./${spec} + make nginx-${{ matrix.target }}.spec + dnf -y builddep ./nginx-${{ matrix.target }}.spec make ${{ matrix.target }} - name: List what has been built From c1280845be7c8b032bf9cfb4eee3c864d5dd2a62 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Wed, 26 Aug 2026 17:18:51 -0700 Subject: [PATCH 4/5] Added per-module tests (cherry picked from commit dc7f34ced671bcf5ed271f34b9bd790b7b19dcaf) --- .github/test-env/module-acme.sh | 4 ++ .github/workflows/ci.yml | 124 +++++++++++++++++++++++++++----- alpine/Makefile | 117 +++++++++++++++++------------- debian/Makefile | 122 ++++++++++++++++++------------- rpm/SPECS/Makefile | 117 +++++++++++++++++------------- 5 files changed, 321 insertions(+), 163 deletions(-) create mode 100755 .github/test-env/module-acme.sh diff --git a/.github/test-env/module-acme.sh b/.github/test-env/module-acme.sh new file mode 100755 index 00000000..ad6be6c0 --- /dev/null +++ b/.github/test-env/module-acme.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +PEBBLE=$(find "$GITHUB_WORKSPACE" -path "*/nginx-acme-*/build/get-pebble.pl" -type f 2>/dev/null | head -1) +[ -n "$PEBBLE" ] && echo "TEST_NGINX_PEBBLE_BINARY=$(perl "$PEBBLE")" >> "$GITHUB_ENV" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fa0a780..93c5ecf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,12 +113,26 @@ jobs: findutils \ git \ make \ + perl \ + perl-io-socket-ssl \ + perl-io-socket-inet6 \ + perl-utils \ + perl-cryptx \ + perl-dev \ + perl-fcgi \ + perl-parse-recdescent \ + perl-protocol-websocket \ rustup \ - xz + xz \ + krb5-server \ + krb5 \ + krb5-dev \ + perl-gssapi printf "#!/bin/sh\\nSETFATTR=true /usr/bin/abuild -F \"\$@\"\\n" > /usr/local/bin/abuild chmod +x /usr/local/bin/abuild - name: Install Rust toolchain + if: matrix.target == 'module-acme' uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 #v1 with: toolchain: 1.86.0 @@ -138,6 +152,28 @@ jobs: run: | make ${{ matrix.target }} + - name: Download nginx binary + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: nginx-binary-alpine + path: alpine/base + + - name: Setup test environment for ${{ matrix.target }} + run: | + SETUP="$GITHUB_WORKSPACE/.github/test-env/${{ matrix.target }}.sh" + if [ -f "$SETUP" ]; then bash "$SETUP"; fi + + - name: Test ${{ matrix.target }} + env: + TEST_NGINX_BINARY: "${{ github.workspace }}/alpine/base/nginx" + TEST_NGINX_GLOBALS: "user root;" + working-directory: alpine + run: | + MODULE=${{ matrix.target }} + MODULE=${MODULE#module-} + chmod +x "$TEST_NGINX_BINARY" + make test TEST_MODULES=${MODULE} + - name: List what has been built if: ${{ !cancelled() }} run: | @@ -161,11 +197,6 @@ jobs: lsb-release \ xsltproc - - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 #v1 - with: - toolchain: 1.86.0 - - name: Build base working-directory: debian run: | @@ -204,11 +235,19 @@ jobs: devscripts \ equivs \ git \ + libio-socket-ssl-perl \ + libio-socket-inet6-perl \ libxml2-utils \ lsb-release \ - xsltproc + xsltproc \ + krb5-kdc \ + krb5-admin-server \ + krb5-user \ + libkrb5-dev \ + libgssapi-perl - name: Install Rust toolchain + if: matrix.target == 'module-acme' uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 #v1 with: toolchain: 1.86.0 @@ -222,6 +261,27 @@ jobs: debuild-${{ matrix.target }}/nginx-${NGINX_VERSION}/debian/control make ${{ matrix.target }} + - name: Download nginx binary + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: nginx-binary-ubuntu + path: debian/base + + - name: Setup test environment for ${{ matrix.target }} + run: | + SETUP="$GITHUB_WORKSPACE/.github/test-env/${{ matrix.target }}.sh" + if [ -f "$SETUP" ]; then bash "$SETUP"; fi + + - name: Test ${{ matrix.target }} + env: + TEST_NGINX_BINARY: "${{ github.workspace }}/debian/base/nginx" + working-directory: debian + run: | + MODULE=${{ matrix.target }} + MODULE=${MODULE#module-} + chmod +x "$TEST_NGINX_BINARY" + make test TEST_MODULES=${MODULE} + - name: List what has been built if: ${{ !cancelled() }} run: | @@ -250,11 +310,6 @@ jobs: 'dnf-command(config-manager)' dnf config-manager --set-enabled crb - - name: Install Rust toolchain - uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 #v1 - with: - toolchain: 1.86.0 - - name: Build base working-directory: rpm/SPECS run: | @@ -276,7 +331,9 @@ jobs: redhat: needs: [generate-matrix, redhat-base] runs-on: ubuntu-24.04 - container: almalinux:9 + container: + image: almalinux:9 + options: --init strategy: fail-fast: false matrix: ${{fromJson(needs.generate-matrix.outputs.matrix-redhat )}} @@ -287,20 +344,33 @@ jobs: - name: Setup AlmaLinux run: | dnf makecache + dnf install -y epel-release 'dnf-command(config-manager)' + dnf config-manager --set-enabled crb dnf install -y \ g++ \ gcc \ git \ - epel-release \ libxslt \ make \ + perl \ + perl-Digest-MD5 \ + perl-ExtUtils-Embed \ + perl-IO-Compress \ + perl-IO-Socket-INET6 \ + perl-IO-Socket-SSL \ + perl-JSON \ + perl-JSON-PP \ + perl-Test-Simple \ rpm-build \ which \ xz \ - 'dnf-command(config-manager)' - dnf config-manager --set-enabled crb + krb5-server \ + krb5-workstation \ + krb5-devel \ + perl-GSSAPI - name: Install Rust toolchain + if: matrix.target == 'module-acme' uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 #v1 with: toolchain: 1.86.0 @@ -312,6 +382,28 @@ jobs: dnf -y builddep ./nginx-${{ matrix.target }}.spec make ${{ matrix.target }} + - name: Download nginx binary + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: nginx-binary-redhat + path: rpm/SPECS/base + + - name: Setup test environment for ${{ matrix.target }} + run: | + SETUP="$GITHUB_WORKSPACE/.github/test-env/${{ matrix.target }}.sh" + if [ -f "$SETUP" ]; then bash "$SETUP"; fi + + - name: Test ${{ matrix.target }} + env: + TEST_NGINX_BINARY: "${{ github.workspace }}/rpm/SPECS/base/nginx" + TEST_NGINX_GLOBALS: "user root;" + working-directory: rpm/SPECS + run: | + MODULE=${{ matrix.target }} + MODULE=${MODULE#module-} + chmod +x "$TEST_NGINX_BINARY" + make test TEST_MODULES=${MODULE} + - name: List what has been built if: ${{ !cancelled() }} run: | diff --git a/alpine/Makefile b/alpine/Makefile index d81aea91..a5803d14 100644 --- a/alpine/Makefile +++ b/alpine/Makefile @@ -260,26 +260,47 @@ abuild-module-%: $(BASE_SRC) .deps-module-% fi; \ touch $@ -nginx-tests: +nginx-tests pkg-oss-tests: @{ \ - if [ ! -d "$(CONTRIB)/tarballs/nginx-tests" ]; then \ + if [ ! -d "$(CONTRIB)/tarballs/$@" ]; then \ curdir=`pwd` ; \ - cd $(CONTRIB) && make .sum-nginx-tests ; \ + cd $(CONTRIB) && make .sum-$@ ; \ cd $$curdir ; \ fi ; \ - echo "===> Copying tests from $(CONTRIB)/tarballs/nginx-tests" ; \ - cp -rP $(CONTRIB)/tarballs/nginx-tests nginx-tests ; \ + echo "===> Copying tests from $(CONTRIB)/tarballs/$@" ; \ + cp -rP $(CONTRIB)/tarballs/$@ $@ ; \ } -test: base nginx-tests - @echo "===> Running tests with regular binary/modules" +NDK_MODULES= $(filter-out ndk,$(foreach m,$(MODULES),$(if $(findstring ngx_devel_kit,$(MODULE_CONFARGS_$(call modname, $(m)))),$(m)))) + +test test-debug: base nginx-tests pkg-oss-tests @{ \ + TEST_BIN=nginx ; \ + TEST_SO_SUFFIX= ; \ + case "$@" in \ + *-debug) \ + TEST_BIN="$${TEST_BIN}-debug" \ + TEST_SO_SUFFIX="-debug" \ + ;; \ + esac ; \ + echo "===> Running tests with $$TEST_BIN binary/modules" ; \ pwd=`pwd` ; \ + for m in $(NDK_MODULES); do \ + [ -d module-$$m ] || continue ; \ + [ -d module-ndk ] && break ; \ + echo "===> Building module-ndk, required by module-$$m" ; \ + make module-ndk || exit 1 ; \ + break ; \ + done ; \ globals= ; \ globals_http= ; \ globals_stream= ; \ - for so in `find module-*/ -maxdepth 1 -type f -name "*module.so" | sort -t / -k 2`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ + for m in ndk $(filter-out ndk,$(MODULES)); do \ + [ -d module-$$m ] || continue ; \ + for so in module-$$m/*module$${TEST_SO_SUFFIX}.so; do \ + [ -e "$$so" ] || continue ; \ + globals="$$globals load_module $$pwd/$$so;" ; \ + done ; \ done ; \ if [ -d $$pwd/module-perl ]; then \ globals="$$globals env PERL5LIB=$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl:$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl/blib/arch;" ; \ @@ -288,49 +309,47 @@ test: base nginx-tests globals_http="lua_package_path '$$pwd/abuild-module-lua/src/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/abuild-module-lua/src/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \ globals_stream="$$globals_http" ; \ fi ; \ - cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \ - } - -test-debug: base nginx-tests - @echo "===> Running tests with debug binary/modules" - @{ \ - pwd=`pwd` ; \ - globals= ; \ - globals_http= ; \ - globals_stream= ; \ - for so in `find module-*/ -maxdepth 1 -type f -name "*module-debug.so" | sort -t / -k 2`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ + staged_dirs= ; \ + for m in $(MODULES); do \ + [ -d module-$$m ] || continue ; \ + case $$m in \ + acme) testdir=$$pwd/abuild-module-acme/src/nginx-acme-$(NGINX_ACME_VERSION)/t ;; \ + njs) testdir=$$pwd/abuild-module-njs/src/njs-$(NJS_VERSION)/nginx/t ;; \ + *) testdir=pkg-oss-tests/$$m/t ;; \ + esac ; \ + [ -d "$$testdir" ] || continue ; \ + echo "===> Staging module-$$m tests from $$testdir" ; \ + rm -rf nginx-tests/module-$$m ; \ + cp -r "$$testdir" nginx-tests/module-$$m ; \ + [ -e nginx-tests/module-$$m/lib ] || ln -s ../lib nginx-tests/module-$$m/lib ; \ + staged_dirs="$$staged_dirs module-$$m" ; \ done ; \ - if [ -d $$pwd/module-perl ]; then \ - globals="$$globals env PERL5LIB=$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl:$$pwd/abuild-module-perl/src/$(MODULE_SRCDIR)/objs/src/http/modules/perl/blib/arch;" ; \ + if [ -n "$(TEST_MODULES)" ]; then \ + run_dirs= ; \ + for m in $(TEST_MODULES); do \ + case "$$m" in \ + .) d=. ;; \ + *) d="module-$$m" ;; \ + esac ; \ + if [ -e "nginx-tests/$${d%%/*}" ]; then \ + run_dirs="$$run_dirs $$d" ; \ + else \ + echo "---> $$m: no tests staged, skipping" ; \ + fi ; \ + done ; \ + else \ + run_dirs=". $$staged_dirs" ; \ fi ; \ - if [ -d $$pwd/module-lua -a ! -e nginx-module-lua.skip ]; then \ - globals_http="lua_package_path '$$pwd/abuild-module-lua/src/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/abuild-module-lua/src/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \ - globals_stream="$$globals_http" ; \ - fi ; \ - cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \ - } - -test-modules: $(addprefix test-module-, $(MODULES)) - -test-module-%: base nginx-tests module-% - @{ \ - module=`echo $@ | cut -d '-' -f 3-` ; \ - testdir="$(MODULE_TESTS_$(shell echo $@ | cut -d '-' -f 3-))" ; \ - if [ -z "$$testdir" ]; then \ - echo "---> Skipping, no tests defined for $$module module" ; \ + if [ -z "$$run_dirs" ]; then \ + echo "---> Nothing to test" ; \ exit 0 ; \ fi ; \ - pwd=`pwd` ; \ - globals= ; \ - for so in `find module-$${module}/ -maxdepth 1 -type f -name "*module.so"`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ - done ; \ - if [ ! -d nginx-tests/module-$${module} ]; then \ - cp -r $${pwd}/abuild-module-$${module}/src/$${testdir} nginx-tests/module-$${module} ; \ - ln -fs ../lib nginx-tests/module-$${module}/lib ; \ - fi ; \ - cd nginx-tests/module-$${module} && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \ + cd nginx-tests && \ + TEST_NGINX_BINARY=$$pwd/base/$$TEST_BIN \ + TEST_NGINX_GLOBALS="$$TEST_NGINX_GLOBALS $$globals" \ + TEST_NGINX_GLOBALS_HTTP="$$globals_http" \ + TEST_NGINX_GLOBALS_STREAM="$$globals_stream" \ + prove $$PROVE_ARGS -I$$pwd/nginx-tests/lib $$run_dirs ; \ } check-modules: @@ -374,7 +393,7 @@ check-modules: } clean: - @rm -rf base abuild-base abuild-module-* module-* $(BASE_SRC) nginx-tests .deps-module-* attest-base attest-module-* + @rm -rf base abuild-base abuild-module-* module-* $(BASE_SRC) nginx-tests pkg-oss-tests .deps-module-* attest-base attest-module-* .PHONY: default all modules abuild test test-debug check-modules clean diff --git a/debian/Makefile b/debian/Makefile index e7eed9b5..cb6c0908 100644 --- a/debian/Makefile +++ b/debian/Makefile @@ -348,79 +348,101 @@ rules-module-%: $(BASE_SRC) nginx-module-%.deb-changelog .deps-module-% fi; \ touch $@ -nginx-tests: +nginx-tests pkg-oss-tests: @{ \ - if [ ! -d "$(CONTRIB)/tarballs/nginx-tests" ]; then \ + if [ ! -d "$(CONTRIB)/tarballs/$@" ]; then \ curdir=`pwd` ; \ - cd $(CONTRIB) && make .sum-nginx-tests ; \ + cd $(CONTRIB) && make .sum-$@ ; \ cd $$curdir ; \ fi ; \ - echo "===> Copying tests from $(CONTRIB)/tarballs/nginx-tests" ; \ - cp -rP $(CONTRIB)/tarballs/nginx-tests nginx-tests ; \ + echo "===> Copying tests from $(CONTRIB)/tarballs/$@" ; \ + cp -rP $(CONTRIB)/tarballs/$@ $@ ; \ } -test: base nginx-tests - @echo "===> Running tests with regular binary/modules" +NDK_MODULES= $(filter-out ndk,$(foreach m,$(MODULES),$(if $(findstring ngx_devel_kit,$(MODULE_CONFARGS_$(call modname, $(m)))),$(m)))) + +test test-debug: base nginx-tests pkg-oss-tests @{ \ + TEST_BIN=nginx ; \ + TEST_SO_SUFFIX= ; \ + TEST_PERL_OBJS=build-nginx ; \ + case "$@" in \ + *-debug) \ + TEST_BIN="$${TEST_BIN}-debug" \ + TEST_SO_SUFFIX="-debug" \ + TEST_PERL_OBJS="$${TEST_PERL_OBJS}-debug" \ + ;; \ + esac ; \ + echo "===> Running tests with $$TEST_BIN binary/modules" ; \ pwd=`pwd` ; \ + for m in $(NDK_MODULES); do \ + [ -d module-$$m ] || continue ; \ + [ -d module-ndk ] && break ; \ + echo "===> Building module-ndk, required by module-$$m" ; \ + make module-ndk || exit 1 ; \ + break ; \ + done ; \ globals= ; \ globals_http= ; \ globals_stream= ; \ - for so in `find module-*/ -maxdepth 1 -type f -name "*module.so" | sort -t / -k 2`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ + for m in ndk $(filter-out ndk,$(MODULES)); do \ + [ -d module-$$m ] || continue ; \ + for so in module-$$m/*module$${TEST_SO_SUFFIX}.so; do \ + [ -e "$$so" ] || continue ; \ + globals="$$globals load_module $$pwd/$$so;" ; \ + done ; \ done ; \ if [ -d $$pwd/module-perl ]; then \ - globals="$$globals env PERL5LIB=$$pwd/debuild-module-perl/$(SRCDIR)/debian/build-nginx/objs/src/http/modules/perl:$$pwd/debuild-module-perl/$(SRCDIR)/debian/build-nginx/objs/src/http/modules/perl/blib/arch;" ; \ + globals="$$globals env PERL5LIB=$$pwd/debuild-module-perl/$(SRCDIR)/debian/$$TEST_PERL_OBJS/objs/src/http/modules/perl:$$pwd/debuild-module-perl/$(SRCDIR)/debian/build-nginx/objs/src/http/modules/perl/blib/arch;" ; \ fi ; \ if [ -d $$pwd/module-lua ]; then \ globals_http="lua_package_path '$$pwd/debuild-module-lua/$(SRCDIR)/debian/extra/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/debuild-module-lua/$(SRCDIR)/debian/extra/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \ globals_stream="$$globals_http" ; \ fi ; \ - cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \ - } - -test-debug: base nginx-tests - @echo "===> Running tests with debug binary/modules" - @{ \ - pwd=`pwd` ; \ - globals= ; \ - globals_http= ; \ - globals_stream= ; \ - for so in `find module-*/ -maxdepth 1 -type f -name "*module-debug.so" | sort -t / -k 2`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ + staged_dirs= ; \ + for m in $(MODULES); do \ + [ -d module-$$m ] || continue ; \ + case $$m in \ + acme) testdir=$$pwd/debuild-module-acme/$(SRCDIR)/debian/extra/nginx-acme-$(NGINX_ACME_VERSION)/t ;; \ + njs) testdir=$$pwd/debuild-module-njs/$(SRCDIR)/debian/extra/njs-$(NJS_VERSION)/nginx/t ;; \ + *) testdir=pkg-oss-tests/$$m/t ;; \ + esac ; \ + [ -d "$$testdir" ] || continue ; \ + echo "===> Staging module-$$m tests from $$testdir" ; \ + rm -rf nginx-tests/module-$$m ; \ + cp -r "$$testdir" nginx-tests/module-$$m ; \ + [ -e nginx-tests/module-$$m/lib ] || ln -s ../lib nginx-tests/module-$$m/lib ; \ + staged_dirs="$$staged_dirs module-$$m" ; \ done ; \ - if [ -d $$pwd/module-perl ]; then \ - globals="$$globals env PERL5LIB=$$pwd/debuild-module-perl/$(SRCDIR)/debian/build-nginx-debug/objs/src/http/modules/perl:$$pwd/debuild-module-perl/$(SRCDIR)/debian/build-nginx/objs/src/http/modules/perl/blib/arch;" ; \ - fi ; \ - if [ -d $$pwd/module-lua ]; then \ - globals_http="lua_package_path '$$pwd/debuild-module-lua/$(SRCDIR)/debian/extra/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/debuild-module-lua/$(SRCDIR)/debian/extra/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \ - globals_stream="$$globals_http" ; \ + if [ -n "$(TEST_MODULES)" ]; then \ + run_dirs= ; \ + for m in $(TEST_MODULES); do \ + case "$$m" in \ + .) d=. ;; \ + *) d="module-$$m" ;; \ + esac ; \ + if [ -e "nginx-tests/$${d%%/*}" ]; then \ + run_dirs="$$run_dirs $$d" ; \ + else \ + echo "---> $$m: no tests staged, skipping" ; \ + fi ; \ + done ; \ + else \ + run_dirs=". $$staged_dirs" ; \ fi ; \ - cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \ - } - -test-modules: $(addprefix test-module-, $(MODULES)) - -test-module-%: base nginx-tests module-% - @{ \ - module=`echo $@ | cut -d '-' -f 3-` ; \ - testdir="$(MODULE_TESTS_$(shell echo $@ | cut -d '-' -f 3-))" ; \ - if [ -z "$$testdir" ]; then \ - echo "---> Skipping, no tests defined for $$module module" ; \ + if [ -z "$$run_dirs" ]; then \ + echo "---> Nothing to test" ; \ exit 0 ; \ fi ; \ - pwd=`pwd` ; \ - globals= ; \ - for so in `find module-$${module}/ -maxdepth 1 -type f -name "*module.so"`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ - done ; \ - if [ ! -d nginx-tests/module-$${module} ]; then \ - cp -r $${pwd}/debuild-module-$${module}/$(SRCDIR)/debian/extra/$${testdir} nginx-tests/module-$${module} ; \ - ln -fs ../lib nginx-tests/module-$${module}/lib ; \ - fi ; \ - cd nginx-tests/module-$${module} && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \ + cd nginx-tests && \ + TEST_NGINX_BINARY=$$pwd/base/$$TEST_BIN \ + TEST_NGINX_GLOBALS="$$TEST_NGINX_GLOBALS $$globals" \ + TEST_NGINX_GLOBALS_HTTP="$$globals_http" \ + TEST_NGINX_GLOBALS_STREAM="$$globals_stream" \ + prove $$PROVE_ARGS -I$$pwd/nginx-tests/lib $$run_dirs ; \ } + check-modules: @{ \ files=$@-files ; \ @@ -462,7 +484,7 @@ check-modules: } clean: - @rm -rf base module-* rules-base rules-module-* debuild-base debuild-module-* nginx-tests $(BASE_SRC) .deps-module-* + @rm -rf base module-* rules-base rules-module-* debuild-base debuild-module-* nginx-tests pkg-oss-tests $(BASE_SRC) .deps-module-* @rm -f nginx.deb-changelog nginx-*.deb-changelog nginx-module-*.deb-changelog nginx-module-*.skip @rm -f attest-base attest-module-* diff --git a/rpm/SPECS/Makefile b/rpm/SPECS/Makefile index 0937dbc1..c4e4b483 100644 --- a/rpm/SPECS/Makefile +++ b/rpm/SPECS/Makefile @@ -369,26 +369,47 @@ check-compat-%: ;; \ esac -nginx-tests: +nginx-tests pkg-oss-tests: @{ \ - if [ ! -d "$(CONTRIB)/tarballs/nginx-tests" ]; then \ + if [ ! -d "$(CONTRIB)/tarballs/$@" ]; then \ curdir=`pwd` ; \ - cd $(CONTRIB) && make .sum-nginx-tests ; \ + cd $(CONTRIB) && make .sum-$@ ; \ cd $$curdir ; \ fi ; \ - echo "===> Copying tests from $(CONTRIB)/tarballs/nginx-tests" ; \ - cp -rP $(CONTRIB)/tarballs/nginx-tests nginx-tests ; \ + echo "===> Copying tests from $(CONTRIB)/tarballs/$@" ; \ + cp -rP $(CONTRIB)/tarballs/$@ $@ ; \ } -test: base nginx-tests - @echo "===> Running tests with regular binary/modules" +NDK_MODULES= $(filter-out ndk,$(foreach m,$(MODULES),$(if $(findstring ngx_devel_kit,$(MODULE_CONFARGS_$(call modname, $(m)))),$(m)))) + +test test-debug: base nginx-tests pkg-oss-tests @{ \ + TEST_BIN=nginx ; \ + TEST_SO_SUFFIX= ; \ + case "$@" in \ + *-debug) \ + TEST_BIN="$${TEST_BIN}-debug" \ + TEST_SO_SUFFIX="-debug" \ + ;; \ + esac ; \ + echo "===> Running tests with $$TEST_BIN binary/modules" ; \ pwd=`pwd` ; \ + for m in $(NDK_MODULES); do \ + [ -d module-$$m ] || continue ; \ + [ -d module-ndk ] && break ; \ + echo "===> Building module-ndk, required by module-$$m" ; \ + make module-ndk || exit 1 ; \ + break ; \ + done ; \ globals= ; \ globals_http= ; \ globals_stream= ; \ - for so in `find module-*/ -maxdepth 1 -type f -name "*module.so" | sort -t / -k 2`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ + for m in ndk $(filter-out ndk,$(MODULES)); do \ + [ -d module-$$m ] || continue ; \ + for so in module-$$m/*module$${TEST_SO_SUFFIX}.so; do \ + [ -e "$$so" ] || continue ; \ + globals="$$globals load_module $$pwd/$$so;" ; \ + done ; \ done ; \ if [ -d $$pwd/module-perl ]; then \ globals="$$globals env PERL5LIB=$$pwd/module-perl/src/http/modules/perl:$$pwd/module-perl/src/http/modules/perl/blib/arch;" ; \ @@ -397,55 +418,55 @@ test: base nginx-tests globals_http="lua_package_path '$$pwd/../BUILD/$(MODULE_PACKAGE_PREFIX)-lua-$(BASE_VERSION)/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/../BUILD/$(MODULE_PACKAGE_PREFIX)-lua-$(BASE_VERSION)/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \ globals_stream="$$globals_http" ; \ fi ; \ - cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \ - } - -test-debug: base nginx-tests - @echo "===> Running tests with debug binary/modules" - @{ \ - pwd=`pwd` ; \ - globals= ; \ - globals_http= ; \ - globals_stream= ; \ - for so in `find module-*/ -maxdepth 1 -type f -name "*module-debug.so" | sort -t / -k 2`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ + staged_dirs= ; \ + for m in $(MODULES); do \ + [ -d module-$$m ] || continue ; \ + case $$m in \ + acme) testdir=$$pwd/module-acme/../nginx-acme-$(NGINX_ACME_VERSION)/t ;; \ + njs) testdir=$$pwd/module-njs/../njs-$(NJS_VERSION)/nginx/t ;; \ + *) testdir=pkg-oss-tests/$$m/t ;; \ + esac ; \ + [ -d "$$testdir" ] || continue ; \ + echo "===> Staging module-$$m tests from $$testdir" ; \ + rm -rf nginx-tests/module-$$m ; \ + cp -r "$$testdir" nginx-tests/module-$$m ; \ + [ -e nginx-tests/module-$$m/lib ] || ln -s ../lib nginx-tests/module-$$m/lib ; \ + staged_dirs="$$staged_dirs module-$$m" ; \ done ; \ - if [ -d $$pwd/module-perl ]; then \ - globals="$$globals env PERL5LIB=$$pwd/module-perl/src/http/modules/perl:$$pwd/module-perl/src/http/modules/perl/blib/arch;" ; \ - fi ; \ - if [ -d $$pwd/module-lua ]; then \ - globals_http="lua_package_path '$$pwd/../BUILD/$(MODULE_PACKAGE_PREFIX)-lua-$(BASE_VERSION)/lua-resty-core-$(LUA_RESTY_CORE_VERSION)/lib/?.lua;$$pwd/../BUILD/$(MODULE_PACKAGE_PREFIX)-lua-$(BASE_VERSION)/lua-resty-lrucache-$(LUA_RESTY_LRUCACHE_VERSION)/lib/?.lua;;';" ; \ - globals_stream="$$globals_http" ; \ + if [ -n "$(TEST_MODULES)" ]; then \ + run_dirs= ; \ + for m in $(TEST_MODULES); do \ + case "$$m" in \ + .) d=. ;; \ + *) d="module-$$m" ;; \ + esac ; \ + if [ -e "nginx-tests/$${d%%/*}" ]; then \ + run_dirs="$$run_dirs $$d" ; \ + else \ + echo "---> $$m: no tests staged, skipping" ; \ + fi ; \ + done ; \ + else \ + run_dirs=". $$staged_dirs" ; \ fi ; \ - cd nginx-tests && TEST_NGINX_BINARY=$$pwd/base/nginx-debug TEST_NGINX_GLOBALS="$$globals" TEST_NGINX_GLOBALS_HTTP="$$globals_http" TEST_NGINX_GLOBALS_STREAM="$$globals_stream" prove $$PROVE_ARGS . ; \ - } - -test-modules: $(addprefix test-module-, $(MODULES)) - -test-module-%: base nginx-tests module-% - @{ \ - module=`echo $@ | cut -d '-' -f 3-` ; \ - testdir="$(MODULE_TESTS_$(shell echo $@ | cut -d '-' -f 3-))" ; \ - if [ -z "$$testdir" ]; then \ - echo "---> Skipping, no tests defined for $$module module" ; \ + if [ -z "$$run_dirs" ]; then \ + echo "---> Nothing to test" ; \ exit 0 ; \ fi ; \ - pwd=`pwd` ; \ - globals= ; \ - for so in `find module-$${module}/ -maxdepth 1 -type f -name "*module.so"`; do \ - globals="$$globals load_module $$pwd/$$so;" ; \ - done ; \ - if [ ! -d nginx-tests/module-$${module} ]; then \ - cp -r $${pwd}/module-$${module}/../$${testdir} nginx-tests/module-$${module} ; \ - ln -fs ../lib nginx-tests/module-$${module}/lib ; \ - fi ; \ - cd nginx-tests/module-$${module} && TEST_NGINX_BINARY=$$pwd/base/nginx TEST_NGINX_GLOBALS="$$globals" prove $$PROVE_ARGS . ; \ + cd nginx-tests && \ + TEST_NGINX_BINARY=$$pwd/base/$$TEST_BIN \ + TEST_NGINX_GLOBALS="$$TEST_NGINX_GLOBALS $$globals" \ + TEST_NGINX_GLOBALS_HTTP="$$globals_http" \ + TEST_NGINX_GLOBALS_STREAM="$$globals_stream" \ + prove $$PROVE_ARGS -I$$pwd/nginx-tests/lib $$run_dirs ; \ } + clean: @rm -f base module-* @rm -f nginx.spec nginx-module-*.spec nginx-module-*.skip @rm -rf nginx-tests + @rm -rf pkg-oss-tests @rm -f $(BASE_SRC) $(SRCPATH)/$(BASE_SRC) @rm -f nginx.rpm-changelog nginx-*.rpm-changelog nginx-module-*.rpm-changelog @rm -f .deps-module-* From 45b2ccdef03f09dc660b6dfae8868d54fb957bf7 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Thu, 6 Aug 2026 16:42:03 -0700 Subject: [PATCH 5/5] ndk: added a patch fixing module functionality with recent nginx (cherry picked from commit 28c84f09900f43cb7d7c8f239b659633c8aeded6) --- alpine/Makefile.module-ndk | 2 + ...plex-value-end-code-for-nginx-1.31.3.patch | 111 ++++++++++++++++++ debian/Makefile.module-ndk | 2 + rpm/SPECS/Makefile.module-ndk | 2 + 4 files changed, 117 insertions(+) create mode 100644 contrib/src/ngx_devel_kit/0001-fix-complex-value-end-code-for-nginx-1.31.3.patch diff --git a/alpine/Makefile.module-ndk b/alpine/Makefile.module-ndk index 7501a679..80176f82 100644 --- a/alpine/Makefile.module-ndk +++ b/alpine/Makefile.module-ndk @@ -15,6 +15,8 @@ MODULE_SOURCES_ndk= ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz MODULE_CONFARGS_ndk= --add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) +MODULE_PATCHES_ndk= $(CONTRIB)/src/ngx_devel_kit/0001-fix-complex-value-end-code-for-nginx-1.31.3.patch + MODULE_CC_OPT_ndk=-DNDK_SET_VAR -DNDK_UPSTREAM_LIST MODULE_CC_OPT_DEBUG_ndk=$(MODULE_CC_OPT_ndk) diff --git a/contrib/src/ngx_devel_kit/0001-fix-complex-value-end-code-for-nginx-1.31.3.patch b/contrib/src/ngx_devel_kit/0001-fix-complex-value-end-code-for-nginx-1.31.3.patch new file mode 100644 index 00000000..665f29bd --- /dev/null +++ b/contrib/src/ngx_devel_kit/0001-fix-complex-value-end-code-for-nginx-1.31.3.patch @@ -0,0 +1,111 @@ +From 585069fdf71966d6355033038e3d5868ed64f87a Mon Sep 17 00:00:00 2001 +From: Sergii Negodiuk +Date: Thu, 16 Jul 2026 01:17:57 +0300 +Subject: [PATCH 1/2] Fix complex value scripts after nginx script engine + change + +--- + src/ndk_rewrite.c | 23 +++++++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +diff --git a/src/ndk_rewrite.c b/src/ndk_rewrite.c +index 77ce9f8..2a06715 100644 +--- a/src/ndk_rewrite.c ++++ b/src/ndk_rewrite.c +@@ -5,6 +5,13 @@ + * be provided later to un-define them as being static + */ + ++/* Added in nginx 1.31.3 and backported to 1.30.4; not in freenginx. */ ++#if !defined(freenginx) \ ++ && (nginx_version >= 1030004) \ ++ && (nginx_version < 1031000 || nginx_version >= 1031003) ++#define NDK_HAVE_HTTP_SCRIPT_COMPLEX_VALUE_END_CODE ++#endif ++ + + uintptr_t ndk_http_script_exit_code = (uintptr_t) NULL; + +@@ -17,6 +24,9 @@ ndk_http_rewrite_value (ngx_conf_t *cf, ndk_http_rewrite_loc_conf_t *lcf, + ngx_http_script_compile_t sc; + ngx_http_script_value_code_t *val; + ngx_http_script_complex_value_code_t *complex; ++#ifdef NDK_HAVE_HTTP_SCRIPT_COMPLEX_VALUE_END_CODE ++ ngx_http_script_complex_value_end_code_t *complex_end; ++#endif + + n = ngx_http_script_variables_count(value); + +@@ -63,6 +73,17 @@ ndk_http_rewrite_value (ngx_conf_t *cf, ndk_http_rewrite_loc_conf_t *lcf, + return NGX_CONF_ERROR; + } + ++#ifdef NDK_HAVE_HTTP_SCRIPT_COMPLEX_VALUE_END_CODE ++ complex_end = ngx_http_script_add_code(lcf->codes, ++ sizeof(ngx_http_script_complex_value_end_code_t), ++ &complex); ++ if (complex_end == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ complex_end->code = ngx_http_script_complex_value_end_code; ++#endif ++ + return NGX_CONF_OK; + } + +@@ -99,5 +120,3 @@ ndk_http_rewrite_var (ngx_http_request_t *r, ngx_http_variable_value_t *v, + + return NGX_OK; + } +- +- + +From d1f4906c473c8509262e249295fc2bb9ef70644e Mon Sep 17 00:00:00 2001 +From: Sergii Negodiuk +Date: Thu, 16 Jul 2026 14:17:13 +0300 +Subject: [PATCH 2/2] Move nginx feature guard to rewrite header + +--- + src/ndk_rewrite.c | 8 -------- + src/ndk_rewrite.h | 8 ++++++++ + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/ndk_rewrite.c b/src/ndk_rewrite.c +index 2a06715..9f4f2a0 100644 +--- a/src/ndk_rewrite.c ++++ b/src/ndk_rewrite.c +@@ -5,14 +5,6 @@ + * be provided later to un-define them as being static + */ + +-/* Added in nginx 1.31.3 and backported to 1.30.4; not in freenginx. */ +-#if !defined(freenginx) \ +- && (nginx_version >= 1030004) \ +- && (nginx_version < 1031000 || nginx_version >= 1031003) +-#define NDK_HAVE_HTTP_SCRIPT_COMPLEX_VALUE_END_CODE +-#endif +- +- + uintptr_t ndk_http_script_exit_code = (uintptr_t) NULL; + + +diff --git a/src/ndk_rewrite.h b/src/ndk_rewrite.h +index 2479aa2..b0ae283 100644 +--- a/src/ndk_rewrite.h ++++ b/src/ndk_rewrite.h +@@ -3,6 +3,14 @@ + /* TODO : should remove this when not needed */ + + ++/* Added in nginx 1.31.3 and backported to 1.30.4; not in freenginx. */ ++#if !defined(freenginx) \ ++ && (nginx_version >= 1030004) \ ++ && (nginx_version < 1031000 || nginx_version >= 1031003) ++#define NDK_HAVE_HTTP_SCRIPT_COMPLEX_VALUE_END_CODE ++#endif ++ ++ + + /* used for plugging into the rewrite module (taken from the rewrite module) */ + diff --git a/debian/Makefile.module-ndk b/debian/Makefile.module-ndk index 16bbf964..2cfbc355 100644 --- a/debian/Makefile.module-ndk +++ b/debian/Makefile.module-ndk @@ -15,6 +15,8 @@ MODULE_SOURCES_ndk= ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz MODULE_CONFARGS_ndk= --add-dynamic-module=$(MODSRC_PREFIX)ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) +MODULE_PATCHES_ndk= $(CONTRIB)/src/ngx_devel_kit/0001-fix-complex-value-end-code-for-nginx-1.31.3.patch + MODULE_CC_OPT_ndk=-DNDK_SET_VAR -DNDK_UPSTREAM_LIST MODULE_CC_OPT_DEBUG_ndk=$(MODULE_CC_OPT_ndk) diff --git a/rpm/SPECS/Makefile.module-ndk b/rpm/SPECS/Makefile.module-ndk index b9a216c0..dedde83f 100644 --- a/rpm/SPECS/Makefile.module-ndk +++ b/rpm/SPECS/Makefile.module-ndk @@ -15,6 +15,8 @@ MODULE_SOURCES_ndk= ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION).tar.gz MODULE_CONFARGS_ndk= --add-dynamic-module=ngx_devel_kit-$(NGX_DEVEL_KIT_VERSION) +MODULE_PATCHES_ndk= $(CONTRIB)/src/ngx_devel_kit/0001-fix-complex-value-end-code-for-nginx-1.31.3.patch + MODULE_CC_OPT_ndk=-DNDK_SET_VAR -DNDK_UPSTREAM_LIST MODULE_CC_OPT_DEBUG_ndk=$(MODULE_CC_OPT_ndk)