pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
emulators/fbneo: fix building on aarch64 netbsd
Hi, let's see if I can explain this little mess...
The patch patch-src_burn_burnint.h inserts a block in
src/burn/burnint.h:
==================
#elif defined(__NetBSD__)
#include <machine/endian.h>
#define BURN_ENDIAN_SWAP_INT8(x) (x^1)
#define BURN_ENDIAN_SWAP_INT16(x) (bswap16(x))
#define BURN_ENDIAN_SWAP_INT32(x) (bswap32(x))
#define BURN_ENDIAN_SWAP_INT64(x) (bswap64(x))
==================
But before that NO_64BIT_BYTESWAP is defined:
==================
// Xbox 360 has byteswap 64-bit intrinsic
#ifndef _XBOX
#define NO_64BIT_BYTESWAP
#endif
==================
So after the added block, the macro BURN_ENDIAN_SWAP_INT64 is expanded
in the function definition and all gets f*:
==================
#ifdef NO_64BIT_BYTESWAP
static inline UINT64 BURN_ENDIAN_SWAP_INT64(UINT64 x)
{
BYTESWAP_INT64 r = {0};
r.l.l = BURN_ENDIAN_SWAP_INT32(x);
r.l.h = BURN_ENDIAN_SWAP_INT32(x >> 32);
return r.ll;
}
==================
This can be resolve modifying the conditional above:
==================
// Xbox 360 and NetBSD have byteswap 64-bit intrinsic
#if !defined(_XBOX) && !defined(__NetBSD__)
#define NO_64BIT_BYTESWAP
#endif
==================
This block is processed only when the platform is big endian, when
that's not the case the endian swap functions will do nothing, and
endianess is checked in other places in the code. This is set on
the port's Makefile (after disabling the default setting with
patches):
==================
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
MAKE_FLAGS+= LSB_FIRST=1
TOOL_DEPENDS+= nasm-[0-9]*:../../devel/nasm
.endif
==================
So LSB_FIRST should be defined for other little endian platforms.
I've added only aarch64, the only one I'm testing.
I'm supposing here that aarch64eb is treated as a different platform,
different ${MACHINE_ARCH}? I've never used it...
I've attached patches to fix this.
I'm curious if this port builds with big endian, there seems to be
a macro TWO_PIX_32 that is defined only when LSB_FIRST is defined,
but used anyway...
Regards.
adr
P.S. There is a problem with audio latency, something that happens
with most (all?, only sdl?) applications. With mpv I have to
configure a negative delay of 300ms with rpi4 vc audio, or 500ms
with usb audio. This shouldn't happen, but that's another story
for another day...
==================
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/fbneo/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile 22 Dec 2024 12:16:45 -0000 1.4
+++ Makefile 10 Feb 2025 19:36:16 -0000
@@ -36,6 +36,10 @@
TOOL_DEPENDS+= nasm-[0-9]*:../../devel/nasm
.endif
+.if ${MACHINE_ARCH} == "aarch64"
+MAKE_FLAGS+= LSB_FIRST=1
+.endif
+
LDFLAGS+= -lpng -lz
MAKE_JOBS_SAFE= no
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/fbneo/distinfo,v
retrieving revision 1.1
diff -u -r1.1 distinfo
--- distinfo 29 May 2023 19:30:47 -0000 1.1
+++ distinfo 10 Feb 2025 19:36:16 -0000
@@ -5,5 +5,5 @@
Size (FBNeo-1.0.0.2.tar.gz) = 12171430 bytes
SHA1 (patch-makefile) = 94c77fe8b5c8f7b924c507d7b327f9ef25bb3409
SHA1 (patch-makefile.sdl2) = a41b13f31faccf2e6bb075290f926fb64ca7b1d5
-SHA1 (patch-src_burn_burnint.h) = 1050d2088c17b0763c47fef6a0674b5eb94b7ba6
+SHA1 (patch-src_burn_burnint.h) = cca82e1833aab73ff8f06b4cb951e8b36029b8ec
SHA1 (patch-src_burner_burner.h) = a09ded507381d6f2bb9d4476813122a53415c01d
Index: patches/patch-src_burn_burnint.h
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/fbneo/patches/patch-src_burn_burnint.h,v
retrieving revision 1.1
diff -u -r1.1 patch-src_burn_burnint.h
--- patches/patch-src_burn_burnint.h 29 May 2023 19:30:48 -0000 1.1
+++ patches/patch-src_burn_burnint.h 10 Feb 2025 19:36:16 -0000
@@ -4,6 +4,17 @@
--- src/burn/burnint.h.orig 2021-05-01 20:32:23.000000000 +0000
+++ src/burn/burnint.h
+@@ -30,8 +30,8 @@ typedef union
+ #define BURN_ENDIAN_SWAP_INT64(x) x
+ #else
+
+-// Xbox 360 has byteswap 64-bit intrinsic
+-#ifndef _XBOX
++// Xbox 360 and NetBSD have byteswap 64-bit intrinsic
++#if !definded(_XBOX) && !defined(__NetBSD__)
+ #define NO_64BIT_BYTESWAP
+ #endif
+
@@ -80,6 +80,13 @@ typedef union {
#define BURN_ENDIAN_SWAP_INT8(x) (x^1)
#define BURN_ENDIAN_SWAP_INT16(x) ({uint16_t tt; __sthbrx(&tt, 0, x); tt;})
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/fbneo/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile 22 Dec 2024 12:16:45 -0000 1.4
+++ Makefile 10 Feb 2025 19:36:16 -0000
@@ -36,6 +36,10 @@
TOOL_DEPENDS+= nasm-[0-9]*:../../devel/nasm
.endif
+.if ${MACHINE_ARCH} == "aarch64"
+MAKE_FLAGS+= LSB_FIRST=1
+.endif
+
LDFLAGS+= -lpng -lz
MAKE_JOBS_SAFE= no
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/fbneo/distinfo,v
retrieving revision 1.1
diff -u -r1.1 distinfo
--- distinfo 29 May 2023 19:30:47 -0000 1.1
+++ distinfo 10 Feb 2025 19:36:16 -0000
@@ -5,5 +5,5 @@
Size (FBNeo-1.0.0.2.tar.gz) = 12171430 bytes
SHA1 (patch-makefile) = 94c77fe8b5c8f7b924c507d7b327f9ef25bb3409
SHA1 (patch-makefile.sdl2) = a41b13f31faccf2e6bb075290f926fb64ca7b1d5
-SHA1 (patch-src_burn_burnint.h) = 1050d2088c17b0763c47fef6a0674b5eb94b7ba6
+SHA1 (patch-src_burn_burnint.h) = cca82e1833aab73ff8f06b4cb951e8b36029b8ec
SHA1 (patch-src_burner_burner.h) = a09ded507381d6f2bb9d4476813122a53415c01d
Index: patches/patch-src_burn_burnint.h
===================================================================
RCS file: /cvsroot/pkgsrc/emulators/fbneo/patches/patch-src_burn_burnint.h,v
retrieving revision 1.1
diff -u -r1.1 patch-src_burn_burnint.h
--- patches/patch-src_burn_burnint.h 29 May 2023 19:30:48 -0000 1.1
+++ patches/patch-src_burn_burnint.h 10 Feb 2025 19:36:16 -0000
@@ -4,6 +4,17 @@
--- src/burn/burnint.h.orig 2021-05-01 20:32:23.000000000 +0000
+++ src/burn/burnint.h
+@@ -30,8 +30,8 @@ typedef union
+ #define BURN_ENDIAN_SWAP_INT64(x) x
+ #else
+
+-// Xbox 360 has byteswap 64-bit intrinsic
+-#ifndef _XBOX
++// Xbox 360 and NetBSD have byteswap 64-bit intrinsic
++#if !definded(_XBOX) && !defined(__NetBSD__)
+ #define NO_64BIT_BYTESWAP
+ #endif
+
@@ -80,6 +80,13 @@ typedef union {
#define BURN_ENDIAN_SWAP_INT8(x) (x^1)
#define BURN_ENDIAN_SWAP_INT16(x) ({uint16_t tt; __sthbrx(&tt, 0, x); tt;})
Home |
Main Index |
Thread Index |
Old Index