On 2025/11/28 13:12, Theo Buehler wrote:
> Seen while poking at espeak on sparc64:
> 
> > Extracting debug info from 
> > /usr/ports/pobj/espeak-1.52.0/fake-sparc64/usr/local/bin/espeak-ng
> Bus error (core dumped)
> 
> xxhash is broken on strict alignment archs and needs a patch to
> work correctly. This copies over sthen's patch from sysutils/xxhash
> and fixes the problem.
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/dwz/Makefile,v
> diff -u -p -r1.9 Makefile
> --- Makefile  5 Sep 2025 16:38:51 -0000       1.9
> +++ Makefile  28 Nov 2025 12:08:54 -0000
> @@ -4,6 +4,8 @@ XXHASH_V =    0.8.3
>  DISTFILES =  ${PKGNAME}.tar.gz
>  DISTFILES.h=         xxhash-${XXHASH_V}{xxhash}.h
>  
> +REVISION =   0
> +
>  CATEGORIES = devel
>  
>  HOMEPAGE =   https://sourceware.org/dwz/
> Index: patches/patch-xxhash_h
> ===================================================================
> RCS file: patches/patch-xxhash_h
> diff -N patches/patch-xxhash_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-xxhash_h    28 Nov 2025 11:59:21 -0000
> @@ -0,0 +1,17 @@
> +Index: xxhash.h
> +--- xxhash.h.orig
> ++++ xxhash.h
> +@@ -2297,8 +2297,11 @@ XXH3_128bits_reset_withSecretandSeed(XXH_NOESCAPE XXH3
> +    /* prefer __packed__ structures (method 1) for GCC
> +     * < ARMv7 with unaligned access (e.g. Raspbian armhf) still uses byte 
> shifting, so we use memcpy
> +     * which for some reason does unaligned loads. */
> +-#  if defined(__GNUC__) && !(defined(__ARM_ARCH) && __ARM_ARCH < 7 && 
> defined(__ARM_FEATURE_UNALIGNED))
> +-#    define XXH_FORCE_MEMORY_ACCESS 1
> ++#  if defined(__GNUC__)
> ++#    include <endian.h>   /* __STRICT_ALIGNMENT */
> ++#    if !defined(__STRICT_ALIGNMENT)
> ++#      define XXH_FORCE_MEMORY_ACCESS 1
> ++#    endif
> + #  endif
> + #endif
> + 
> 

ok, or here's an alternative approach:

Index: devel/dwz/Makefile
===================================================================
RCS file: /cvs/ports/devel/dwz/Makefile,v
diff -u -p -r1.9 Makefile
--- devel/dwz/Makefile  5 Sep 2025 16:38:51 -0000       1.9
+++ devel/dwz/Makefile  28 Nov 2025 12:28:07 -0000
@@ -1,8 +1,6 @@
 COMMENT =      DWARF optimization and duplicate removal tool
-PKGNAME =      dwz-0.16
-XXHASH_V =     0.8.3
-DISTFILES =    ${PKGNAME}.tar.gz
-DISTFILES.h=   xxhash-${XXHASH_V}{xxhash}.h
+DISTNAME =     dwz-0.16
+REVISION =     0
 
 CATEGORIES =   devel
 
@@ -15,7 +13,6 @@ PERMIT_PACKAGE =      Yes
 WANTLIB += c elf
 
 SITES =                https://sourceware.org/ftp/dwz/releases/
-SITES.h =      https://raw.githubusercontent.com/Cyan4973/xxHash/v${XXHASH_V}/
 
 DEBUG_PACKAGES =       ${BUILD_PACKAGES}
 
@@ -27,15 +24,11 @@ FAKE_FLAGS =        mandir=${TRUEPREFIX}/man pr
 WRKDIST =      ${WRKDIR}/dwz
 
 # XXX bootstrap: DEBUG_PACKAGES needs a dwz binary to work
-
 DWZ = ${WRKBUILD}/dwz
 
-EXTRACT_ONLY = ${DISTFILES}
-
-# Cannot use sysutils/xxhash as that introduces a loop.
-# XXX: Revisit using the :patch target next update.
-post-extract:
-       cp ${DISTDIR}/xxhash-${XXHASH_V}.h ${WRKSRC}/xxhash.h
+BUILD_DEPENDS =        sysutils/xxhash:patch
+do-configure:
+       cp ${WRKDIR}/sysutils/xxhash/*/xxhash.h ${WRKSRC}/xxhash.h
 
 .include <bsd.port.arch.mk>
 .if ${PROPERTIES:Mlp64}
Index: devel/dwz/distinfo
===================================================================
RCS file: /cvs/ports/devel/dwz/distinfo,v
diff -u -p -r1.4 distinfo
--- devel/dwz/distinfo  5 Sep 2025 16:38:51 -0000       1.4
+++ devel/dwz/distinfo  28 Nov 2025 12:28:07 -0000
@@ -1,4 +1,2 @@
 SHA256 (dwz-0.16.tar.gz) = R1hT4bSebtjMLQqQnHpPwcxXHrzPxmJ4/UM0Lb4n1Q4=
-SHA256 (xxhash-0.8.3.h) = F5c8DcSdmFTKJsqhkfDhL3pCS2iFjZp43jhg2VnYXks=
 SIZE (dwz-0.16.tar.gz) = 188638
-SIZE (xxhash-0.8.3.h) = 268319
Index: sysutils/xxhash/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/xxhash/Makefile,v
diff -u -p -r1.18 Makefile
--- sysutils/xxhash/Makefile    1 Jan 2025 15:13:23 -0000       1.18
+++ sysutils/xxhash/Makefile    28 Nov 2025 12:28:07 -0000
@@ -1,6 +1,6 @@
 COMMENT =      extremely fast non-cryptographic hash algorithm
 
-# bump rsync on updates; used as a header-only library there
+# bump rsync and dwz on updates; used as a header-only library there
 GH_ACCOUNT =   Cyan4973
 GH_PROJECT =   xxHash
 GH_TAGNAME =   v0.8.3

Reply via email to