git: e63d23edd8c9 - 2022Q4 - security/libgcrypt: Circumvent WITH_DEBUG build failure

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Mon, 05 Dec 2022 20:09:23 UTC
The branch 2022Q4 has been updated by cy:

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

commit e63d23edd8c9a7b25e5539fa7c72d2b00316aa04
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-12-05 15:58:23 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-12-05 20:06:34 +0000

    security/libgcrypt: Circumvent WITH_DEBUG build failure
    
    Register allocation exaustion results within inline assembly when
    WITH_DEBUG is specified. Therefore when WITH_DEBUG is used, disable
    inline assembly.
    
    PR:             268173
    Reported by:    bofh
    
    (cherry picked from commit c35577ebc10af5ae8c509e4c73a44a06ac5b05d4)
---
 security/libgcrypt/Makefile                  |  4 ++++
 security/libgcrypt/files/patch-tests_basic.c | 29 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/security/libgcrypt/Makefile b/security/libgcrypt/Makefile
index 85dd47823d00..d6a3c5aef1b8 100644
--- a/security/libgcrypt/Makefile
+++ b/security/libgcrypt/Makefile
@@ -45,6 +45,10 @@ STATIC_CONFIGURE_ENABLE=	static
 CONFIGURE_ARGS+=	--disable-jent-support
 .endif
 
+.if defined(WITH_DEBUG)
+CFLAGS+=	-DWITH_DEBUG
+.endif
+
 post-patch:
 	@${RM} ${WRKSRC}/doc/gcrypt.info*
 	@${REINPLACE_CMD} -e 's|ALIGN (3)|ALIGN (2)|g' ${WRKSRC}/mpi/i386/*.S
diff --git a/security/libgcrypt/files/patch-tests_basic.c b/security/libgcrypt/files/patch-tests_basic.c
new file mode 100644
index 000000000000..4735524ff689
--- /dev/null
+++ b/security/libgcrypt/files/patch-tests_basic.c
@@ -0,0 +1,29 @@
+--- tests/basic.c.orig	2021-08-22 04:56:06.000000000 -0700
++++ tests/basic.c	2022-12-05 07:46:59.768944000 -0800
+@@ -38,6 +38,10 @@
+ #else
+ #  define ALWAYS_INLINE
+ #endif
++#ifdef WITH_DEBUG
++#  undef ALWAYS_INLINE
++#  define ALWAYS_INLINE
++#endif
+ 
+ typedef struct test_spec_pubkey_key
+ {
+@@ -214,6 +218,7 @@
+ }
+ 
+ 
++#ifndef WITH_DEBUG
+ #if defined(__x86_64__) && defined(HAVE_GCC_INLINE_ASM_SSSE3) && \
+     (defined(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS) || \
+      defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS))
+@@ -233,6 +238,7 @@
+       defined(__ARM_NEON)
+ # define CLUTTER_VECTOR_REGISTER_NEON 1
+ # define CLUTTER_VECTOR_REGISTER_COUNT 16
++#endif
+ #endif
+ 
+