Page MenuHomeFreeBSD

D59121.id185101.diff
No OneTemporary

D59121.id185101.diff

diff --git a/www/Makefile b/www/Makefile
--- a/www/Makefile
+++ b/www/Makefile
@@ -530,6 +530,7 @@
SUBDIR += nginx-lite
SUBDIR += nginx-module-lua
SUBDIR += nginx-module-lua-stream
+ SUBDIR += nginx-module-njs
SUBDIR += nginx-naxsi
SUBDIR += nginx-prometheus-exporter
SUBDIR += nginx-ultimate-bad-bot-blocker
diff --git a/www/nginx-module-njs/Makefile b/www/nginx-module-njs/Makefile
new file mode 100644
--- /dev/null
+++ b/www/nginx-module-njs/Makefile
@@ -0,0 +1,63 @@
+PORTNAME= nginx-module-njs
+PORTVERSION= ${NGINX_VERSION}+${NJS_NGINX_VER}
+CATEGORIES= www
+MASTER_SITES= https://nginx.org/download/:nginx
+DISTFILES= nginx-${NGINX_VERSION}.tar.gz:nginx
+
+MAINTAINER= joneum@FreeBSD.org
+COMMENT= Nginx JavaScript dynamic module
+WWW= https://nginx.org/en/docs/njs/
+
+LICENSE= BSD2CLAUSE
+
+LIB_DEPENDS= libpcre2-8.so:devel/pcre2 \
+ libquickjs.so:lang/quickjs \
+ libxslt.so:textproc/libxslt
+RUN_DEPENDS= nginx>=${NGINX_VERSION}:www/nginx
+
+USES= compiler:c11 gmake gnome cpe
+CPE_VENDOR= f5 # TODO: get from MASTERDIR
+CPE_PRODUCT= nginx # TODO: get from MASTERDIR
+USE_GITHUB= nodefault
+GH_TUPLE= ${NJS_GH_TUPLE}
+USE_GNOME= libxml2
+
+CONFIGURE_ARGS+= \
+ --add-dynamic-module=${WRKSRC_njs}/nginx \
+ --with-cc-opt="-I ${LOCALBASE}/include -I ${LOCALBASE}/include/quickjs" \
+ --with-ld-opt="-L ${LOCALBASE}/lib" \
+ --with-compat \
+ --with-stream
+
+FILESDIR= ${.CURDIR}/files # Override MASTERDIR
+MASTERDIR= ${.CURDIR}/../nginx
+PATCHDIR= ${.CURDIR}/files # Override MASTERDIR
+
+.include "${MASTERDIR}/version.mk"
+.include "${MASTERDIR}/Makefile.extmod"
+
+WRKSRC= ${WRKDIR}/nginx-${NGINX_VERSION}
+
+DESCR= ${.CURDIR}/pkg-descr # Override MASTERDIR
+PLIST= ${.CURDIR}/pkg-plist # Override MASTERDIR
+PLIST_FILES= libexec/nginx/ngx_http_js_module.so \
+ libexec/nginx/ngx_stream_js_module.so
+
+OPTIONS_GROUP= # unset from Makefile.extmod to please portlint
+
+_MODULESDIR= ${PREFIX}/libexec/nginx
+
+do-configure:
+ cd ${WRKSRC} && \
+ ${SETENV} ${CONFIGURE_ENV} ./configure ${CONFIGURE_ARGS}
+
+do-build:
+ cd ${WRKSRC} && \
+ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} modules
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${_MODULESDIR}
+ (cd ${WRKSRC}/objs/ && ${FIND} . -name '*.so' -maxdepth 1 -type f \
+ -exec ${INSTALL_LIB} {} ${STAGEDIR}${_MODULESDIR} \;)
+
+.include <bsd.port.mk>
diff --git a/www/nginx-module-njs/pkg-descr b/www/nginx-module-njs/pkg-descr
new file mode 100644
--- /dev/null
+++ b/www/nginx-module-njs/pkg-descr
@@ -0,0 +1,8 @@
+Njs is an nginx module that extends the server's functionality through
+JavaScript scripting, enabling the creation of custom server-side logic.
+
+Use cases:
+- Complex access control and security checks in njs before a request
+ reaches an upstream server
+- Manipulating response headers
+- Writing flexible asynchronous content handlers and filters
diff --git a/www/nginx/Makefile.extmod b/www/nginx/Makefile.extmod
--- a/www/nginx/Makefile.extmod
+++ b/www/nginx/Makefile.extmod
@@ -240,7 +240,8 @@
NAXSI_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-naxsi-libinjection__sqli_c \
${PATCHDIR}/extra-patch-naxsi_config
-NJS_GH_TUPLE= nginx:njs:1.0.0:njs
+NJS_NGINX_VER= 1.0.0
+NJS_GH_TUPLE= nginx:njs:${NJS_NGINX_VER}:njs
NJS_VARS= DSO_EXTMODS+=njs NJS_SUBDIR=/nginx
NJS_IMPLIES= STREAM

File Metadata

Mime Type
text/plain
Expires
Sat, Sep 12, 8:46 AM (6 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38780482
Default Alt Text
D59121.id185101.diff (3 KB)

Event Timeline