From f4fd4422b1dd218d268a9fda267ca39596ce53d8 Mon Sep 17 00:00:00 2001 From: Robert Clausecker Date: Thu, 26 Oct 2023 00:43:17 +0200 Subject: [PATCH] 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 --- devel/libqsbr/Makefile | 9 +++++++-- devel/libqsbr/files/patch-qsbr.h | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 devel/libqsbr/files/patch-qsbr.h diff --git a/devel/libqsbr/Makefile b/devel/libqsbr/Makefile index 205d04fe1d1ed..a864a3acbe22a 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 diff --git a/devel/libqsbr/files/patch-qsbr.h b/devel/libqsbr/files/patch-qsbr.h new file mode 100644 index 0000000000000..3a6f9d5057418 --- /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 +