games/oblige: fix build on powerpc*

gui/sys_endian.h:66:58: error: unsupported inline asm: input with type 'int' matching output with type 'u16_t' (aka 'unsigned short')
  __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
                                          ~~~~~~         ^~~~~~
This commit is contained in:
Piotr Kubaj 2023-08-03 10:39:58 +00:00
parent 6a56ecb355
commit 6483d7e6e5
3 changed files with 30 additions and 1 deletions

View file

@ -17,7 +17,8 @@ LIB_DEPENDS= libfltk.so:x11-toolkits/fltk \
libphysfs.so:devel/physfs \
libpng.so:graphics/png
USES= gmake jpeg xorg zip
USES= dos2unix gmake jpeg xorg zip
DOS2UNIX_FILES= ajpoly_src/pl_endian.h gui/sys_endian.h
USE_XORG= x11 xcursor xext xfixes xft xinerama xrender
WRKSRC= ${WRKDIR}/Oblige-${PORTVERSION}-source

View file

@ -0,0 +1,14 @@
--- ajpoly_src/pl_endian.h.orig 2023-07-31 15:43:19 UTC
+++ ajpoly_src/pl_endian.h
@@ -57,10 +57,7 @@ static inline u16_t UT_Swap16(u16_t x)
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static inline u16_t UT_Swap16(u16_t x)
{
- u16_t result;
-
- __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
- return result;
+ return __builtin_bswap16(x);
}
#else
static inline u16_t UT_Swap16(u16_t x) {

View file

@ -0,0 +1,14 @@
--- gui/sys_endian.h.orig 2023-07-31 15:43:29 UTC
+++ gui/sys_endian.h
@@ -61,10 +61,7 @@ static inline u16_t UT_Swap16(u16_t x)
#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static inline u16_t UT_Swap16(u16_t x)
{
- u16_t result;
-
- __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
- return result;
+ return __builtin_bswap16(x);
}
#else
static inline u16_t UT_Swap16(u16_t x) {