aboutsummaryrefslogtreecommitdiffstats
path: root/games/cleanq3
diff options
context:
space:
mode:
authoralepulver <alepulver@FreeBSD.org>2006-07-24 02:56:26 +0800
committeralepulver <alepulver@FreeBSD.org>2006-07-24 02:56:26 +0800
commit9fc8ec49dfbba1e61e8c4ea86a294e1a0ef611d7 (patch)
treed885180368e9d4eee667641cd9b6a14f0c998a17 /games/cleanq3
parent2fd6173bb8db9e9f2a87b2e8bd1a4d803737e196 (diff)
downloadfreebsd-ports-gnome-9fc8ec49dfbba1e61e8c4ea86a294e1a0ef611d7.tar.gz
freebsd-ports-gnome-9fc8ec49dfbba1e61e8c4ea86a294e1a0ef611d7.tar.zst
freebsd-ports-gnome-9fc8ec49dfbba1e61e8c4ea86a294e1a0ef611d7.zip
- Bump PORTREVISION.
- Use Makefile for building instead of scons, and remove Perl dependency. - Use pkg-plist. - Add OPTIONS. Allow to build without X11, threaded version, etc. - Fix building on non-i386 and FreeBSD 4.X. - Respect CFLAGS when optimizations are enabled. - Add patch to fix 2 security vulnerabilities [1]. PR: ports/98295 Submitted by: alepulver (myself) Approved by: maintainer (timeout) Obtained from: q3icculus (http://icculus.org/quake3/) [1] Security: CVE-2006-2082 [1]
Diffstat (limited to 'games/cleanq3')
-rw-r--r--games/cleanq3/Makefile127
-rw-r--r--games/cleanq3/files/patch-code-Construct68
-rw-r--r--games/cleanq3/files/patch-code-cgame-cg_weapons.c23
-rw-r--r--games/cleanq3/files/patch-code-game-q_shared.c113
-rw-r--r--games/cleanq3/files/patch-code-game-q_shared.h130
-rw-r--r--games/cleanq3/files/patch-code-q3_ui-ui_playermodel.c11
-rw-r--r--games/cleanq3/files/patch-code-q3_ui-ui_players.c18
-rw-r--r--games/cleanq3/files/patch-code-q3_ui-ui_saveconfig.c11
-rw-r--r--games/cleanq3/files/patch-code-qcommon-common.c19
-rw-r--r--games/cleanq3/files/patch-code-qcommon-vm.c29
-rw-r--r--games/cleanq3/files/patch-code-renderer-tr_bsp.c11
-rw-r--r--games/cleanq3/files/patch-code-renderer-tr_shader.c29
-rw-r--r--games/cleanq3/files/patch-code-server-sv_client.c73
-rw-r--r--games/cleanq3/files/patch-code-ui-ui_main.c11
-rw-r--r--games/cleanq3/files/patch-code-ui-ui_players.c18
-rw-r--r--games/cleanq3/files/patch-code-unix-Conscript-client26
-rw-r--r--games/cleanq3/files/patch-code-unix-Makefile364
-rw-r--r--games/cleanq3/files/patch-code-unix-cons27
-rw-r--r--games/cleanq3/files/patch-code-unix-unix_main.c6
-rw-r--r--games/cleanq3/files/patch-code-unix-unix_shared.c14
-rw-r--r--games/cleanq3/pkg-plist13
21 files changed, 957 insertions, 184 deletions
diff --git a/games/cleanq3/Makefile b/games/cleanq3/Makefile
index 17f232a76a0d..041da4d3aaca 100644
--- a/games/cleanq3/Makefile
+++ b/games/cleanq3/Makefile
@@ -7,6 +7,7 @@
PORTNAME= cleanq3
PORTVERSION= 0.5.2
+PORTREVISION= 1
CATEGORIES= games
MASTER_SITES= http://tremor.quakedev.com/
DISTNAME= CleanQ3_v${PORTVERSION}-srcbin
@@ -14,72 +15,104 @@ DISTNAME= CleanQ3_v${PORTVERSION}-srcbin
MAINTAINER= danfe@FreeBSD.org
COMMENT= Cleaned up copy of the original Quake III Arena source code
-BUILD_DEPENDS= nasm:${PORTSDIR}/devel/nasm
-
USE_ZIP= yes
-USE_PERL5_BUILD=yes
USE_DOS2UNIX= yes
+USE_GMAKE= yes
USE_GCC= 3.2+
-USE_GL= yes
-
WRKSRC= ${WRKDIR}/CleanQ3
-INSTDIR= ${WRKSRC}/code/install
+BUILD_WRKSRC= ${WRKSRC}/code/unix
-PLIST_FILES= bin/cleanq3 bin/cleanq3ded \
- lib/cleanq3/baseq3/cgame.so \
- lib/cleanq3/baseq3/qagame.so \
- lib/cleanq3/baseq3/ui.so \
- lib/cleanq3/missionpack/cgame.so \
- lib/cleanq3/missionpack/qagame.so \
- lib/cleanq3/missionpack/ui.so
-PLIST_DIRS= lib/cleanq3/baseq3 lib/cleanq3/missionpack lib/cleanq3
+OPTIONS= CLIENT "Build client" on \
+ DEDICATED "Build dedicated server" on \
+ GAMELIBS "Build game libraries (when not mandatory)" off \
+ OPTIMIZED_CFLAGS "Enable compilation optimizations" on \
+ SMP "Build SMP (threaded) client" on
-OPTIONS= OPTIMIZED_CFLAGS "Build with extra optimization options" on
+MAKE_ENV= LIBDIR="${LIBDIR}"
+PLIST_SUB= LIBDIR="${LIBDIR:S/${PREFIX}\///}"
+
+LIBDIR= ${PREFIX}/lib/${PORTNAME}
+VM_ARCHS= i386 powerpc
.include <bsd.port.pre.mk>
-.if ${ARCH} != "i386"
-BROKEN= Does not compile on ${ARCH}
+.if defined(WITHOUT_CLIENT) && defined(WITHOUT_DEDICATED) && \
+ defined(WITHOUT_SMP)
+IGNORE= needs at least one of CLIENT, DEDICATED and SMP options
+.endif
+
+.if ${ARCH} == "i386"
+BUILD_DEPENDS+= nasm:${PORTSDIR}/devel/nasm
.endif
-.if ${OSVERSION} < 500000
-BROKEN= Does not compile on 4.x
+.for i in ${ARCH}
+. if ${VM_ARCHS:M${i}} != ""
+HAVE_VM_COMPILED= yes
+. endif
+.endfor
+
+.if !defined(HAVE_VM_COMPILED)
+MAKE_ENV+= DLL_ONLY=true
.endif
-.if defined(WITH_OPTIMIZED_CFLAGS)
-CFLAGS= -O6 -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 \
- -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
+.if !defined(WITHOUT_CLIENT) || !defined(WITHOUT_SMP)
+USE_GL= yes
.endif
-post-patch: .SILENT
- ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g ; \
- s|%%X11BASE%%|${X11BASE}|g ; s|%%CFLAGS%%|${CFLAGS}|' \
- ${WRKSRC}/code/Construct ${WRKSRC}/code/unix/Conscript-client
- ${REINPLACE_CMD} -e 's|-ldl || ; s|i386\.so|\.so|' \
- ${WRKSRC}/code/cgame/Conscript \
- ${WRKSRC}/code/game/Conscript ${WRKSRC}/code/q3_ui/Conscript \
- ${WRKSRC}/code/unix/Conscript-dedicated \
- ${WRKSRC}/code/ui/Conscript
- ${REINPLACE_CMD} -e 's|%%Q3DIR%%|"${Q3DIR}"|' \
- ${WRKSRC}/code/unix/unix_shared.c
- ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' \
- ${WRKSRC}/code/unix/unix_main.c
- ${REINPLACE_CMD} -e 's|botlib.log|/dev/null|' \
- ${WRKSRC}/code/botlib/be_interface.c
+.if !defined(WITHOUT_CLIENT)
+MAKE_ENV+= CLIENT=YES
+PLIST_SUB+= CLIENT=""
+Q3BIN+= cleanq3
+.else
+PLIST_SUB+= CLIENT="@comment "
+.endif
-do-build:
- cd ${WRKSRC}/code && ${MAKE_ENV} ${PERL} unix/cons
+.if !defined(WITHOUT_DEDICATED)
+MAKE_ENV+= DEDICATED=YES
+PLIST_SUB+= DEDICATED=""
+Q3BIN+= cleanq3ded
+.else
+PLIST_SUB+= DEDICATED="@comment "
+.endif
+
+.if defined(WITH_GAMELIBS) || !defined(HAVE_VM_COMPILED)
+MAKE_ENV+= GAMELIBS=YES
+PLIST_SUB+= GAMELIBS=""
+.else
+PLIST_SUB+= GAMELIBS="@comment "
+.endif
+
+.if !defined(WITHOUT_OPTIMIZED_CFLAGS)
+MAKE_ENV+= OPTIMIZED_CFLAGS=YES
+.endif
+
+.if !defined(WITHOUT_SMP)
+MAKE_ENV+= SMP=YES \
+ PTHREAD_LIBS="${PTHREAD_LIBS}"
+PLIST_SUB+= SMP=""
+Q3BIN+= cleanq3-smp
+.else
+PLIST_SUB+= SMP="@comment "
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|botlib\.log|/dev/null|' \
+ ${WRKSRC}/code/botlib/be_interface.c
+ @${REINPLACE_CMD} -e \
+ 's|//[[:blank:]]*\(Swap_Init[[:blank:]]*();\)|\1|' \
+ ${WRKSRC}/code/botlib/be_interface.c \
+ ${WRKSRC}/code/renderer/tr_init.c
do-install:
- ${INSTALL_PROGRAM} ${INSTDIR}/linuxquake3 ${PREFIX}/bin/cleanq3
- ${INSTALL_PROGRAM} ${INSTDIR}/linuxq3ded ${PREFIX}/bin/cleanq3ded
-.for d in baseq3 missionpack
- @${MKDIR} ${PREFIX}/lib/cleanq3/${d}
- ${INSTALL_PROGRAM} ${INSTDIR}/${d}/cgame.so ${PREFIX}/lib/cleanq3/${d}
- ${INSTALL_PROGRAM} ${INSTDIR}/${d}/qagame.so ${PREFIX}/lib/cleanq3/${d}
- ${INSTALL_PROGRAM} ${INSTDIR}/${d}/ui.so ${PREFIX}/lib/cleanq3/${d}
+.for bin in ${Q3BIN}
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/release/${bin} ${PREFIX}/bin
+.endfor
+.if defined(WITH_GAMELIBS) || !defined(HAVE_VM_COMPILED)
+.for dir in baseq3 missionpack
+ ${MKDIR} ${LIBDIR}/${dir}
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/release/${dir}/*.so ${LIBDIR}/${dir}
.endfor
+.endif
.include "${.CURDIR}/../quake3-data/Makefile.include"
-
.include <bsd.port.post.mk>
diff --git a/games/cleanq3/files/patch-code-Construct b/games/cleanq3/files/patch-code-Construct
deleted file mode 100644
index 9c8e786e9ade..000000000000
--- a/games/cleanq3/files/patch-code-Construct
+++ /dev/null
@@ -1,68 +0,0 @@
---- code/Construct.orig Mon Mar 20 18:19:09 2006
-+++ code/Construct Mon Mar 20 18:37:12 2006
-@@ -19,8 +19,8 @@
- use Cons_gcc;
-
- # defaults
--$config = 'debug';
--$do_smp = 1;
-+$config = 'release';
-+$do_smp = 0;
- $do_masterserver = 0;
- $do_authserver = 0;
- $do_authport = 0;
-@@ -30,10 +30,10 @@
- $do_pk3 = 0;
- # those are exported
- $DO_WIN32 = 0;
--$NO_VM = 0;
-+$NO_VM = 1;
- $NO_SO = 0;
--$CC='gcc';
--$CXX='g++';
-+$CC=$ENV{CC};
-+$CXX=$ENV{CXX};
-
- # detect an sdk build (don't attempt client build and other things)
- if ( -r 'unix/Conscript-client' )
-@@ -63,9 +63,6 @@
- else
- {
- # libc .. do the little magic!
-- $libc_cmd = '/lib/libc.so.6 |grep "GNU C "|grep version|awk -F "version " \'{ print $2 }\'|cut -b -3';
-- $libc = `$libc_cmd`;
-- chop ($libc);
- }
-
- if ($DO_WIN32 eq 1)
-@@ -227,7 +224,7 @@
- # build the config directory
- $CONFIG_DIR = $config . '-' . $cpu . '-' . $OS . '-' . $libc;
-
--$COMMON_CFLAGS = '-pipe -fsigned-char ';
-+$COMMON_CFLAGS = '-pipe -fsigned-char -I%%LOCALBASE%%/include -L%%LOCALBASE%%/lib -I%%X11BASE%%/include -L%%X11BASE%%/lib ';
-
- if ($config eq 'debug')
- {
-@@ -237,7 +234,7 @@
- }
- else
- {
-- $BASE_CFLAGS = $COMMON_CFLAGS . '-DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -fomit-frame-pointer -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce ';
-+ $BASE_CFLAGS = $COMMON_CFLAGS . '-DNDEBUG %%CFLAGS%% ';
- $BSPC_BASE_CFLAGS = $BASE_CFLAGS . '-DLINUX -DBSPC -Dstricmp=strcasecmp ';
- }
-
-@@ -302,9 +299,9 @@
- }
-
- # build tools
--$env_tools = new cons();
--Command $env_tools 'qvmtools/q3lcc', '[perl] &build_tools(\'q3lcc\')';
--Command $env_tools 'qvmtools/q3asm', '[perl] &build_tools(\'q3asm\')';
-+#$env_tools = new cons();
-+#Command $env_tools 'qvmtools/q3lcc', '[perl] &build_tools(\'q3lcc\')';
-+#Command $env_tools 'qvmtools/q3asm', '[perl] &build_tools(\'q3asm\')';
-
- if ($do_bspc eq 1)
- {
diff --git a/games/cleanq3/files/patch-code-cgame-cg_weapons.c b/games/cleanq3/files/patch-code-cgame-cg_weapons.c
new file mode 100644
index 000000000000..500eadd79101
--- /dev/null
+++ b/games/cleanq3/files/patch-code-cgame-cg_weapons.c
@@ -0,0 +1,23 @@
+--- ./code/cgame/cg_weapons.c.orig Wed May 31 20:52:06 2006
++++ ./code/cgame/cg_weapons.c Wed May 31 20:52:54 2006
+@@ -636,17 +636,17 @@
+ }
+
+ strcpy( path, item->world_model[0] );
+- COM_StripExtension( path, path );
++ COM_StripExtension( path, path, sizeof(path) );
+ strcat( path, "_flash.md3" );
+ weaponInfo->flashModel = trap_R_RegisterModel( path );
+
+ strcpy( path, item->world_model[0] );
+- COM_StripExtension( path, path );
++ COM_StripExtension( path, path, sizeof(path) );
+ strcat( path, "_barrel.md3" );
+ weaponInfo->barrelModel = trap_R_RegisterModel( path );
+
+ strcpy( path, item->world_model[0] );
+- COM_StripExtension( path, path );
++ COM_StripExtension( path, path, sizeof(path) );
+ strcat( path, "_hand.md3" );
+ weaponInfo->handsModel = trap_R_RegisterModel( path );
+
diff --git a/games/cleanq3/files/patch-code-game-q_shared.c b/games/cleanq3/files/patch-code-game-q_shared.c
new file mode 100644
index 000000000000..cf54cfb63698
--- /dev/null
+++ b/games/cleanq3/files/patch-code-game-q_shared.c
@@ -0,0 +1,113 @@
+--- ./code/game/q_shared.c.orig Wed May 31 20:52:06 2006
++++ ./code/game/q_shared.c Wed May 31 20:54:26 2006
+@@ -38,14 +38,21 @@
+ COM_StripExtension
+ ============
+ */
+-void COM_StripExtension( const char *in, char *out ) {
+- while ( *in && *in != '.' ) {
+- *out++ = *in++;
++void COM_StripExtension( const char *in, char *out, int destsize ) {
++ int length;
++
++ Q_strncpyz(out, in, destsize);
++
++ length = strlen(out)-1;
++ while (length > 0 && out[length] != '.') {
++ length--;
++ if (out[length] == '/')
++ return; // no extension
+ }
+- *out = 0;
++ if (length)
++ out[length] = 0;
+ }
+
+-
+ /*
+ ==================
+ COM_DefaultExtension
+@@ -79,29 +86,28 @@
+
+ ============================================================================
+ */
+-/*
++
+ // can't just use function pointers, or dll linkage can
+ // mess up when qcommon is included in multiple places
+-static short (*_BigShort) (short l);
+-static short (*_LittleShort) (short l);
+-static int (*_BigLong) (int l);
+-static int (*_LittleLong) (int l);
++static int16_t (*_BigShort) (int16_t l);
++static int16_t (*_LittleShort) (int16_t l);
++static int32_t (*_BigLong) (int32_t l);
++static int32_t (*_LittleLong) (int32_t l);
+ static qint64 (*_BigLong64) (qint64 l);
+ static qint64 (*_LittleLong64) (qint64 l);
+ static float (*_BigFloat) (const float *l);
+ static float (*_LittleFloat) (const float *l);
+
+-short BigShort(short l){return _BigShort(l);}
+-short LittleShort(short l) {return _LittleShort(l);}
+-int BigLong (int l) {return _BigLong(l);}
+-int LittleLong (int l) {return _LittleLong(l);}
++int16_t BigShort(int16_t l){return _BigShort(l);}
++int16_t LittleShort(int16_t l) {return _LittleShort(l);}
++int32_t BigLong (int32_t l) {return _BigLong(l);}
++int32_t LittleLong (int32_t l) {return _LittleLong(l);}
+ qint64 BigLong64 (qint64 l) {return _BigLong64(l);}
+ qint64 LittleLong64 (qint64 l) {return _LittleLong64(l);}
+-float BigFloat (const float *l) {return _BigFloat(l);}
+-float LittleFloat (const float *l) {return _LittleFloat(l);}
+-*/
++float BigFloat (float l) {return _BigFloat(&l);}
++float LittleFloat (float l) {return _LittleFloat(&l);}
+
+-short ShortSwap (short l)
++int16_t ShortSwap (int16_t l)
+ {
+ byte b1,b2;
+
+@@ -111,12 +117,12 @@
+ return (b1<<8) + b2;
+ }
+
+-short ShortNoSwap (short l)
++int16_t ShortNoSwap (int16_t l)
+ {
+ return l;
+ }
+
+-int LongSwap (int l)
++int32_t LongSwap (int32_t l)
+ {
+ byte b1,b2,b3,b4;
+
+@@ -128,7 +134,7 @@
+ return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
+ }
+
+-int LongNoSwap (int l)
++int32_t LongNoSwap (int32_t l)
+ {
+ return l;
+ }
+@@ -179,7 +185,7 @@
+ Swap_Init
+ ================
+ */
+-/*
++
+ void Swap_Init (void)
+ {
+ byte swaptest[2] = {1,0};
+@@ -209,7 +215,7 @@
+ }
+
+ }
+-*/
++
+
+ /*
+ ============================================================================
diff --git a/games/cleanq3/files/patch-code-game-q_shared.h b/games/cleanq3/files/patch-code-game-q_shared.h
index f09f3e35d13b..cdb5561848d1 100644
--- a/games/cleanq3/files/patch-code-game-q_shared.h
+++ b/games/cleanq3/files/patch-code-game-q_shared.h
@@ -1,6 +1,92 @@
---- code/game/q_shared.h.orig Tue Aug 16 02:10:07 2005
-+++ code/game/q_shared.h Tue Aug 23 14:16:34 2005
-@@ -452,13 +452,9 @@
+--- ./code/game/q_shared.h.orig Wed May 31 20:52:06 2006
++++ ./code/game/q_shared.h Wed May 31 20:54:33 2006
+@@ -126,12 +126,14 @@
+
+ #define ID_INLINE __inline
+
++#if 0
+ static ID_INLINE short BigShort( short l) { return ShortSwap(l); }
+ #define LittleShort
+ static ID_INLINE int BigLong(int l) { LongSwap(l); }
+ #define LittleLong
+ static ID_INLINE float BigFloat(const float *l) { FloatSwap(l); }
+ #define LittleFloat
++#endif
+
+ #define PATH_SEP '\\'
+
+@@ -182,12 +184,14 @@
+ return fi;
+ }
+
++#if 0
+ #define BigShort
+ static inline short LittleShort(short l) { return ShortSwap(l); }
+ #define BigLong
+ static inline int LittleLong (int l) { return LongSwap(l); }
+ #define BigFloat
+ static inline float LittleFloat (const float l) { return FloatSwap(&l); }
++#endif
+
+ #endif
+
+@@ -205,12 +209,14 @@
+
+ void Sys_PumpEvents( void );
+
++#if 0
+ #define BigShort
+ static inline short LittleShort(short l) { return ShortSwap(l); }
+ #define BigLong
+ static inline int LittleLong (int l) { return LongSwap(l); }
+ #define BigFloat
+ static inline float LittleFloat (const float l) { return FloatSwap(&l); }
++#endif
+
+ #endif
+
+@@ -244,6 +250,7 @@
+ #define BOTLIB_HARD_LINKED
+ #endif
+
++#if 0
+ #if !idppc
+ inline static short BigShort( short l) { return ShortSwap(l); }
+ #define LittleShort
+@@ -259,6 +266,7 @@
+ #define BigFloat
+ inline static float LittleFloat (const float *l) { return FloatSwap(l); }
+ #endif
++#endif
+
+ #endif
+
+@@ -280,8 +288,16 @@
+
+ #define PATH_SEP '/'
+
++#include <machine/param.h>
++#if __FreeBSD_version < 500000
++#include <inttypes.h>
++#else
++#include <stdint.h>
++#endif
++
+ // bk010116 - omitted Q3STATIC (see Linux above), broken target
+
++#if 0
+ #if !idppc
+ static short BigShort( short l) { return ShortSwap(l); }
+ #define LittleShort
+@@ -297,6 +313,7 @@
+ #define BigFloat
+ static float LittleFloat (const float *l) { return FloatSwap(l); }
+ #endif
++#endif
+
+ #endif
+
+@@ -428,13 +445,9 @@
void *Hunk_Alloc( int size, ha_pref preference );
#endif
@@ -14,3 +100,41 @@
#if !( defined __VECTORC )
void Com_Memset (void* dest, const int val, const size_t count);
+@@ -763,7 +776,7 @@
+ float Com_Clamp( float min, float max, float value );
+
+ char *COM_SkipPath( char *pathname );
+-void COM_StripExtension( const char *in, char *out );
++void COM_StripExtension( const char *in, char *out, int destsize );
+ void COM_DefaultExtension( char *path, int maxSize, const char *extension );
+
+ void COM_BeginParseSession( const char *name );
+@@ -864,18 +877,18 @@
+ } qint64;
+
+ //=============================================
+-/*
+-short BigShort(short l);
+-short LittleShort(short l);
+-int BigLong (int l);
+-int LittleLong (int l);
+-qint64 BigLong64 (qint64 l);
+-qint64 LittleLong64 (qint64 l);
+-float BigFloat (const float *l);
+-float LittleFloat (const float *l);
++
++int16_t BigShort(int16_t l);
++int16_t LittleShort(int16_t l);
++int32_t BigLong (int32_t l);
++int32_t LittleLong (int32_t l);
++qint64 BigLong64 (qint64 l);
++qint64 LittleLong64 (qint64 l);
++float BigFloat (float l);
++float LittleFloat (float l);
+
+ void Swap_Init (void);
+-*/
++
+ char * QDECL va(char *format, ...);
+
+ //=============================================
diff --git a/games/cleanq3/files/patch-code-q3_ui-ui_playermodel.c b/games/cleanq3/files/patch-code-q3_ui-ui_playermodel.c
new file mode 100644
index 000000000000..129a50885f05
--- /dev/null
+++ b/games/cleanq3/files/patch-code-q3_ui-ui_playermodel.c
@@ -0,0 +1,11 @@
+--- ./code/q3_ui/ui_playermodel.c.orig Wed May 31 20:52:07 2006
++++ ./code/q3_ui/ui_playermodel.c Wed May 31 20:54:50 2006
+@@ -404,7 +404,7 @@
+ {
+ filelen = strlen(fileptr);
+
+- COM_StripExtension(fileptr,skinname);
++ COM_StripExtension(fileptr, skinname, sizeof(skinname));
+
+ // look for icon_????
+ if (!Q_stricmpn(skinname,"icon_",5))
diff --git a/games/cleanq3/files/patch-code-q3_ui-ui_players.c b/games/cleanq3/files/patch-code-q3_ui-ui_players.c
new file mode 100644
index 000000000000..29ea1677b16c
--- /dev/null
+++ b/games/cleanq3/files/patch-code-q3_ui-ui_players.c
@@ -0,0 +1,18 @@
+--- ./code/q3_ui/ui_players.c.orig Wed May 31 20:52:07 2006
++++ ./code/q3_ui/ui_players.c Wed May 31 20:55:05 2006
+@@ -69,13 +69,13 @@
+
+ if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
+ strcpy( path, item->world_model[0] );
+- COM_StripExtension( path, path );
++ COM_StripExtension( path, path, sizeof(path) );
+ strcat( path, "_barrel.md3" );
+ pi->barrelModel = trap_R_RegisterModel( path );
+ }
+
+ strcpy( path, item->world_model[0] );
+- COM_StripExtension( path, path );
++ COM_StripExtension( path, path, sizeof(path) );
+ strcat( path, "_flash.md3" );
+ pi->flashModel = trap_R_RegisterModel( path );
+
diff --git a/games/cleanq3/files/patch-code-q3_ui-ui_saveconfig.c b/games/cleanq3/files/patch-code-q3_ui-ui_saveconfig.c
new file mode 100644
index 000000000000..e6dc2d19819b
--- /dev/null
+++ b/games/cleanq3/files/patch-code-q3_ui-ui_saveconfig.c
@@ -0,0 +1,11 @@
+--- ./code/q3_ui/ui_saveconfig.c.orig Wed May 31 20:52:07 2006
++++ ./code/q3_ui/ui_saveconfig.c Wed May 31 20:55:15 2006
+@@ -85,7 +85,7 @@
+ return;
+ }
+
+- COM_StripExtension(saveConfig.savename.field.buffer, configname );
++ COM_StripExtension(saveConfig.savename.field.buffer, configname, sizeof(configname) );
+ trap_Cmd_ExecuteText( EXEC_APPEND, va( "writeconfig %s.cfg\n", configname ) );
+ UI_PopMenu();
+ }
diff --git a/games/cleanq3/files/patch-code-qcommon-common.c b/games/cleanq3/files/patch-code-qcommon-common.c
index 9db06e6c63a5..9fe202355cd9 100644
--- a/games/cleanq3/files/patch-code-qcommon-common.c
+++ b/games/cleanq3/files/patch-code-qcommon-common.c
@@ -1,15 +1,15 @@
---- code/qcommon/common.c.orig Mon Aug 15 23:10:07 2005
-+++ code/qcommon/common.c Wed Nov 23 10:53:29 2005
+--- ./code/qcommon/common.c.orig Wed May 31 20:52:07 2006
++++ ./code/qcommon/common.c Wed May 31 20:52:09 2006
@@ -24,15 +24,8 @@
#include "../game/q_shared.h"
#include "qcommon.h"
#include <setjmp.h>
-#ifdef __linux__
-+#include <sys/types.h>
- #include <netinet/in.h>
+-#include <netinet/in.h>
-#else
-#if defined(MACOS_X)
--#include <netinet/in.h>
++#include <sys/types.h>
+ #include <netinet/in.h>
-#else
-#include <winsock.h>
-#endif
@@ -17,3 +17,12 @@
int demo_protocols[] =
{ 66, 67, 68, 0 };
+@@ -2367,7 +2360,7 @@
+ // cvar and command buffer management
+ Com_ParseCommandLine( commandLine );
+
+-// Swap_Init ();
++ Swap_Init ();
+ Cbuf_Init ();
+
+ Com_InitZoneMemory();
diff --git a/games/cleanq3/files/patch-code-qcommon-vm.c b/games/cleanq3/files/patch-code-qcommon-vm.c
new file mode 100644
index 000000000000..e356997ce52f
--- /dev/null
+++ b/games/cleanq3/files/patch-code-qcommon-vm.c
@@ -0,0 +1,29 @@
+--- code/qcommon/vm.c.orig Wed May 31 23:18:41 2006
++++ code/qcommon/vm.c Wed May 31 23:19:43 2006
+@@ -225,7 +225,7 @@
+ return;
+ }
+
+- COM_StripExtension( vm->name, name );
++ COM_StripExtension( vm->name, name, sizeof(name) );
+ Com_sprintf( symbols, sizeof( symbols ), "vm/%s.map", name );
+ len = FS_ReadFile( symbols, (void **)&mapfile );
+ if ( !mapfile ) {
+@@ -478,7 +478,7 @@
+ }
+ }
+
+- if ( interpret == VMI_NATIVE ) {
++ if ( 1 ) {
+ // try to load as a system dll
+ Com_Printf( "Loading dll file %s.\n", vm->name );
+ vm->dllHandle = Sys_LoadDll( module, vm->fqpath , &vm->entryPoint, VM_DllSyscall );
+@@ -826,7 +826,7 @@
+
+
+
+-#ifdef oDLL_ONLY // bk010215 - for DLL_ONLY dedicated servers/builds w/o VM
++#ifdef DLL_ONLY // bk010215 - for DLL_ONLY dedicated servers/builds w/o VM
+ int VM_CallCompiled( vm_t *vm, int *args ) {
+ return(0);
+ }
diff --git a/games/cleanq3/files/patch-code-renderer-tr_bsp.c b/games/cleanq3/files/patch-code-renderer-tr_bsp.c
new file mode 100644
index 000000000000..6d5ab5cbbf0c
--- /dev/null
+++ b/games/cleanq3/files/patch-code-renderer-tr_bsp.c
@@ -0,0 +1,11 @@
+--- ./code/renderer/tr_bsp.c.orig Wed May 31 20:52:07 2006
++++ ./code/renderer/tr_bsp.c Wed May 31 20:55:47 2006
+@@ -1820,7 +1820,7 @@
+ Q_strncpyz( s_worldData.name, name, sizeof( s_worldData.name ) );
+
+ Q_strncpyz( s_worldData.baseName, COM_SkipPath( s_worldData.name ), sizeof( s_worldData.name ) );
+- COM_StripExtension( s_worldData.baseName, s_worldData.baseName );
++ COM_StripExtension( s_worldData.baseName, s_worldData.baseName, sizeof(s_worldData.baseName) );
+
+ startMarker = ri.Hunk_Alloc(0, h_low);
+ c_gridVerts = 0;
diff --git a/games/cleanq3/files/patch-code-renderer-tr_shader.c b/games/cleanq3/files/patch-code-renderer-tr_shader.c
new file mode 100644
index 000000000000..ca343bc0bcd6
--- /dev/null
+++ b/games/cleanq3/files/patch-code-renderer-tr_shader.c
@@ -0,0 +1,29 @@
+--- ./code/renderer/tr_shader.c.orig Wed May 31 20:52:08 2006
++++ ./code/renderer/tr_shader.c Wed May 31 20:56:20 2006
+@@ -99,7 +99,7 @@
+
+ // remap all the shaders with the given name
+ // even tho they might have different lightmaps
+- COM_StripExtension( shaderName, strippedName );
++ COM_StripExtension( shaderName, strippedName, sizeof(strippedName) );
+ hash = generateHashValue(strippedName, FILE_HASH_SIZE);
+ for (sh = hashTable[hash]; sh; sh = sh->next) {
+ if (Q_stricmp(sh->name, strippedName) == 0) {
+@@ -2368,7 +2368,7 @@
+ return tr.defaultShader;
+ }
+
+- COM_StripExtension( name, strippedName );
++ COM_StripExtension( name, strippedName, sizeof(strippedName) );
+
+ hash = generateHashValue(strippedName, FILE_HASH_SIZE);
+
+@@ -2436,7 +2436,7 @@
+ lightmapIndex = LIGHTMAP_BY_VERTEX;
+ }
+
+- COM_StripExtension( name, strippedName );
++ COM_StripExtension( name, strippedName, sizeof(strippedName) );
+
+ hash = generateHashValue(strippedName, FILE_HASH_SIZE);
+
diff --git a/games/cleanq3/files/patch-code-server-sv_client.c b/games/cleanq3/files/patch-code-server-sv_client.c
new file mode 100644
index 000000000000..834065de04b6
--- /dev/null
+++ b/games/cleanq3/files/patch-code-server-sv_client.c
@@ -0,0 +1,73 @@
+--- code/server/sv_client.c.orig Thu Jun 1 14:50:21 2006
++++ code/server/sv_client.c Thu Jun 1 15:19:29 2006
+@@ -756,24 +756,54 @@
+ int curindex;
+ int rate;
+ int blockspersnap;
+- int idPack, missionPack;
++ int idPack, missionPack, unreferenced = 1;
+ char errorMessage[1024];
++ char pakbuf[MAX_OSPATH], *pakptr;
++ const char *referencedPaks;
++ int numRefPaks;
+
+ if (!*cl->downloadName)
+ return; // Nothing being downloaded
+
+ if (!cl->download) {
+- // We open the file here
++ // Chop off filename extension.
++ Com_sprintf(pakbuf, sizeof(pakbuf), "%s", cl->downloadName);
++ pakptr = Q_strrchr(pakbuf, '.');
+
+- Com_Printf( "clientDownload: %d : begining \"%s\"\n", cl - svs.clients, cl->downloadName );
++ if (pakptr) {
++ *pakptr = '\0';
+
+- missionPack = FS_idPak(cl->downloadName, "missionpack");
+- idPack = missionPack || FS_idPak(cl->downloadName, "baseq3");
++ // Check for pk3 filename extension
++ if (!Q_stricmp(pakptr + 1, "pk3")) {
++ referencedPaks = FS_ReferencedPakNames();
+
+- if ( !sv_allowDownload->integer || idPack ||
++ // Check whether the file appears in the list of referenced
++ // paks to prevent downloading of arbitrary files.
++ Cmd_TokenizeString(referencedPaks);
++ numRefPaks = Cmd_Argc();
++
++ for (curindex = 0; curindex < numRefPaks; curindex++) {
++ if (!FS_FilenameCompare(Cmd_Argv(curindex), pakbuf)) {
++ unreferenced = 0;
++
++ // now that we know the file is referenced,
++ // check whether it's legal to download it.
++ missionPack = FS_idPak(pakbuf, "missionpack");
++ idPack = missionPack || FS_idPak(pakbuf, BASEGAME);
++
++ break;
++ }
++ }
++ }
++ }
++
++ // We open the file here
++ if ( !sv_allowDownload->integer || idPack || unreferenced ||
+ ( cl->downloadSize = FS_SV_FOpenFileRead( cl->downloadName, &cl->download ) ) <= 0 ) {
+ // cannot auto-download file
+- if (idPack) {
++ if (unreferenced) {
++ Com_sprintf(errorMessage, sizeof(errorMessage), "File \"%s\" is not referenced and cannot be downloaded.", cl->downloadName);
++ } else if (idPack) {
+ Com_Printf("clientDownload: %d : \"%s\" cannot download id pk3 files\n", cl - svs.clients, cl->downloadName);
+ if (missionPack) {
+ Com_sprintf(errorMessage, sizeof(errorMessage), "Cannot autodownload Team Arena file \"%s\"\n"
+@@ -809,6 +839,8 @@
+ return;
+ }
+
++ Com_Printf( "clientDownload: %d : beginning \"%s\"\n", cl - svs.clients, cl->downloadName );
++
+ // Init
+ cl->downloadCurrentBlock = cl->downloadClientBlock = cl->downloadXmitBlock = 0;
+ cl->downloadCount = 0;
diff --git a/games/cleanq3/files/patch-code-ui-ui_main.c b/games/cleanq3/files/patch-code-ui-ui_main.c
new file mode 100644
index 000000000000..ea3b48bf5109
--- /dev/null
+++ b/games/cleanq3/files/patch-code-ui-ui_main.c
@@ -0,0 +1,11 @@
+--- ./code/ui/ui_main.c.orig Wed May 31 20:52:08 2006
++++ ./code/ui/ui_main.c Wed May 31 20:56:29 2006
+@@ -4971,7 +4971,7 @@
+ {
+ filelen = strlen(fileptr);
+
+- COM_StripExtension(fileptr,skinname);
++ COM_StripExtension(fileptr, skinname, sizeof(skinname));
+
+ // look for icon_????
+ if (Q_stricmpn(skinname, "icon_", 5) == 0 && !(Q_stricmp(skinname,"icon_blue") == 0 || Q_stricmp(skinname,"icon_red") == 0))
diff --git a/games/cleanq3/files/patch-code-ui-ui_players.c b/games/cleanq3/files/patch-code-ui-ui_players.c
new file mode 100644
index 000000000000..2fd07e7d6ed9
--- /dev/null
+++ b/games/cleanq3/files/patch-code-ui-ui_players.c
@@ -0,0 +1,18 @@
+--- ./code/ui/ui_players.c.orig Wed May 31 20:52:08 2006
++++ ./code/ui/ui_players.c Wed May 31 20:56:47 2006
+@@ -70,13 +70,13 @@
+
+ if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
+ strcpy( path, item->world_model[0] );
+- COM_StripExtension( path, path );
++ COM_StripExtension( path, path, sizeof(path) );
+ strcat( path, "_barrel.md3" );
+ pi->barrelModel = trap_R_RegisterModel( path );
+ }
+
+ strcpy( path, item->world_model[0] );
+- COM_StripExtension( path, path );
++ COM_StripExtension( path, path, sizeof(path) );
+ strcat( path, "_flash.md3" );
+ pi->flashModel = trap_R_RegisterModel( path );
+
diff --git a/games/cleanq3/files/patch-code-unix-Conscript-client b/games/cleanq3/files/patch-code-unix-Conscript-client
deleted file mode 100644
index a54e6cc1ff7d..000000000000
--- a/games/cleanq3/files/patch-code-unix-Conscript-client
+++ /dev/null
@@ -1,26 +0,0 @@
---- code/unix/Conscript-client.orig Fri Mar 17 13:50:18 2006
-+++ code/unix/Conscript-client Fri Mar 17 13:50:40 2006
-@@ -147,13 +147,13 @@
- LINK => $LINK,
- ENV => { PATH => $ENV{PATH}, HOME => $ENV{HOME} },
- CFLAGS => $BASE_CFLAGS,
-- LIBS => ' ' . $BUILD_DIR . '/unix/splines.a '
-+ LIBS => ' '
- . $BUILD_DIR . '/unix/botlib.a '
- . $BUILD_DIR . '/unix/jpeglib.a '
- . $BUILD_DIR . '/unix/asmlib.a '
- . $BUILD_DIR . '/unix/inlinelib.a '
- . $BASE_LDFLAGS
-- . '-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm -ldl -lm'
-+ . '-L%%X11BASE%%/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lm'
- );
-
- @RENDERER_FILES = qw(
-@@ -231,7 +231,6 @@
- ../unix/linux_common.c
- ../unix/linux_qgl.c
- ../unix/linux_glimp.c
-- ../unix/linux_joystick.c
- ../unix/linux_snd.c
- ../unix/linux_signals.c
- );
diff --git a/games/cleanq3/files/patch-code-unix-Makefile b/games/cleanq3/files/patch-code-unix-Makefile
new file mode 100644
index 000000000000..49061333809e
--- /dev/null
+++ b/games/cleanq3/files/patch-code-unix-Makefile
@@ -0,0 +1,364 @@
+--- code/unix/Makefile.orig Sun Jun 4 18:06:17 2006
++++ code/unix/Makefile Sun Jun 4 18:07:46 2006
+@@ -19,6 +19,7 @@
+
+ PLATFORM=$(shell uname|tr A-Z a-z)
+ PLATFORM_RELEASE=$(shell uname -r)
++ARCH=$(shell uname -m)
+
+ ###
+ ### These paths are where you probably want to change things
+@@ -34,7 +35,7 @@
+
+ # Build name
+ # BUILD_NAME=$(BUILD_NAME)
+-BUILD_NAME=quake3.x86
++BUILD_NAME=quake3
+
+
+
+@@ -46,8 +47,8 @@
+
+ BASEQ3_DIR=$(BDIR)/baseq3
+
+-BD=debug$(ARCH)$(GLIBC)
+-BR=release$(ARCH)$(GLIBC)
++BD=debug
++BR=release
+ CDIR=$(MOUNT_DIR)/client
+ SDIR=$(MOUNT_DIR)/server
+ RDIR=$(MOUNT_DIR)/renderer
+@@ -76,7 +77,7 @@
+ #############################################################################
+
+ ## Defaults
+-DLL_ONLY=false
++DLL_ONLY?=false
+ # bk010215 - TODO - add all defaults / kill Ryan
+
+
+@@ -199,31 +200,23 @@
+
+ GLIBC= #libc is irrelevant
+
+-ifneq (,$(findstring alpha,$(shell uname -m)))
+-ARCH=axp
+-RPMARCH=alpha
+-VENDOR=dec
+-else #default to i386
+-ARCH=i386
+-RPMARCH=i386
+-VENDOR=unknown
+-endif #alpha test
++BASE_CFLAGS = $(CFLAGS) -DDATADIR='\"$(Q3DIR)\"' -DLIBDIR='\"$(LIBDIR)\"' -pipe
+
++GL_CFLAGS = -I$(X11BASE)/include
+
+-BASE_CFLAGS = -pipe
++DEBUG_CFLAGS=$(BASE_CFLAGS) -g -Wall -Werror
++RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG
+
+-GL_CFLAGS = -I$(MESADIR)/include -I/usr/X11R6/include
++ifdef OPTIMIZED_CFLAGS
++ ifeq ($(ARCH),i386)
++RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -fomit-frame-pointer -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
++ else
++RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations
++ endif
++endif
+
+-DEBUG_CFLAGS=$(BASE_CFLAGS) -g -Wall -Werror
+-ifeq ($(ARCH),axp)
+-CC=pgcc
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations
+-else
+-#NEWPGCC=/loki/global/x86/bin/gcc # raistlin012301
+-#NEWPGCC=/usr/local/gcc-2.95.2/bin/gcc
+-NEWPGCC=/home/raistllin/src/gcc/build/install/bin/gcc
+-CC=$(shell if [ -f $(NEWPGCC) ]; then echo $(NEWPGCC); else echo pgcc; fi )
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -fomit-frame-pointer -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing - fstrength-reduce
++ifeq ($(DLL_ONLY),true)
++BASE_CFLAGS += -DDLL_ONLY
+ endif
+
+ LIBEXT=a
+@@ -235,25 +228,37 @@
+ ARFLAGS=ar rv
+ RANLIB=ranlib
+
+-THREAD_LDFLAGS=-lpthread
++THREAD_LDFLAGS=$(PTHREAD_LIBS)
+ # don't need -ldl (FreeBSD)
+-LDFLAGS=-lm
++LDFLAGS+=-lm
+ #GLLDFLAGS=-L/usr/X11R6/lib -L$(MESADIR)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
+ #GLLDFLAGS=-L/usr/X11/lib -lGL -lX11 -lXext -lm
+-GLLDFLAGS=-L/usr/X11R6/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
++GLLDFLAGS=-L$(X11BASE)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
+
+-ifeq ($(ARCH),axp)
+-TARGETS=\
+- $(B)/$(PLATFORM)q3ded
+-else
+-TARGETS=\
+- $(B)/$(PLATFORM)quake3 \
+- $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
+- $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
+- $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) \
+- $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
+- $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
+- $(B)/missionpack/ui$(ARCH).$(SHLIBEXT)
++ifdef CLIENT
++TARGETS+=$(B)/cleanq3
++endif
++
++ifdef DEDICATED
++TARGETS+=$(B)/cleanq3ded
++endif
++
++ifdef SMP
++TARGETS+=$(B)/cleanq3-smp
++endif
++
++ifeq ($(DLL_ONLY),true)
++GAMELIBS=yes
++endif
++
++ifdef GAMELIBS
++TARGETS+=\
++ $(B)/baseq3/cgame.$(SHLIBEXT) \
++ $(B)/baseq3/qagame.$(SHLIBEXT) \
++ $(B)/baseq3/ui.$(SHLIBEXT) \
++ $(B)/missionpack/cgame.$(SHLIBEXT) \
++ $(B)/missionpack/qagame.$(SHLIBEXT) \
++ $(B)/missionpack/ui.$(SHLIBEXT)
+ endif
+
+ else # ifeq freebsd
+@@ -348,7 +353,7 @@
+ $(MAKE) targets B=$(BR) CFLAGS="$(RELEASE_CFLAGS)"
+
+ #Build both debug and release builds
+-all:build_debug build_release
++all:build_release
+
+ targets:makedirs $(TARGETS)
+
+@@ -516,20 +521,6 @@
+ $(B)/client/unix_net.o \
+ $(B)/client/unix_shared.o \
+ \
+- $(B)/client/ahoptim.o \
+- $(B)/client/autohint.o \
+- $(B)/client/ftbase.o \
+- $(B)/client/ftdebug.o \
+- $(B)/client/ftglyph.o \
+- $(B)/client/ftinit.o \
+- $(B)/client/ftmm.o \
+- $(B)/client/ftsystem.o \
+- $(B)/client/raster1.o \
+- $(B)/client/sfnt.o \
+- $(B)/client/sfobjs.o \
+- $(B)/client/smooth.o \
+- $(B)/client/truetype.o
+-# \
+ # $(B)/client/q_parse.o \
+ # $(B)/client/math_quaternion.o \
+ # $(B)/client/util_str.o \
+@@ -541,10 +532,12 @@
+ # $(B)/client/q_shared.o \
+
+ ifeq ($(ARCH),i386)
+- Q3OBJ += $(B)/client/vm_x86.o
++ ifeq ($(DLL_ONLY),false)
++ Q3OBJ += $(B)/client/vm_x86.o
++ endif
+ endif
+
+- ifeq ($(ARCH),ppc)
++ ifeq ($(ARCH),powerpc)
+ ifeq ($(DLL_ONLY),false)
+ Q3OBJ += $(B)/client/vm_ppc.o
+ endif
+@@ -559,10 +552,24 @@
+ $(B)/client/linux_qgl.o \
+ $(B)/client/linux_glimp.o \
+ $(B)/client/linux_snd.o \
++ $(B)/client/linux_signals.o \
++ $(B)/client/snd_mixa.o \
++ $(B)/client/matha.o
++
++ Q3POBJ_SMP=\
++ $(B)/client/linux_common.o \
++ $(B)/client/linux_qgl.o \
++ $(B)/client/linux_glimp_smp.o \
++ $(B)/client/linux_snd.o \
++ $(B)/client/linux_signals.o \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o \
+- $(B)/client/ftol.o \
+- $(B)/client/snapvector.o
++
++ ifeq ($(ARCH),i386)
++ Q3POBJ += $(B)/client/ftol.o $(B)/client/snapvector.o
++ Q3POBJ_SMP += $(B)/client/ftol.o $(B)/client/snapvector.o
++ endif
++
+ else
+ ifeq ($(PLATFORM),irix)
+ Q3POBJ=\
+@@ -602,12 +609,12 @@
+ endif #FreeBSD
+ endif #IRIX
+
+-$(B)/$(PLATFORM)quake3 : $(Q3OBJ) $(Q3POBJ)
++$(B)/cleanq3 : $(Q3OBJ) $(Q3POBJ)
+ $(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(GLLDFLAGS) $(LDFLAGS)
+ # TTimo: splines code requires C++ linking, but splines have not been officially included in the codebase
+ # $(CXX) -o $@ $(Q3OBJ) $(Q3POBJ) $(GLLDFLAGS) $(LDFLAGS)
+
+-$(B)/$(PLATFORM)quake3-smp : $(Q3OBJ) $(Q3POBJ_SMP)
++$(B)/cleanq3-smp : $(Q3OBJ) $(Q3POBJ_SMP)
+ $(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(GLLDFLAGS) \
+ $(THREAD_LDFLAGS) $(LDFLAGS)
+
+@@ -758,6 +765,7 @@
+ $(B)/client/linux_qgl.o : $(UDIR)/linux_qgl.c; $(DO_CC) $(GL_CFLAGS)
+ $(B)/client/linux_input.o : $(UDIR)/linux_input.c; $(DO_CC)
+ $(B)/client/linux_snd.o : $(UDIR)/linux_snd.c; $(DO_CC)
++$(B)/client/linux_signals.o : $(UDIR)/linux_signals.c; $(DO_CC) $(GL_CFLAGS)
+ $(B)/client/snd_mixa.o : $(UDIR)/snd_mixa.s; $(DO_AS)
+ $(B)/client/matha.o : $(UDIR)/matha.s; $(DO_AS)
+
+@@ -767,7 +775,7 @@
+ $(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC)
+ endif
+
+-ifeq ($(ARCH),ppc)
++ifeq ($(ARCH),powerpc)
+ ifeq ($(DLL_ONLY),false)
+ $(B)/client/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_CC)
+ endif
+@@ -912,22 +920,26 @@
+ $(B)/ded/unix_main.o \
+ $(B)/ded/unix_net.o \
+ $(B)/ded/unix_shared.o \
++ $(B)/ded/linux_signals.o \
+ \
+ $(B)/ded/null_client.o \
+ $(B)/ded/null_input.o \
+ $(B)/ded/null_snddma.o
+
+ ifeq ($(ARCH),i386)
+- Q3DOBJ += $(B)/ded/vm_x86.o $(B)/ded/ftol.o $(B)/ded/snapvector.o
++ Q3DOBJ += $(B)/ded/ftol.o $(B)/ded/snapvector.o
++ ifeq ($(DLL_ONLY),false)
++ Q3DOBJ += $(B)/ded/vm_x86.o
++ endif
+ endif
+
+-ifeq ($(ARCH),ppc)
++ifeq ($(ARCH),powerpc)
+ ifeq ($(DLL_ONLY),false)
+ Q3DOBJ += $(B)/ded/vm_ppc.o
+ endif
+ endif
+
+-$(B)/$(PLATFORM)q3ded : $(Q3DOBJ)
++$(B)/cleanq3ded : $(Q3DOBJ)
+ $(CC) -o $@ $(Q3DOBJ) $(LDFLAGS)
+
+ $(B)/ded/sv_bot.o : $(SDIR)/sv_bot.c; $(DO_DED_CC)
+@@ -988,6 +1000,7 @@
+ $(B)/ded/unix_main.o : $(UDIR)/unix_main.c; $(DO_DED_CC)
+ $(B)/ded/unix_net.o : $(UDIR)/unix_net.c; $(DO_DED_CC)
+ $(B)/ded/unix_shared.o : $(UDIR)/unix_shared.c; $(DO_DED_CC)
++$(B)/ded/linux_signals.o : $(UDIR)/linux_signals.c; $(DO_DED_CC)
+ $(B)/ded/null_client.o : $(NDIR)/null_client.c; $(DO_DED_CC)
+ $(B)/ded/null_input.o : $(NDIR)/null_input.c; $(DO_DED_CC)
+ $(B)/ded/null_snddma.o : $(NDIR)/null_snddma.c; $(DO_DED_CC)
+@@ -1001,7 +1014,7 @@
+ $(B)/ded/snapvector.o : $(UDIR)/snapvector.nasm; $(DO_NASM)
+ endif
+
+-ifeq ($(ARCH),ppc)
++ifeq ($(ARCH),powerpc)
+ ifeq ($(DLL_ONLY),false)
+ $(B)/ded/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_DED_CC)
+ endif
+@@ -1068,7 +1081,7 @@
+ $(B)/baseq3/cgame/q_math.o \
+ $(B)/baseq3/cgame/q_shared.o
+
+-$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) : $(Q3CGOBJ)
++$(B)/baseq3/cgame.$(SHLIBEXT) : $(Q3CGOBJ)
+ $(CC) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
+
+ $(B)/baseq3/cgame/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC)
+@@ -1128,7 +1141,7 @@
+ $(B)/missionpack/cgame/q_shared.o \
+ $(B)/missionpack/cgame/ui_shared.o
+
+-$(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) : $(MPCGOBJ)
++$(B)/missionpack/cgame.$(SHLIBEXT) : $(MPCGOBJ)
+ $(CC) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ)
+
+ $(B)/missionpack/cgame/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC) -DMISSIONPACK
+@@ -1200,7 +1213,7 @@
+ $(B)/baseq3/game/q_math.o \
+ $(B)/baseq3/game/q_shared.o
+
+-$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) : $(Q3GOBJ)
++$(B)/baseq3/qagame.$(SHLIBEXT) : $(Q3GOBJ)
+ $(CC) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
+
+ $(B)/baseq3/game/ai_chat.o : $(GDIR)/ai_chat.c; $(DO_SHLIB_CC)
+@@ -1278,7 +1291,7 @@
+ $(B)/missionpack/game/q_math.o \
+ $(B)/missionpack/game/q_shared.o
+
+-$(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) : $(MPGOBJ)
++$(B)/missionpack/qagame.$(SHLIBEXT) : $(MPGOBJ)
+ $(CC) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ)
+
+ $(B)/missionpack/game/ai_chat.o : $(GDIR)/ai_chat.c; $(DO_SHLIB_CC) -DMISSIONPACK
+@@ -1367,7 +1380,7 @@
+ $(B)/baseq3/ui/q_math.o \
+ $(B)/baseq3/ui/q_shared.o
+
+-$(B)/baseq3/ui$(ARCH).$(SHLIBEXT) : $(Q3UIOBJ)
++$(B)/baseq3/ui.$(SHLIBEXT) : $(Q3UIOBJ)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
+
+ $(B)/baseq3/ui/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC)
+@@ -1410,7 +1423,7 @@
+ $(B)/baseq3/ui/ui_startserver.o : $(Q3UIDIR)/ui_startserver.c; $(DO_SHLIB_CC)
+ $(B)/baseq3/ui/ui_team.o : $(Q3UIDIR)/ui_team.c; $(DO_SHLIB_CC)
+ $(B)/baseq3/ui/ui_teamorders.o : $(Q3UIDIR)/ui_teamorders.c; $(DO_SHLIB_CC)
+-$(B)/baseq3/ui/ui_syscalls.o : $(Q3UIDIR)/ui_syscalls.c; $(DO_SHLIB_CC)
++$(B)/baseq3/ui/ui_syscalls.o : $(UIDIR)/ui_syscalls.c; $(DO_SHLIB_CC)
+ $(B)/baseq3/ui/ui_video.o : $(Q3UIDIR)/ui_video.c; $(DO_SHLIB_CC)
+
+ # bk001205 - these wre the only SHLIB compiles in 1.17
+@@ -1450,7 +1463,7 @@
+ # $(B)/missionpack/ui/q_math.o \
+ # $(B)/missionpack/ui/q_shared.o
+
+-$(B)/missionpack/ui$(ARCH).$(SHLIBEXT) : $(MPUIOBJ)
++$(B)/missionpack/ui.$(SHLIBEXT) : $(MPUIOBJ)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ)
+
+ $(B)/missionpack/ui/ui_atoms.o : $(UIDIR)/ui_atoms.c; $(DO_SHLIB_CC) -DMISSIONPACK
+@@ -2059,9 +2072,9 @@
+
+ copyfiles:
+ -mkdirhier $(COPYDIR)
+- cp $(BR)/linuxquake3 $(COPYDIR)/quake3.x86
+- strip $(COPYDIR)/quake3.x86
+- chmod 755 $(COPYDIR)/quake3.x86
++ cp $(BR)/linuxquake3 $(COPYDIR)/quake3
++ strip $(COPYDIR)/quake3
++ chmod 755 $(COPYDIR)/quake3
+ cp $(BR)/linuxq3ded $(COPYDIR)/q3ded
+ strip $(COPYDIR)/q3ded
+ chmod 755 $(COPYDIR)/q3ded
diff --git a/games/cleanq3/files/patch-code-unix-cons b/games/cleanq3/files/patch-code-unix-cons
deleted file mode 100644
index b2e41f55f747..000000000000
--- a/games/cleanq3/files/patch-code-unix-cons
+++ /dev/null
@@ -1,27 +0,0 @@
---- code/unix/cons.orig Fri Jun 14 13:01:32 2002
-+++ code/unix/cons Wed Nov 23 10:32:49 2005
-@@ -271,11 +271,11 @@
- # Defaults for a typical (?) UNIX platform.
- # Your mileage may vary.
- 'unix' => [
-- 'CC' => 'cc',
-- 'CFLAGS' => '',
-+ 'CC' => $ENV{CC},
-+ 'CFLAGS' => $ENV{CFLAGS},
- 'CCCOM' => '%CC %CFLAGS %_IFLAGS -c %< -o %>',
-- 'CXX' => '%CC',
-- 'CXXFLAGS' => '%CFLAGS',
-+ 'CXX' => $ENV{CXX},
-+ 'CXXFLAGS' => $ENV{CXXFLAGS},
- 'CXXCOM' => '%CXX %CXXFLAGS %_IFLAGS -c %< -o %>',
- 'INCDIRPREFIX' => '-I',
- 'INCDIRSUFFIX' => '',
-@@ -294,7 +294,7 @@
- 'LD' => 'ld',
- 'LDFLAGS' => '',
- 'PREFLIB' => 'lib',
-- 'ENV' => { 'PATH' => '/bin:/usr/bin' },
-+ 'ENV' => { 'PATH' => '/bin:/usr/bin:/usr/local/bin' },
- ],
- );
-
diff --git a/games/cleanq3/files/patch-code-unix-unix_main.c b/games/cleanq3/files/patch-code-unix-unix_main.c
index 61d3841662cc..049808e77841 100644
--- a/games/cleanq3/files/patch-code-unix-unix_main.c
+++ b/games/cleanq3/files/patch-code-unix-unix_main.c
@@ -1,5 +1,5 @@
---- code/unix/unix_main.c.orig Mon Mar 20 18:39:10 2006
-+++ code/unix/unix_main.c Mon Mar 20 20:24:22 2006
+--- ./code/unix/unix_main.c.orig Wed May 31 20:52:08 2006
++++ ./code/unix/unix_main.c Wed May 31 20:52:09 2006
@@ -722,17 +722,7 @@
assert( name );
@@ -25,7 +25,7 @@
{
+ Com_Printf( "Sys_LoadDll(%s) failed:\n\"%s\"\n", fn, dlerror() );
+ // FreeBSD package installation path
-+ fn = FS_BuildOSPath( "%%PREFIX%%/lib/cleanq3", gamedir, fname );
++ fn = FS_BuildOSPath( LIBDIR , gamedir, fname );
+ Com_Printf( "Sys_LoadDll(%s)... \n", fn );
+ libHandle = dlopen( fn, Q_RTLD );
+
diff --git a/games/cleanq3/files/patch-code-unix-unix_shared.c b/games/cleanq3/files/patch-code-unix-unix_shared.c
index 013c39f2bc13..57127892e8bd 100644
--- a/games/cleanq3/files/patch-code-unix-unix_shared.c
+++ b/games/cleanq3/files/patch-code-unix-unix_shared.c
@@ -1,11 +1,11 @@
---- code/unix/unix_shared.c.orig Mon Aug 15 20:10:07 2005
-+++ code/unix/unix_shared.c Sun Nov 20 18:41:22 2005
+--- ./code/unix/unix_shared.c.orig Wed May 31 20:52:08 2006
++++ ./code/unix/unix_shared.c Wed May 31 20:52:09 2006
@@ -38,7 +38,7 @@
static char cdPath[MAX_OSPATH];
// Used to determine local installation path
-static char installPath[MAX_OSPATH];
-+static char installPath[MAX_OSPATH] = %%Q3DIR%%;
++static char installPath[MAX_OSPATH] = DATADIR;
// Used to determine where to store user-specific files
static char homePath[MAX_OSPATH];
@@ -34,7 +34,7 @@
// test the wrap issue
#if 0
-@@ -136,7 +140,7 @@
+@@ -136,10 +140,10 @@
return ret;
}
@@ -42,4 +42,8 @@
+// #endif
//#if 0 // bk001215 - see snapvector.nasm for replacement
- #if (defined __APPLE__) // rcg010206 - using this for PPC builds...
+-#if (defined __APPLE__) // rcg010206 - using this for PPC builds...
++#ifndef __i386__ // rcg010206 - using this for PPC builds...
+ long fastftol( float f ) { // bk001213 - from win32/win_shared.c
+ //static int tmp;
+ // __asm fld f
diff --git a/games/cleanq3/pkg-plist b/games/cleanq3/pkg-plist
new file mode 100644
index 000000000000..2b6a67fe9ef1
--- /dev/null
+++ b/games/cleanq3/pkg-plist
@@ -0,0 +1,13 @@
+%%DEDICATED%%bin/cleanq3ded
+%%CLIENT%%bin/cleanq3
+%%SMP%%bin/cleanq3-smp
+%%GAMELIBS%%%%LIBDIR%%/baseq3/cgame.so
+%%GAMELIBS%%%%LIBDIR%%/baseq3/qagame.so
+%%GAMELIBS%%%%LIBDIR%%/baseq3/ui.so
+%%GAMELIBS%%%%LIBDIR%%/missionpack/cgame.so
+%%GAMELIBS%%%%LIBDIR%%/missionpack/qagame.so
+%%GAMELIBS%%%%LIBDIR%%/missionpack/ui.so
+%%GAMELIBS%%@dirrm %%LIBDIR%%/missionpack
+%%GAMELIBS%%@dirrm %%LIBDIR%%/baseq3
+%%GAMELIBS%%@dirrm %%LIBDIR%%
+