Skip to content

Commit

Permalink
devel/libqsbr: fix build on 32 bit platforms
Browse files Browse the repository at this point in the history
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:	rmind/libqsbr#12
Approved by:	portmgr (build fix blanket)
MFH:		2023Q4
  • Loading branch information
clausecker committed Oct 27, 2023
1 parent 148a825 commit f4fd442
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
9 changes: 7 additions & 2 deletions devel/libqsbr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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>
14 changes: 14 additions & 0 deletions devel/libqsbr/files/patch-qsbr.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f4fd442

Please sign in to comment.