From 204bbe12e6b775c568a64f14c504434baa52b8f6 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sat, 1 Oct 2022 14:47:15 +0200 Subject: [PATCH] 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 00000000000..da70e2081bc --- /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 00000000000..da70e2081bc --- /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 00000000000..9505dd5607a --- /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 00000000000..c4f62854ce5 --- /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 00000000000..f322c69b454 --- /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 1a6142d49fc..2b1d472d7a8 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 " 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}"