git: 6483d7e6e5f3 - main - games/oblige: fix build on powerpc*

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Thu, 03 Aug 2023 10:42:12 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6483d7e6e5f341dbcc6483d30f353b3fb2dd2c45

commit 6483d7e6e5f341dbcc6483d30f353b3fb2dd2c45
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2023-08-03 10:39:58 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2023-08-03 10:39:58 +0000

    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));
                                              ~~~~~~         ^~~~~~
---
 games/oblige/Makefile                             |  3 ++-
 games/oblige/files/patch-ajpoly__src_pl__endian.h | 14 ++++++++++++++
 games/oblige/files/patch-gui_sys__endian.h        | 14 ++++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/games/oblige/Makefile b/games/oblige/Makefile
index d68a02bb80af..7d04609679d7 100644
--- a/games/oblige/Makefile
+++ b/games/oblige/Makefile
@@ -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
 
diff --git a/games/oblige/files/patch-ajpoly__src_pl__endian.h b/games/oblige/files/patch-ajpoly__src_pl__endian.h
new file mode 100644
index 000000000000..c10fb7058fbc
--- /dev/null
+++ b/games/oblige/files/patch-ajpoly__src_pl__endian.h
@@ -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) {
diff --git a/games/oblige/files/patch-gui_sys__endian.h b/games/oblige/files/patch-gui_sys__endian.h
new file mode 100644
index 000000000000..a240f00393e3
--- /dev/null
+++ b/games/oblige/files/patch-gui_sys__endian.h
@@ -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) {