From e588be8921a3e1fdf8cd095bd1bd866b31692bb1 Mon Sep 17 00:00:00 2001 From: David Holm Date: Sun, 15 Feb 2004 14:36:54 +0000 Subject: Added a patch to make egoboo compile on ppc. Keyworded ~ppc. --- games-rpg/egoboo/ChangeLog | 6 +- games-rpg/egoboo/Manifest | 5 +- games-rpg/egoboo/egoboo-2.22.ebuild | 7 +- games-rpg/egoboo/files/2.22-endian.patch | 178 +++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 5 deletions(-) create mode 100644 games-rpg/egoboo/files/2.22-endian.patch diff --git a/games-rpg/egoboo/ChangeLog b/games-rpg/egoboo/ChangeLog index 69714c9fd4ec..e43059f37580 100644 --- a/games-rpg/egoboo/ChangeLog +++ b/games-rpg/egoboo/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for games-rpg/egoboo # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/games-rpg/egoboo/ChangeLog,v 1.4 2004/01/08 11:13:13 mr_bones_ Exp $ +# $Header: /var/cvsroot/gentoo-x86/games-rpg/egoboo/ChangeLog,v 1.5 2004/02/15 14:36:45 dholm Exp $ + + 15 Feb 2004; David Holm egoboo-2.22.ebuild, + files/2.22-endian.patch: + Added a patch to make egoboo compile on ppc. Keyworded ~ppc. 08 Jan 2004; Michael Sterrett egoboo-2.22.ebuild, files/egoboo-2.22.sh: diff --git a/games-rpg/egoboo/Manifest b/games-rpg/egoboo/Manifest index ddaaaf6ac015..572aa863a892 100644 --- a/games-rpg/egoboo/Manifest +++ b/games-rpg/egoboo/Manifest @@ -1,6 +1,7 @@ -MD5 36bc41ec434048c8062a7855ddf9c256 ChangeLog 1388 +MD5 dd1fd67c272bd34dbf95390e6d1e3e67 ChangeLog 1540 +MD5 a331d9c5967b903ec8a02f2f0850ad37 egoboo-2.22.ebuild 1618 MD5 a30c9d4ce8f9629d6d7323eaab258343 metadata.xml 241 -MD5 b7be4c50b973c4e60548e73f33f198b8 egoboo-2.22.ebuild 1550 MD5 51c7e53fd5f581bc0e057240613daccd files/digest-egoboo-2.22 60 MD5 2afa7b7e1883fef3200371e1d3f3300f files/egoboo-2.22-makefile-gentoo.patch 672 MD5 0a0a0fc9e09b819b73878b8ec3c61f5f files/egoboo-2.22.sh 279 +MD5 0fc47d542e1b356cc9f9a99c4e8884f6 files/2.22-endian.patch 6416 diff --git a/games-rpg/egoboo/egoboo-2.22.ebuild b/games-rpg/egoboo/egoboo-2.22.ebuild index 95a314a18de9..01aa3c289917 100644 --- a/games-rpg/egoboo/egoboo-2.22.ebuild +++ b/games-rpg/egoboo/egoboo-2.22.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/games-rpg/egoboo/egoboo-2.22.ebuild,v 1.3 2004/01/08 11:13:13 mr_bones_ Exp $ +# $Header: /var/cvsroot/gentoo-x86/games-rpg/egoboo/egoboo-2.22.ebuild,v 1.4 2004/02/15 14:36:45 dholm Exp $ inherit flag-o-matic games @@ -9,7 +9,7 @@ DESCRIPTION="A 3d dungeon crawling adventure in the spirit of NetHack" HOMEPAGE="http://egoboo.sourceforge.net/" SRC_URI="mirror://sourceforge/${PN}/ego${PV/./}.tar.gz" -KEYWORDS="-* x86" +KEYWORDS="-* x86 ~ppc" LICENSE="GPL-2" SLOT="0" IUSE="" @@ -34,6 +34,9 @@ src_unpack() { sed \ -e "s:GENTOODIR:${GAMES_DATADIR}:" "${FILESDIR}/${P}.sh" \ > "${T}/egoboo" || die "sed wrapper failed" + + # Fix endianess using SDL + epatch ${FILESDIR}/${PV}-endian.patch } src_compile() { diff --git a/games-rpg/egoboo/files/2.22-endian.patch b/games-rpg/egoboo/files/2.22-endian.patch new file mode 100644 index 000000000000..02c3d578a69c --- /dev/null +++ b/games-rpg/egoboo/files/2.22-endian.patch @@ -0,0 +1,178 @@ +--- egoboo/code/egobootypedef.h.orig 2004-02-15 15:19:03.000000000 +0100 ++++ egoboo/code/egobootypedef.h 2004-02-15 15:23:58.000000000 +0100 +@@ -71,13 +71,49 @@ + typedef Sint32 LONG; + typedef Uint32 DWORD; + typedef struct lin_RECT { LONG left; LONG right; LONG top; LONG bottom; } RECT; ++ ++#ifdef __powerpc__ ++#define _BIG_ENDIAN ++ ++/* ++ * __lwbrx - Load Word Byte-Reverse Indexed ++ * ++ * int __lwbrx(void *, int); ++ */ ++#define __lwbrx(base, index) \ ++ ({ unsigned long lwbrxResult; \ ++ __asm__ volatile ("lwbrx %0, %1, %2" : "=r" (lwbrxResult) : "b%" (index), "r" (base) : "memory"); \ ++ /*return*/ lwbrxResult; }) ++ ++static float LoadFloatByteswapped( float *ptr ); ++static inline float LoadFloatByteswapped( float *ptr ) ++{ ++ union { ++ float f; ++ long l; ++ } data; ++ ++ /*Load byteswapped and store to the stack*/ ++ data.l = __lwbrx( ptr, 0 ); ++ ++ /*Return the result*/ ++ return data.f; ++} ++#elif __i386__ + #define _LITTLE_ENDIAN ++#else ++#define _BIG_ENDIAN ++#error You have to implement LoadFloatByteswapped on your architecture! ++#endif ++ + #define LE32bitToHost( pData, pNumByte ) pData + #define BE32bitToHost( pData, pNumByte ) pData + #define LE16bitToHost( pData, pNumByte ) pData + #define BE16bitToHost( pData, pNumByte ) pData + #define EndianChange32bit( pData, pNumByte ) pData + #define EndianChange16bit( pData, pNumByte ) pData ++ ++ + #endif + + +--- egoboo/code/game.c.orig 2004-02-15 15:19:07.000000000 +0100 ++++ egoboo/code/game.c 2004-02-15 15:19:19.000000000 +0100 +@@ -10,6 +10,7 @@ + #define TITLE "Boo" + + #define RELEASE(x) if (x) {x->Release(); x=NULL;} ++#include + + //--------------------------------------------------------------------------------------------- + char *os_cvrt_filename(char *name, char ch) +@@ -2203,7 +2204,7 @@ + #ifdef _LITTLE_ENDIAN + iTmp = ipIntPointer[0]; + #else +- iTmp = EndianS32_LtoB( ipIntPointer[0] ); ++ iTmp = SDL_SwapLE32( ipIntPointer[0] ); + #endif + if(iTmp != MD2START ) return FALSE; + +@@ -2284,14 +2285,14 @@ + #ifdef _LITTLE_ENDIAN + int iNumCommands = ipIntPointer[9]; + #else +- int iNumCommands = EndianS32_LtoB( ipIntPointer[9] ); ++ int iNumCommands = SDL_SwapLE32( ipIntPointer[9] ); + #endif + + // Offset (in DWORDS) from the start of the file to the gl command list. + #ifdef _LITTLE_ENDIAN + int iCommandOffset = ipIntPointer[15]>>2; + #else +- int iCommandOffset = EndianS32_LtoB( ipIntPointer[15] )>>2; ++ int iCommandOffset = SDL_SwapLE32( ipIntPointer[15] )>>2; + #endif + + // Read in each command +@@ -2306,7 +2307,7 @@ + #ifdef _LITTLE_ENDIAN + iNumVertices = ipIntPointer[iCommandOffset]; iCommandOffset++; cnt++; + #else +- iNumVertices = EndianS32_LtoB( ipIntPointer[iCommandOffset] ); iCommandOffset++; cnt++; ++ iNumVertices = SDL_SwapLE32( ipIntPointer[iCommandOffset] ); iCommandOffset++; cnt++; + #endif + if(iNumVertices != 0) + { +@@ -2337,7 +2338,7 @@ + #else + fTmpu = LoadFloatByteswapped( &fpFloatPointer[iCommandOffset] ); iCommandOffset++; cnt++; + fTmpv = LoadFloatByteswapped( &fpFloatPointer[iCommandOffset] ); iCommandOffset++; cnt++; +- iTmp = EndianS32_LtoB( ipIntPointer[iCommandOffset] ); iCommandOffset++; cnt++; ++ iTmp = SDL_SwapLE32( ipIntPointer[iCommandOffset] ); iCommandOffset++; cnt++; + #endif + madcommandu[modelindex][entry] = fTmpu-(.5/64); // GL doesn't align correctly + madcommandv[modelindex][entry] = fTmpv-(.5/64); // with D3D +@@ -2373,9 +2374,9 @@ + iNumFrames = ipIntPointer[10]; + iFrameOffset = ipIntPointer[14]>>2; + #else +- iNumVertices = EndianS32_LtoB( ipIntPointer[6] ); +- iNumFrames = EndianS32_LtoB( ipIntPointer[10] ); +- iFrameOffset = EndianS32_LtoB( ipIntPointer[14] )>>2; ++ iNumVertices = SDL_SwapLE32( ipIntPointer[6] ); ++ iNumFrames = SDL_SwapLE32( ipIntPointer[10] ); ++ iFrameOffset = SDL_SwapLE32( ipIntPointer[14] )>>2; + #endif + + +@@ -2433,9 +2434,9 @@ + iNumFrames = ipIntPointer[10]; + iFrameOffset = ipIntPointer[14]>>2; + #else +- iNumVertices = EndianS32_LtoB( ipIntPointer[6] ); +- iNumFrames = EndianS32_LtoB( ipIntPointer[10] ); +- iFrameOffset = EndianS32_LtoB( ipIntPointer[14] )>>2; ++ iNumVertices = SDL_SwapLE32( ipIntPointer[6] ); ++ iNumFrames = SDL_SwapLE32( ipIntPointer[10] ); ++ iFrameOffset = SDL_SwapLE32( ipIntPointer[14] )>>2; + #endif + + +@@ -3270,10 +3271,10 @@ + fread(&itmp, 4, 1, fileread); meshsizex = itmp; + fread(&itmp, 4, 1, fileread); meshsizey = itmp; + #else +- fread(&itmp, 4, 1, fileread); if( ( int )EndianS32_LtoB( itmp ) != MAPID) return FALSE; +- fread(&itmp, 4, 1, fileread); numvert = ( int )EndianS32_LtoB( itmp ); +- fread(&itmp, 4, 1, fileread); meshsizex = ( int )EndianS32_LtoB( itmp ); +- fread(&itmp, 4, 1, fileread); meshsizey = ( int )EndianS32_LtoB( itmp ); ++ fread(&itmp, 4, 1, fileread); if( ( int )SDL_SwapLE32( itmp ) != MAPID) return FALSE; ++ fread(&itmp, 4, 1, fileread); numvert = ( int )SDL_SwapLE32( itmp ); ++ fread(&itmp, 4, 1, fileread); meshsizex = ( int )SDL_SwapLE32( itmp ); ++ fread(&itmp, 4, 1, fileread); meshsizey = ( int )SDL_SwapLE32( itmp ); + #endif + + numfan = meshsizex*meshsizey; +@@ -3299,9 +3300,9 @@ + meshfx[fan] = itmp>>16; + meshtile[fan] = itmp; + #else +- meshtype[fan] = EndianS32_LtoB( itmp )>>24; +- meshfx[fan] = EndianS32_LtoB( itmp )>>16; +- meshtile[fan] = EndianS32_LtoB( itmp ); ++ meshtype[fan] = SDL_SwapLE32( itmp )>>24; ++ meshfx[fan] = SDL_SwapLE32( itmp )>>16; ++ meshtile[fan] = SDL_SwapLE32( itmp ); + #endif + + fan++; +@@ -3315,7 +3316,7 @@ + #ifdef _LITTLE_ENDIAN + meshtwist[fan] = itmp; + #else +- meshtwist[fan] = EndianS32_LtoB( itmp ); ++ meshtwist[fan] = SDL_SwapLE32( itmp ); + #endif + + fan++; +@@ -3387,7 +3388,7 @@ + #ifdef _LITTLE_ENDIAN + meshvrta[cnt] = itmp; + #else +- meshvrta[cnt] = EndianS32_LtoB( itmp ); ++ meshvrta[cnt] = SDL_SwapLE32( itmp ); + #endif + meshvrtl[cnt] = 0; + -- cgit v1.2.3-65-gdbad