git: c39a8b992c33 - main - www/nginx-devel: fix OTel module build (+)

From: Sergey A. Osokin <osa_at_FreeBSD.org>
Date: Sun, 17 Sep 2023 15:32:58 UTC
The branch main has been updated by osa:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c39a8b992c33a9566e862f4e9d4d2f7a3f2ce5b3

commit c39a8b992c33a9566e862f4e9d4d2f7a3f2ce5b3
Author:     Sergey A. Osokin <osa@FreeBSD.org>
AuthorDate: 2023-09-17 15:30:03 +0000
Commit:     Sergey A. Osokin <osa@FreeBSD.org>
CommitDate: 2023-09-17 15:32:45 +0000

    www/nginx-devel: fix OTel module build (+)
    
    Special thanks to:      pluknet
    
    Bump PORTREVISION.
---
 www/nginx-devel/Makefile                           |  5 +++-
 www/nginx-devel/Makefile.extmod                    |  1 +
 .../files/extra-patch-nginx-otel-config            | 34 ++++++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/www/nginx-devel/Makefile b/www/nginx-devel/Makefile
index a89a55c942d8..3039e40225ae 100644
--- a/www/nginx-devel/Makefile
+++ b/www/nginx-devel/Makefile
@@ -1,6 +1,6 @@
 PORTNAME?=	nginx
 PORTVERSION=	1.25.2
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	www
 MASTER_SITES=	https://nginx.org/download/ \
 		LOCAL/osa
@@ -324,6 +324,9 @@ pre-configure-SMALL_LIGHT-on:
 do-configure-NJS-on:
 	( cd ${WRKSRC_njs} && ${SETENV} ${CONFIGURE_ENV} ${CONFIGURE_CMD} ${NJS_CONFIGURE_ARGS} )
 
+post-configure-OTEL-on:
+	${CAT} ${WRKSRC_otel}/src/modules.c >${WRKSRC}/objs/ngx_otel_module_modules.c
+
 .if !target(do-install)
 do-install:
 	${MKDIR} ${STAGEDIR}${ETCDIR}
diff --git a/www/nginx-devel/Makefile.extmod b/www/nginx-devel/Makefile.extmod
index cc07a20f6508..06adb9f018d1 100644
--- a/www/nginx-devel/Makefile.extmod
+++ b/www/nginx-devel/Makefile.extmod
@@ -258,6 +258,7 @@ OTEL_LIB_DEPENDS=	libabsl_base.so:devel/abseil \
 			libre2.so:devel/re2
 OTEL_BUILD_DEPENDS=	${LOCALBASE}/include/opentelemetry/proto/common/v1/common.proto:devel/opentelemetry-proto
 OTEL_CONFIGURE_ENV+=	NGX_OTEL_PROTO_DIR=${PREFIX}/include
+OTEL_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-nginx-otel-config
 
 PASSENGER_NGINX_VER=	6.0.18
 PASSENGER_CATEGORIES=	ruby
diff --git a/www/nginx-devel/files/extra-patch-nginx-otel-config b/www/nginx-devel/files/extra-patch-nginx-otel-config
new file mode 100644
index 000000000000..acc11ca78cd0
--- /dev/null
+++ b/www/nginx-devel/files/extra-patch-nginx-otel-config
@@ -0,0 +1,34 @@
+--- ../nginx-otel-f58abc0/config.orig	2023-09-16 12:52:34.000000000 -0400
++++ ../nginx-otel-f58abc0/config	2023-09-16 21:19:32.540843000 -0400
+@@ -223,7 +223,7 @@
+ ngx_feature_run=no
+ ngx_feature_incs="#include <grpc/support/log.h>"
+ ngx_feature_path="/usr/include"
+-ngx_feature_libs="-lgrpc -lgpr"
++ngx_feature_libs="-lgrpc -lgpr -lgrpc++"
+ ngx_feature_test="gpr_log_verbosity_init();"
+ 
+ autocppfeature
+@@ -236,19 +236,18 @@
+     ngx_feature_path="/usr/local/include"
+ 
+     if [ $NGX_RPATH = YES ]; then
+-        ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lgrpc -lgpr"
++        ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lgrpc -lgpr -lgrpc++"
+     else
+-        ngx_feature_libs="-L/usr/local/lib -lgrpc -lgpr"
++        ngx_feature_libs="-L/usr/local/lib -lgrpc -lgpr -lgrpc++"
+     fi
+ 
+     autocppfeature
+ fi
+ 
+ if [ $ngx_found = yes ]; then
+-    ngx_module_libs="$ngx_module_libs -lgrpc -lgpr"
++    ngx_module_libs="$ngx_module_libs -lgrpc -lgpr -lgrpc++"
+ fi
+ 
+-#ngx_module_libs="$ngx_module_libs -lupb -lz -lm -lrt -lssl -lcrypto"
+ ngx_module_libs="$ngx_module_libs -lz -lm -lrt -lssl -lcrypto"
+ 
+ . auto/module