summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg A. Mamontov <oleg@mamontov.net>2023-08-31 00:00:56 +0300
committerRobert Clausecker <fuz@FreeBSD.org>2023-09-10 12:13:01 -0400
commit2043de1ccc788dae5a870aac0d57fce1c7521f06 (patch)
treeaeb0f43192413df2196ca66587e7927aa7f583e4
parent2f692bf9576af6cc4b6ce44a7a52b7baccb92ace (diff)
downloadfreebsd-ports-2043de1ccc788dae5a870aac0d57fce1c7521f06.zip
www/angie-module-postgres: Angie postgres dynamic module
This is an upstream module that allows Angie to communicate directly with PostgreSQL database. PR: Angie postgres dynamic module
-rw-r--r--www/Makefile1
-rw-r--r--www/angie-module-postgres/Makefile24
-rw-r--r--www/angie-module-postgres/files/patch-ngx_postgres-default_port17
-rw-r--r--www/angie-module-postgres/files/patch-ngx_postgres-dynamic26
-rw-r--r--www/angie-module-postgres/files/patch-ngx_postgres-subrequest_in_memory18
-rw-r--r--www/angie-module-postgres/files/pkg-message.in15
-rw-r--r--www/angie-module-postgres/pkg-descr2
-rw-r--r--www/angie-module-postgres/pkg-plist3
8 files changed, 106 insertions, 0 deletions
diff --git a/www/Makefile b/www/Makefile
index ab07dfcccc79..1dab0aa27334 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -42,6 +42,7 @@
SUBDIR += angie-module-ndk
SUBDIR += angie-module-njs
SUBDIR += angie-module-perl
+ SUBDIR += angie-module-postgres
SUBDIR += angie-module-redis2
SUBDIR += angie-module-xslt
SUBDIR += anyremote2html
diff --git a/www/angie-module-postgres/Makefile b/www/angie-module-postgres/Makefile
new file mode 100644
index 000000000000..b672ce013b86
--- /dev/null
+++ b/www/angie-module-postgres/Makefile
@@ -0,0 +1,24 @@
+PORTNAME= angie-module-postgres
+GH_TUPLE= FRiCKLE:ngx_postgres:1.0rc7:module
+
+COMMENT= Angie postgres dynamic module
+
+USES= pgsql
+
+MASTERDIR= ${.CURDIR}/../../www/angie
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${DOCSDIR}
+ ${MKDIR} ${STAGEDIR}${MODDIR}
+
+ ${INSTALL_LIB} ${WRKSRC}/objs/ngx_postgres_module.so \
+ ${STAGEDIR}${MODDIR}
+
+ ${INSTALL_MAN} ${WRKSRC_module}/README.md ${STAGEDIR}${DOCSDIR}
+
+do-install-DEBUG-on:
+ ${INSTALL} ${COPY} -m ${_SHAREMODE} \
+ ${WRKSRC_DEBUG}/objs/ngx_postgres_module.so \
+ ${STAGEDIR}${MODDIR}/ngx_postgres_module-debug.so
+
+.include "${MASTERDIR}/Makefile"
diff --git a/www/angie-module-postgres/files/patch-ngx_postgres-default_port b/www/angie-module-postgres/files/patch-ngx_postgres-default_port
new file mode 100644
index 000000000000..3dbdf4e7c71c
--- /dev/null
+++ b/www/angie-module-postgres/files/patch-ngx_postgres-default_port
@@ -0,0 +1,17 @@
+--- ../ngx_postgres-1.0rc7/src/ngx_postgres_module.c.orig
++++ ../ngx_postgres-1.0rc7/src/ngx_postgres_module.c
+@@ -1320,12 +1320,14 @@
+ continue;
+ }
+
++#if (nginx_version < 1011006)
+ if (uscfp[i]->default_port && url->default_port
+ && (uscfp[i]->default_port != url->default_port))
+ {
+ dd("default_port doesn't match");
+ continue;
+ }
++#endif
+
+ dd("returning");
+ return uscfp[i];
diff --git a/www/angie-module-postgres/files/patch-ngx_postgres-dynamic b/www/angie-module-postgres/files/patch-ngx_postgres-dynamic
new file mode 100644
index 000000000000..596d3eb3bba9
--- /dev/null
+++ b/www/angie-module-postgres/files/patch-ngx_postgres-dynamic
@@ -0,0 +1,26 @@
+--- ../ngx_postgres-1.0rc7/config.orig
++++ ../ngx_postgres-1.0rc7/config
+@@ -205,6 +205,16 @@
+
+ ngx_addon_name=ngx_postgres
+
++if [ -f auto/module ] ; then
++ ngx_module_type=HTTP
++ ngx_module_name=ngx_postgres_module
++ ngx_module_incs=$ngx_feature_path
++ ngx_module_libs=$ngx_feature_libs
++ ngx_module_srcs="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_postgres_escape.c $ngx_addon_dir/src/ngx_postgres_handler.c $ngx_addon_dir/src/ngx_postgres_keepalive.c $ngx_addon_dir/src/ngx_postgres_module.c $ngx_addon_dir/src/ngx_postgres_output.c $ngx_addon_dir/src/ngx_postgres_processor.c $ngx_addon_dir/src/ngx_postgres_rewrite.c $ngx_addon_dir/src/ngx_postgres_upstream.c $ngx_addon_dir/src/ngx_postgres_util.c $ngx_addon_dir/src/ngx_postgres_variable.c"
++ . auto/module
++
++else
++
+ HTTP_MODULES="$HTTP_MODULES ngx_postgres_module"
+
+ CORE_INCS="$CORE_INCS $ngx_feature_path"
+@@ -213,4 +223,6 @@
+ NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_postgres_escape.c $ngx_addon_dir/src/ngx_postgres_handler.c $ngx_addon_dir/src/ngx_postgres_keepalive.c $ngx_addon_dir/src/ngx_postgres_module.c $ngx_addon_dir/src/ngx_postgres_output.c $ngx_addon_dir/src/ngx_postgres_processor.c $ngx_addon_dir/src/ngx_postgres_rewrite.c $ngx_addon_dir/src/ngx_postgres_upstream.c $ngx_addon_dir/src/ngx_postgres_util.c $ngx_addon_dir/src/ngx_postgres_variable.c"
+ NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ngx_postgres_escape.h $ngx_addon_dir/src/ngx_postgres_handler.h $ngx_addon_dir/src/ngx_postgres_keepalive.h $ngx_addon_dir/src/ngx_postgres_module.h $ngx_addon_dir/src/ngx_postgres_output.h $ngx_addon_dir/src/ngx_postgres_processor.h $ngx_addon_dir/src/ngx_postgres_rewrite.h $ngx_addon_dir/src/ngx_postgres_upstream.h $ngx_addon_dir/src/ngx_postgres_util.h $ngx_addon_dir/src/ngx_postgres_variable.h $ngx_addon_dir/src/ngx_postgres_ddebug.h $ngx_addon_dir/src/resty_dbd_stream.h"
+
++fi
++
+ have=NGX_POSTGRES_MODULE . auto/have
diff --git a/www/angie-module-postgres/files/patch-ngx_postgres-subrequest_in_memory b/www/angie-module-postgres/files/patch-ngx_postgres-subrequest_in_memory
new file mode 100644
index 000000000000..045f74357b47
--- /dev/null
+++ b/www/angie-module-postgres/files/patch-ngx_postgres-subrequest_in_memory
@@ -0,0 +1,18 @@
+--- ../ngx_postgres-1.0rc7/src/ngx_postgres_handler.c.orig
++++ ../ngx_postgres-1.0rc7/src/ngx_postgres_handler.c
+@@ -52,6 +52,7 @@
+
+ dd("entering");
+
++#if defined(nginx_version) && (nginx_version < 13010)
+ if (r->subrequest_in_memory) {
+ /* TODO: add support for subrequest in memory by
+ * emitting output into u->buffer instead */
+@@ -63,6 +64,7 @@
+ dd("returning NGX_HTTP_INTERNAL_SERVER_ERROR");
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
++#endif
+
+ pglcf = ngx_http_get_module_loc_conf(r, ngx_postgres_module);
+
diff --git a/www/angie-module-postgres/files/pkg-message.in b/www/angie-module-postgres/files/pkg-message.in
new file mode 100644
index 000000000000..b3a2a5f4c6d7
--- /dev/null
+++ b/www/angie-module-postgres/files/pkg-message.in
@@ -0,0 +1,15 @@
+[
+{ type: install
+ message: <<EOM
+
+The postgres dynamic module for Angie has been installed.
+To enable this module, add the following to %%PREFIX%%/etc/angie/angie.conf
+and reload angie:
+
+ load_module modules/ngx_postgres_module.so;
+
+Please refer to the module documentation for further details:
+https://github.com/FRiCKLE/ngx_postgres
+EOM
+}
+]
diff --git a/www/angie-module-postgres/pkg-descr b/www/angie-module-postgres/pkg-descr
new file mode 100644
index 000000000000..96bf9efd2ba6
--- /dev/null
+++ b/www/angie-module-postgres/pkg-descr
@@ -0,0 +1,2 @@
+This is an upstream module that allows Angie to communicate directly with
+PostgreSQL database.
diff --git a/www/angie-module-postgres/pkg-plist b/www/angie-module-postgres/pkg-plist
new file mode 100644
index 000000000000..470174501922
--- /dev/null
+++ b/www/angie-module-postgres/pkg-plist
@@ -0,0 +1,3 @@
+%%DOCSDIR%%/README.md
+%%MODDIR%%/ngx_postgres_module.so
+%%DEBUG%%%%MODDIR%%/ngx_postgres_module-debug.so