git: 2735159edc4e - main - databases/postgresql-promscale: Fix build with NLS

From: Mark Felder <feld_at_FreeBSD.org>
Date: Tue, 08 Nov 2022 15:48:41 UTC
The branch main has been updated by feld:

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

commit 2735159edc4ead9807d366b856ef26e546df849b
Author:     Mark Felder <feld@FreeBSD.org>
AuthorDate: 2022-11-08 15:47:47 +0000
Commit:     Mark Felder <feld@FreeBSD.org>
CommitDate: 2022-11-08 15:47:47 +0000

    databases/postgresql-promscale: Fix build with NLS
    
    PR:     267550
---
 databases/postgresql-promscale/Makefile                |  6 +++++-
 databases/postgresql-promscale/files/pgx-include-patch | 10 ++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/databases/postgresql-promscale/Makefile b/databases/postgresql-promscale/Makefile
index 7c65d60943d6..ce226577d5ab 100644
--- a/databases/postgresql-promscale/Makefile
+++ b/databases/postgresql-promscale/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	promscale
 PORTVERSION=	0.7.0
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	databases
 PKGNAMEPREFIX=	postgresql${PGSQL_VER:S/.//}-
 
@@ -36,6 +36,10 @@ MAKE_ENV+=	MAKE=gmake PATH=${PATH}:${WRKDIR}/.cargo/bin
 post-extract:
 	mv ${WRKDIR}/pgx-* ${WRKDIR}/pgx
 
+pre-configure:
+	@${PATCH} -d ${WRKDIR} ${PATCH_ARGS} < ${PATCHDIR}/pgx-include-patch
+	${REINPLACE_CMD} 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKDIR}/pgx/pgx-pg-sys/build.rs
+
 pre-build:
 	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} cargo install --offline --path ../pgx/cargo-pgx cargo-pgx
 	mkdir -p ${WRKDIR}/.pgx
diff --git a/databases/postgresql-promscale/files/pgx-include-patch b/databases/postgresql-promscale/files/pgx-include-patch
new file mode 100644
index 000000000000..90ea9b8be038
--- /dev/null
+++ b/databases/postgresql-promscale/files/pgx-include-patch
@@ -0,0 +1,10 @@
+--- pgx/pgx-pg-sys/build.rs.orig        2022-11-06 21:01:34.720308000 +0000
++++ pgx/pgx-pg-sys/build.rs     2022-11-06 21:02:14.469075000 +0000
+@@ -507,6 +507,7 @@
+     let bindings = bindgen::Builder::default()
+         .header(include_h.display().to_string())
+         .clang_arg(&format!("-I{}", includedir_server.display()))
++        .clang_arg("-I%%LOCALBASE%%/include")
+         .parse_callbacks(Box::new(IgnoredMacros::default()))
+         .blocklist_function("varsize_any") // pgx converts the VARSIZE_ANY macro, so we don't want to also have this function, which is in heaptuple.c
+         .blocklist_function("query_tree_walker")