git: 2542a932b23c - 2023Q4 - devel/libqsbr: fix build on 32 bit platforms

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Fri, 27 Oct 2023 06:35:38 UTC
The branch 2023Q4 has been updated by fuz:

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

commit 2542a932b23c395b8cd1fb5f6064354de6b8796c
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-10-25 22:43:17 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-10-27 06:35:10 +0000

    devel/libqsbr: fix build on 32 bit platforms
    
    The fix is to make qsbr_epoch_t a 64 bit integer in any case.  The fix
    is carefully designed not to change the API on platforms where it is so
    already.  Unfortunately this fix requires FreeBSD 13 or newer due to the
    old LLVM version included in FreeBSD 12.
    
    While we are at it, hook up test target.
    
    See also:       https://github.com/rmind/libqsbr/issues/12
    Approved by:    portmgr (build fix blanket)
    MFH:            2023Q4
    
    (cherry picked from commit f4fd4422b1dd218d268a9fda267ca39596ce53d8)
---
 devel/libqsbr/Makefile           |  9 +++++++--
 devel/libqsbr/files/patch-qsbr.h | 14 ++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/devel/libqsbr/Makefile b/devel/libqsbr/Makefile
index 205d04fe1d1e..a864a3acbe22 100644
--- a/devel/libqsbr/Makefile
+++ b/devel/libqsbr/Makefile
@@ -9,8 +9,12 @@ WWW=		https://github.com/rmind/libqsbr
 LICENSE=	BSD2CLAUSE
 LICENSE_FILE=	${WRKSRC}/../LICENSE
 
-BROKEN_i386=	static_assert(sizeof(qsbr_epoch_t) == 8, "expected 64-bit counter")
-BROKEN_powerpc=	static_assert(sizeof(qsbr_epoch_t) == 8, "expected 64-bit counter")
+# the fix uses __LONG_WIDTH__ which is only available from FreeBSD 13
+BROKEN_FreeBSD_12_i386=		static_assert(sizeof(qsbr_epoch_t) == 8, "expected 64-bit counter")
+BROKEN_FreeBSD_12_armv6=	static_assert(sizeof(qsbr_epoch_t) == 8, "expected 64-bit counter")
+BROKEN_FreeBSD_12_armv7=	static_assert(sizeof(qsbr_epoch_t) == 8, "expected 64-bit counter")
+BROKEN_FreeBSD_12_powerpc=	static_assert(sizeof(qsbr_epoch_t) == 8, "expected 64-bit counter")
+BROKEN_FreeBSD_12_mips=		static_assert(sizeof(qsbr_epoch_t) == 8, "expected 64-bit counter")
 
 USES=		compiler:c11 gmake libtool:build
 USE_GITHUB=	yes
@@ -22,5 +26,6 @@ MAKE_ENV=	DESTDIR=${STAGEDIR}${PREFIX} \
 		INCDIR=${LOCALBASE}/include \
 		LIBDIR=${LOCALBASE}/lib \
 		MANDIR=${LOCALBASE}/man
+TEST_TARGET=	tests
 
 .include <bsd.port.mk>
diff --git a/devel/libqsbr/files/patch-qsbr.h b/devel/libqsbr/files/patch-qsbr.h
new file mode 100644
index 000000000000..3a6f9d505741
--- /dev/null
+++ b/devel/libqsbr/files/patch-qsbr.h
@@ -0,0 +1,14 @@
+--- qsbr.h.orig	2023-10-25 22:40:12 UTC
++++ qsbr.h
+@@ -13,7 +13,11 @@
+ 
+ struct qsbr;
+ typedef struct qsbr qsbr_t;
++#if defined(__LONG_WIDTH__) && __LONG_WIDTH < 64
++typedef unsigned long long qsbr_epoch_t;
++#else
+ typedef unsigned long qsbr_epoch_t;
++#endif
+ 
+ __BEGIN_DECLS
+