[Midnightbsd-cvs] mports: mports/games:
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu May 1 03:04:32 EDT 2008
Log Message:
-----------
Modified Files:
--------------
mports/games:
Makefile (r1.21 -> r1.22)
Added Files:
-----------
mports/games/quake3:
Makefile (r1.1)
distinfo (r1.1)
pkg-descr (r1.1)
pkg-plist (r1.1)
mports/games/quake3/files:
patch-code-cgame-cg_weapons.c (r1.1)
patch-code-client-cl_ui.c (r1.1)
patch-code-game-q_shared.c (r1.1)
patch-code-game-q_shared.h (r1.1)
patch-code-q3_ui-ui_playermodel.c (r1.1)
patch-code-q3_ui-ui_players.c (r1.1)
patch-code-q3_ui-ui_saveconfig.c (r1.1)
patch-code-qcommon-common.c (r1.1)
patch-code-qcommon-files.c (r1.1)
patch-code-qcommon-vm.c (r1.1)
patch-code-renderer-tr_bsp.c (r1.1)
patch-code-renderer-tr_shader.c (r1.1)
patch-code-server-sv_client.c (r1.1)
patch-code-ui-ui_main.c (r1.1)
patch-code-ui-ui_players.c (r1.1)
patch-code-unix-Makefile (r1.1)
patch-code-unix-unix_main.c (r1.1)
patch-code-unix-unix_shared.c (r1.1)
mports/games/quake3-data:
Makefile (r1.1)
Makefile.include (r1.1)
distinfo (r1.1)
pkg-descr (r1.1)
pkg-plist (r1.1)
mports/games/quake3-data/files:
pkg-message.in (r1.1)
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/games/Makefile,v
retrieving revision 1.21
retrieving revision 1.22
diff -L games/Makefile -L games/Makefile -u -r1.21 -r1.22
--- games/Makefile
+++ games/Makefile
@@ -27,6 +27,8 @@
SUBDIR += linux-enemyterritory-tce
SUBDIR += nextgo
SUBDIR += qstat
+ SUBDIR += quake3
+ SUBDIR += quake3-data
SUBDIR += scummvm
SUBDIR += tuxracer
SUBDIR += vitetris
--- /dev/null
+++ games/quake3/pkg-descr
@@ -0,0 +1,15 @@
+Quake III Arena, developed by the gaming wizards at id Software,
+is the third installment of one of the most popular computer game
+franchises of all time. Organic caverns, gothic cathedrals and
+futuristic spacescapes play host to Quake III Arena's unrivaled
+blend of action, strategy and jaw-dropping technology as Linux
+gamers are invited to square off against 32 of history's greatest
+warriors. Built around a revolutionary new graphics engine capable
+of delivering mind blowing 3D special effects including curved
+surfaces and volumetric fog, Quake III Arena is the final word in
+deathmatching mayhem.
+
+This is a native build for BSD. Sorry, no joystick support
+is available at this time.
+
+WWW: http://www.idsoftware.com/games/quake/quake3-arena/
--- /dev/null
+++ games/quake3/pkg-plist
@@ -0,0 +1,12 @@
+%%DEDICATED%%bin/q3ded
+%%CLIENT%%bin/quake3
+%%SMP%%bin/quake3-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%%
--- /dev/null
+++ games/quake3/Makefile
@@ -0,0 +1,127 @@
+# New ports collection makefile for: quake3
+# Date created: 23 August 2005
+# Whom: pypt
+#
+# $MidnightBSD: mports/games/quake3/Makefile,v 1.1 2008/05/01 07:04:28 laffer1 Exp $
+# $FreeBSD: ports/games/quake3/Makefile,v 1.18 2007/11/07 00:37:19 pav Exp $
+#
+
+PORTNAME= quake3
+PORTVERSION= 1.32c
+CATEGORIES= games
+MASTER_SITES= http://www.proarena.com/p/ftpx/x8524/quake_3_arena/ \
+ http://www.planetgargoyle.com/ \
+ http://www.teamdarkside.net/ \
+ http://0day.icculus.org/mirrors/quake3/ \
+ http://www.olpainless.net/files/ \
+ ${MASTER_SITE_IDSOFTWARE:S|$|source/|}
+DISTNAME= ${PORTNAME}-${REALVERSION}-source
+
+MAINTAINER= ports at MidnightBSD.org
+COMMENT= Quake III Arena -- first person shooter (native build)
+LICENSE= gpl2
+
+ONLY_FOR_ARCHS= i386
+ONLY_FOR_ARCHS_REASON= does not run properly; try games/ioquake3
+USE_ZIP= yes
+USE_DOS2UNIX= yes
+USE_GMAKE= yes
+WRKSRC= ${WRKDIR}/${PORTNAME}-${REALVERSION}
+BUILD_WRKSRC= ${WRKSRC}/code/unix
+
+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
+
+MAKE_ENV= LIBDIR="${LIBDIR}"
+PLIST_SUB= LIBDIR="${LIBDIR:S/${PREFIX}\///}"
+
+LIBDIR= ${PREFIX}/lib/${PORTNAME}
+REALVERSION= 1.32b
+VM_ARCHS= i386 powerpc
+
+.include <bsd.port.pre.mk>
+
+.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
+
+.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(WITHOUT_CLIENT) || !defined(WITHOUT_SMP)
+USE_GL= yes
+USE_XORG= xxf86dga
+.endif
+
+.if !defined(WITHOUT_CLIENT)
+MAKE_ENV+= CLIENT=YES
+PLIST_SUB+= CLIENT=""
+Q3BIN+= quake3
+.else
+PLIST_SUB+= CLIENT="@comment "
+.endif
+
+.if !defined(WITHOUT_DEDICATED)
+MAKE_ENV+= DEDICATED=YES
+PLIST_SUB+= DEDICATED=""
+Q3BIN+= q3ded
+.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+= quake3-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:
+.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>
--- /dev/null
+++ games/quake3/distinfo
@@ -0,0 +1,3 @@
+MD5 (quake3-1.32b-source.zip) = af8aaac46cc82035e1cba632b1a16e03
+SHA256 (quake3-1.32b-source.zip) = 74d42070eea4c7ce47955d831327e70f480c493172b485bf7dd1a58838e92fab
+SIZE (quake3-1.32b-source.zip) = 5724791
--- /dev/null
+++ games/quake3/files/patch-code-unix-unix_main.c
@@ -0,0 +1,58 @@
+--- ./code/unix/unix_main.c.orig Wed May 31 18:55:12 2006
++++ ./code/unix/unix_main.c Wed May 31 18:55:13 2006
+@@ -707,12 +707,12 @@
+ {
+ void *libHandle;
+ void (*dllEntry)( int (*syscallptr)(int, ...) );
+- char curpath[MAX_OSPATH];
+ char fname[MAX_OSPATH];
+ char *basepath;
+ char *homepath;
+ char *pwdpath;
+ char *gamedir;
++ char *libdir = LIBDIR;
+ char *fn;
+ const char* err = NULL;
+
+@@ -721,18 +721,7 @@
+ // bk001206 - let's have some paranoia
+ assert( name );
+
+- getcwd(curpath, sizeof(curpath));
+-#if defined __i386__
+- snprintf (fname, sizeof(fname), "%si386.so", name);
+-#elif defined __powerpc__ //rcg010207 - PPC support.
+- snprintf (fname, sizeof(fname), "%sppc.so", name);
+-#elif defined __axp__
+- snprintf (fname, sizeof(fname), "%saxp.so", name);
+-#elif defined __mips__
+- snprintf (fname, sizeof(fname), "%smips.so", name);
+-#else
+-#error Unknown arch
+-#endif
++ snprintf (fname, sizeof(fname), "%s.so", name);
+
+ // bk001129 - was RTLD_LAZY
+ #define Q_RTLD RTLD_NOW
+@@ -742,10 +731,19 @@
+ homepath = Cvar_VariableString( "fs_homepath" );
+ gamedir = Cvar_VariableString( "fs_game" );
+
+- // pwdpath
+- fn = FS_BuildOSPath( pwdpath, gamedir, fname );
++ // libdir
++ fn = FS_BuildOSPath( libdir, gamedir, fname );
+ Com_Printf( "Sys_LoadDll(%s)... \n", fn );
+ libHandle = dlopen( fn, Q_RTLD );
++
++ // pwdpath
++ if ( !libHandle )
++ {
++ Com_Printf( "Sys_LoadDll(%s) failed:\n\"%s\"\n", fn, dlerror() );
++ fn = FS_BuildOSPath( pwdpath, gamedir, fname );
++ Com_Printf( "Sys_LoadDll(%s)... \n", fn );
++ libHandle = dlopen( fn, Q_RTLD );
++ }
+
+ if ( !libHandle )
+ {
--- /dev/null
+++ games/quake3/files/patch-code-game-q_shared.c
@@ -0,0 +1,126 @@
+--- ./code/game/q_shared.c.orig Wed May 31 18:55:11 2006
++++ ./code/game/q_shared.c Wed May 31 19:06:32 2006
+@@ -58,13 +58,20 @@
+ COM_StripExtension
+ ============
+ */
+-void COM_StripExtension( const char *in, char *out ) {
+- while ( *in && *in != '.' ) {
+- *out++ = *in++;
+- }
+- *out = 0;
+-}
++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
++ }
++ if (length)
++ out[length] = 0;
++}
+
+ /*
+ ==================
+@@ -99,29 +106,29 @@
+
+ ============================================================================
+ */
+-/*
++
+ // 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);}
+-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);}
+-*/
++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 (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;
+
+@@ -131,12 +138,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;
+
+@@ -145,15 +152,15 @@
+ b3 = (l>>16)&255;
+ b4 = (l>>24)&255;
+
+- return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
++ return ((int32_t)b1<<24) + ((int32_t)b2<<16) + ((int32_t)b3<<8) + b4;
+ }
+
+-int LongNoSwap (int l)
++int32_t LongNoSwap (int32_t l)
+ {
+ return l;
+ }
+
+-qint64 Long64Swap (qint64 ll)
++qint64 Long64Swap (qint64 ll)
+ {
+ qint64 result;
+
+@@ -199,7 +206,7 @@
+ Swap_Init
+ ================
+ */
+-/*
++
+ void Swap_Init (void)
+ {
+ byte swaptest[2] = {1,0};
+@@ -229,7 +236,7 @@
+ }
+
+ }
+-*/
++
+
+ /*
+ ============================================================================
--- /dev/null
+++ games/quake3/files/patch-code-client-cl_ui.c
@@ -0,0 +1,11 @@
+--- ./code/client/cl_ui.c.orig Wed May 31 18:55:11 2006
++++ ./code/client/cl_ui.c Wed May 31 18:55:13 2006
+@@ -1166,7 +1166,7 @@
+ // init for this gamestate
+ VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE));
+ }
+- else if (v != UI_API_VERSION) {
++ else if (v != 0 && v != UI_API_VERSION) {
+ Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION );
+ cls.uiStarted = qfalse;
+ }
--- /dev/null
+++ games/quake3/files/patch-code-unix-Makefile
@@ -0,0 +1,482 @@
+--- code/unix/Makefile.orig Wed Apr 30 23:44:13 2008
++++ code/unix/Makefile Wed Apr 30 23:50:16 2008
+@@ -17,8 +17,8 @@
+ # GNU Make required
+ #
+
+-PLATFORM=$(shell uname|tr A-Z a-z)
+-PLATFORM_RELEASE=$(shell uname -r)
++PLATFORM=freebsd
++PLATFORM_RELEASE=6.0-RELEASE
+
+ ###
+ ### These paths are where you probably want to change things
+@@ -34,7 +34,7 @@
+
+ # Build name
+ # BUILD_NAME=$(BUILD_NAME)
+-BUILD_NAME=quake3.x86
++BUILD_NAME=quake3
+
+
+
+@@ -46,8 +46,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 +76,7 @@
+ #############################################################################
+
+ ## Defaults
+-DLL_ONLY=false
++DLL_ONLY?=false
+ # bk010215 - TODO - add all defaults / kill Ryan
+
+
+@@ -136,7 +136,7 @@
+ ifeq ($(ARCH),ppc)
+ NEWPGCC=/loki/global/ppc/bin/gcc
+ CC=$(NEWPGCC)
+- RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce
++ RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
+ else
+ #NEWPGCC=/usr/local/gcc-2.95.2/bin/gcc # bk001205
+ #NEWPGCC=/loki/global/x86/bin/gcc
+@@ -146,9 +146,9 @@
+ # TTimo: legacy RELEASE_CFLAGS
+ # NOTE: the -fomit-frame-pointer option leads to an unstable binary on my test box if it was built on the main box
+ # but building on the Mdk 7.2 baseline seems to work
+- 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
++ RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
+ # TTimo: use this for building on P3 gcc 2.95.3 libc2.2 for all targets (experimental! -fomit-fram-pointer removed)
+-# RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce
++# RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
+ endif
+ endif
+
+@@ -162,7 +162,7 @@
+ RANLIB=ranlib
+
+ THREAD_LDFLAGS=-lpthread
+- LDFLAGS=-ldl -lm
++ LDFLAGS=-lm
+ GLLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm
+
+ ifeq ($(ARCH),axp)
+@@ -197,33 +197,29 @@
+
+ ifeq ($(PLATFORM),freebsd)
+
++ifeq ($(ARCH),powerpc)
++ARCH=ppc
++endif
++
+ 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$(LOCALBASE)/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+=-O6 -fomit-frame-pointer -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
++ else
++RELEASE_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 +231,33 @@
+ 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$(LOCALBASE)/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)/quake3
++endif
++
++ifdef DEDICATED
++TARGETS+=$(B)/q3ded
++endif
++
++ifdef SMP
++TARGETS+=$(B)/quake3-smp
++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
+@@ -283,7 +287,7 @@
+ ARFLAGS=ar rv
+ RANLIB=ranlib
+
+-LDFLAGS=-ldl -lm
++LDFLAGS=-lm
+ GLLDFLAGS=-L/usr/X11/lib -lGL -lX11 -lXext -lm
+
+ TARGETS=$(B)/sgiquake3 \
+@@ -310,9 +314,9 @@
+ RANLIB=ranlib
+
+ ifeq ($(PLATFORM),freebsd)
+-LDFLAGS=-lm
++LDFLAGS+=-lm
+ else
+-LDFLAGS=-ldl -lm
++LDFLAGS=-lm
+ endif # ifeq freebsd
+
+ TARGETS=\
+@@ -348,7 +352,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 +520,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 +531,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 +551,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
++ $(B)/client/matha.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=\
+@@ -578,7 +584,6 @@
+ $(B)/client/linux_common.o \
+ $(B)/client/linux_qgl.o \
+ $(B)/client/linux_glimp.o \
+- $(B)/client/linux_joystick.o \
+ $(B)/client/linux_snd.o \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o \
+@@ -587,7 +592,6 @@
+ $(B)/client/linux_common.o \
+ $(B)/client/linux_qgl.o \
+ $(B)/client/linux_glimp_smp.o \
+- $(B)/client/linux_joystick.o \
+ $(B)/client/linux_snd.o \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o
+@@ -602,12 +606,12 @@
+ endif #FreeBSD
+ endif #IRIX
+
+-$(B)/$(PLATFORM)quake3 : $(Q3OBJ) $(Q3POBJ)
++$(B)/quake3 : $(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)/quake3-smp : $(Q3OBJ) $(Q3POBJ_SMP)
+ $(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(GLLDFLAGS) \
+ $(THREAD_LDFLAGS) $(LDFLAGS)
+
+@@ -754,10 +758,10 @@
+ $(B)/client/linux_common.o : $(UDIR)/linux_common.c; $(DO_CC)
+ $(B)/client/linux_glimp.o : $(UDIR)/linux_glimp.c; $(DO_CC) $(GL_CFLAGS)
+ $(B)/client/linux_glimp_smp.o : $(UDIR)/linux_glimp.c; $(DO_SMP_CC) $(GL_CFLAGS)
+-$(B)/client/linux_joystick.o : $(UDIR)/linux_joystick.c; $(DO_CC)
+ $(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 +771,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 +916,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)/q3ded : $(Q3DOBJ)
+ $(CC) -o $@ $(Q3DOBJ) $(LDFLAGS)
+
+ $(B)/ded/sv_bot.o : $(SDIR)/sv_bot.c; $(DO_DED_CC)
+@@ -988,6 +996,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 +1010,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 +1077,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 +1137,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 +1209,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 +1287,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 +1376,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 +1419,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 +1459,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
+@@ -1613,23 +1622,8 @@
+ $(B)/q3static/unix_net.o \
+ $(B)/q3static/unix_shared.o \
+ \
+- $(B)/q3static/ahoptim.o \
+- $(B)/q3static/autohint.o \
+- $(B)/q3static/ftbase.o \
+- $(B)/q3static/ftdebug.o \
+- $(B)/q3static/ftglyph.o \
+- $(B)/q3static/ftinit.o \
+- $(B)/q3static/ftmm.o \
+- $(B)/q3static/ftsystem.o \
+- $(B)/q3static/raster1.o \
+- $(B)/q3static/sfnt.o \
+- $(B)/q3static/sfobjs.o \
+- $(B)/q3static/smooth.o \
+- $(B)/q3static/truetype.o \
+- \
+ $(B)/q3static/linux_qgl.o \
+ $(B)/q3static/linux_glimp.o \
+- $(B)/q3static/linux_joystick.o \
+ $(B)/q3static/linux_snd.o \
+ $(B)/q3static/snd_mixa.o \
+ $(B)/q3static/matha.o
+@@ -1779,7 +1773,6 @@
+ $(B)/q3static/unix_net.o : $(UDIR)/unix_net.c; $(DO_CC) -DQ3_STATIC
+ $(B)/q3static/unix_shared.o : $(UDIR)/unix_shared.c; $(DO_CC) -DQ3_STATIC
+ $(B)/q3static/linux_glimp.o : $(UDIR)/linux_glimp.c; $(DO_CC) -DQ3_STATIC
+-$(B)/q3static/linux_joystick.o : $(UDIR)/linux_joystick.c; $(DO_CC) -DQ3_STATIC
+ $(B)/q3static/linux_qgl.o : $(UDIR)/linux_qgl.c; $(DO_CC) -DQ3_STATIC
+ $(B)/q3static/linux_input.o : $(UDIR)/linux_input.c; $(DO_CC) -DQ3_STATIC
+ $(B)/q3static/linux_snd.o : $(UDIR)/linux_snd.c; $(DO_CC) -DQ3_STATIC
+@@ -2020,7 +2013,7 @@
+
+
+
+-$(B)/$(PLATFORM)q3static : $(Q3SOBJ)
++$(B)/q3static : $(Q3SOBJ)
+ $(CC) $(CFLAGS) -o $@ $(Q3SOBJ) $(GLLDFLAGS) $(LDFLAGS)
+
+
+@@ -2059,9 +2052,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
--- /dev/null
+++ games/quake3/files/patch-code-qcommon-common.c
@@ -0,0 +1,28 @@
+--- ./code/qcommon/common.c.orig Wed May 31 18:55:11 2006
++++ ./code/qcommon/common.c Wed May 31 18:55:13 2006
+@@ -24,15 +24,8 @@
+ #include "../game/q_shared.h"
+ #include "qcommon.h"
+ #include <setjmp.h>
+-#ifdef __linux__
+-#include <netinet/in.h>
+-#else
+-#if defined(MACOS_X)
++#include <sys/types.h>
+ #include <netinet/in.h>
+-#else
+-#include <winsock.h>
+-#endif
+-#endif
+
+ 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();
--- /dev/null
+++ games/quake3/files/patch-code-ui-ui_main.c
@@ -0,0 +1,11 @@
+--- ./code/ui/ui_main.c.orig Wed May 31 18:55:11 2006
++++ ./code/ui/ui_main.c Wed May 31 19:10:12 2006
+@@ -4988,7 +4988,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))
--- /dev/null
+++ games/quake3/files/patch-code-q3_ui-ui_saveconfig.c
@@ -0,0 +1,11 @@
+--- ./code/q3_ui/ui_saveconfig.c.orig Wed May 31 18:55:11 2006
++++ ./code/q3_ui/ui_saveconfig.c Wed May 31 19:08:05 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();
+ }
--- /dev/null
+++ games/quake3/files/patch-code-game-q_shared.h
@@ -0,0 +1,142 @@
+--- ./code/game/q_shared.h.orig Wed May 31 18:55:11 2006
++++ ./code/game/q_shared.h Wed May 31 19:06:40 2006
+@@ -150,12 +150,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 '\\'
+
+@@ -206,12 +208,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
+
+@@ -229,12 +233,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
+
+@@ -268,6 +274,7 @@
+ #define BOTLIB_HARD_LINKED
+ #endif
+
++#if 0
+ #if !idppc
+ inline static short BigShort( short l) { return ShortSwap(l); }
+ #define LittleShort
+@@ -283,6 +290,7 @@
+ #define BigFloat
+ inline static float LittleFloat (const float *l) { return FloatSwap(l); }
+ #endif
++#endif
+
+ #endif
+
+@@ -302,10 +310,18 @@
+ #define CPUSTRING "freebsd-other"
+ #endif
+
++#include <machine/param.h>
++#if __FreeBSD_version < 500000
++#include <inttypes.h>
++#else
++#include <stdint.h>
++#endif
++
+ #define PATH_SEP '/'
+
+ // bk010116 - omitted Q3STATIC (see Linux above), broken target
+
++#if 0
+ #if !idppc
+ static short BigShort( short l) { return ShortSwap(l); }
+ #define LittleShort
+@@ -321,6 +337,7 @@
+ #define BigFloat
+ static float LittleFloat (const float *l) { return FloatSwap(l); }
+ #endif
++#endif
+
+ #endif
+
+@@ -452,13 +469,9 @@
+ void *Hunk_Alloc( int size, ha_pref preference );
+ #endif
+
+-#ifdef __linux__
+ // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
+ // custom Snd_Memset implementation for glibc memset bug workaround
+ void Snd_Memset (void* dest, const int val, const size_t count);
+-#else
+-#define Snd_Memset Com_Memset
+-#endif
+
+ #if !( defined __VECTORC )
+ void Com_Memset (void* dest, const int val, const size_t count);
+@@ -787,7 +800,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 );
+@@ -888,18 +901,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, ...);
+
+ //=============================================
--- /dev/null
+++ games/quake3/files/patch-code-server-sv_client.c
@@ -0,0 +1,80 @@
+--- code/server/sv_client.c.orig Wed May 31 23:38:47 2006
++++ code/server/sv_client.c Wed May 31 23:40:24 2006
+@@ -756,28 +756,58 @@
+ 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"
+- "The Team Arena mission pack can be found in your local game store.", cl->downloadName);
++ "The Team Arena mission pack can be found in your local game store.", cl->downloadName);
+ }
+ else {
+ Com_sprintf(errorMessage, sizeof(errorMessage), "Cannot autodownload id pk3 file \"%s\"", cl->downloadName);
+@@ -808,7 +838,9 @@
+ *cl->downloadName = 0;
+ return;
+ }
+-
++
++ Com_Printf( "clientDownload: %d : beginning \"%s\"\n", cl - svs.clients, cl->downloadName );
++
+ // Init
+ cl->downloadCurrentBlock = cl->downloadClientBlock = cl->downloadXmitBlock = 0;
+ cl->downloadCount = 0;
--- /dev/null
+++ games/quake3/files/patch-code-unix-unix_shared.c
@@ -0,0 +1,49 @@
+--- ./code/unix/unix_shared.c.orig Wed May 31 18:55:12 2006
++++ ./code/unix/unix_shared.c Wed May 31 18:55:13 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] = DATADIR;
+
+ // Used to determine where to store user-specific files
+ static char homePath[MAX_OSPATH];
+@@ -76,7 +76,7 @@
+ return curtime;
+ }
+
+-#if defined(__linux__) && !defined(DEDICATED)
++// #if defined(__linux__) && !defined(DEDICATED)
+ /*
+ ================
+ Sys_XTimeToSysTime
+@@ -98,11 +98,15 @@
+ {
+ int ret, time, test;
+
++ /*
++ Let's try to comment out this and see what will happen :-)
++
+ if (!in_subframe->value)
+ {
+ // if you don't want to do any event times corrections
+ return Sys_Milliseconds();
+ }
++ */
+
+ // test the wrap issue
+ #if 0
+@@ -136,10 +140,10 @@
+
+ return ret;
+ }
+-#endif
++// #endif
+
+ //#if 0 // bk001215 - see snapvector.nasm for replacement
+-#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
--- /dev/null
+++ games/quake3/files/patch-code-q3_ui-ui_players.c
@@ -0,0 +1,18 @@
+--- ./code/q3_ui/ui_players.c.orig Wed May 31 18:55:11 2006
++++ ./code/q3_ui/ui_players.c Wed May 31 19:07:49 2006
+@@ -89,13 +89,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 );
+
--- /dev/null
+++ games/quake3/files/patch-code-renderer-tr_bsp.c
@@ -0,0 +1,11 @@
+--- ./code/renderer/tr_bsp.c.orig Wed May 31 18:55:11 2006
++++ ./code/renderer/tr_bsp.c Wed May 31 19:09:13 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;
--- /dev/null
+++ games/quake3/files/patch-code-ui-ui_players.c
@@ -0,0 +1,18 @@
+--- ./code/ui/ui_players.c.orig Wed May 31 18:55:11 2006
++++ ./code/ui/ui_players.c Wed May 31 19:10:27 2006
+@@ -90,13 +90,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 );
+
--- /dev/null
+++ games/quake3/files/patch-code-cgame-cg_weapons.c
@@ -0,0 +1,23 @@
+--- ./code/cgame/cg_weapons.c.orig Wed May 31 18:55:11 2006
++++ ./code/cgame/cg_weapons.c Wed May 31 19:05:20 2006
+@@ -656,17 +656,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 );
+
--- /dev/null
+++ games/quake3/files/patch-code-q3_ui-ui_playermodel.c
@@ -0,0 +1,11 @@
+--- ./code/q3_ui/ui_playermodel.c.orig Wed May 31 18:55:11 2006
++++ ./code/q3_ui/ui_playermodel.c Wed May 31 19:07:38 2006
+@@ -424,7 +424,7 @@
+ {
+ filelen = strlen(fileptr);
+
+- COM_StripExtension(fileptr,skinname);
++ COM_StripExtension(fileptr, skinname, sizeof(skinname));
+
+ // look for icon_????
+ if (!Q_stricmpn(skinname,"icon_",5))
--- /dev/null
+++ games/quake3/files/patch-code-renderer-tr_shader.c
@@ -0,0 +1,29 @@
+--- ./code/renderer/tr_shader.c.orig Wed May 31 18:55:11 2006
++++ ./code/renderer/tr_shader.c Wed May 31 19:09:58 2006
+@@ -92,7 +92,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) {
+@@ -2351,7 +2351,7 @@
+ return tr.defaultShader;
+ }
+
+- COM_StripExtension( name, strippedName );
++ COM_StripExtension( name, strippedName, sizeof(strippedName) );
+
+ hash = generateHashValue(strippedName, FILE_HASH_SIZE);
+
+@@ -2419,7 +2419,7 @@
+ lightmapIndex = LIGHTMAP_BY_VERTEX;
+ }
+
+- COM_StripExtension( name, strippedName );
++ COM_StripExtension( name, strippedName, sizeof(strippedName) );
+
+ hash = generateHashValue(strippedName, FILE_HASH_SIZE);
+
--- /dev/null
+++ games/quake3/files/patch-code-qcommon-vm.c
@@ -0,0 +1,20 @@
+--- ./code/qcommon/vm.c.orig Wed May 31 18:55:11 2006
++++ ./code/qcommon/vm.c Wed May 31 19:08:19 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 ) {
+@@ -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);
+ }
--- /dev/null
+++ games/quake3/files/patch-code-qcommon-files.c
@@ -0,0 +1,35 @@
+--- code/qcommon/files.c.orig Fri Jan 26 19:58:26 2007
++++ code/qcommon/files.c Fri Jan 26 20:07:18 2007
+@@ -2503,7 +2503,7 @@
+ sorted[i] = pakfiles[i];
+ }
+
+- qsort( sorted, numfiles, 4, paksort );
++ qsort( sorted, numfiles, sizeof(sorted[0]), paksort );
+
+ for ( i = 0 ; i < numfiles ; i++ ) {
+ pakfile = FS_BuildOSPath( path, dir, sorted[i] );
+@@ -2763,6 +2763,7 @@
+ if (fs_basepath->string[0]) {
+ FS_AddGameDirectory( fs_basepath->string, gameName );
+ }
++ FS_AddGameDirectory( LIBDIR, gameName );
+ // fs_homepath is somewhat particular to *nix systems, only add if relevant
+ // NOTE: same filtering below for mods and basegame
+ if (fs_basepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
+@@ -2777,6 +2778,7 @@
+ if (fs_basepath->string[0]) {
+ FS_AddGameDirectory(fs_basepath->string, fs_basegame->string);
+ }
++ FS_AddGameDirectory(LIBDIR, fs_basegame->string);
+ if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
+ FS_AddGameDirectory(fs_homepath->string, fs_basegame->string);
+ }
+@@ -2790,6 +2792,7 @@
+ if (fs_basepath->string[0]) {
+ FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string);
+ }
++ FS_AddGameDirectory(LIBDIR, fs_gamedirvar->string);
+ if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
+ FS_AddGameDirectory(fs_homepath->string, fs_gamedirvar->string);
+ }
--- /dev/null
+++ games/quake3-data/pkg-descr
@@ -0,0 +1,7 @@
+Quake III Arena data files.
+
+This port installs the data files needed to run Quake III Arena. It also uses
+the update, and has an option to install Quake III Team Arena data files.
+
+You still need to have a legitimate copy of the game in order to obtain
+the .pk3 files.
--- /dev/null
+++ games/quake3-data/Makefile.include
@@ -0,0 +1,32 @@
+# Makefile for defining variables used by other Doom related ports.
+
+# Set variables.
+
+Q3PKGNAMEPREFIX?=quake3-
+Q3DIR?= ${LOCALBASE}/share/quake3
+
+# Add them to the environment.
+
+MAKE_ENV+= Q3DIR="${Q3DIR}"
+PLIST_SUB+= Q3DIR="${Q3DIR:S/${LOCALBASE}\///}"
+SUB_LIST+= Q3DIR="${Q3DIR}"
+
+# Add the dependency.
+
+.if ${PORTNAME} != "data"
+RUN_DEPENDS+= ${Q3DIR}/baseq3/pak1.pk3:${PORTSDIR}/games/quake3-data
+.endif
+
+# DOS to Unix text conversion.
+
+.if defined(USE_CRLF)
+. if defined(USE_ZIP)
+EXTRACT_BEFORE_ARGS= -aqo
+. else
+pre-patch:
+ @${FIND} ${WRKDIR} -type f -print0 | \
+ ${XARGS} -0 ${FILE} | ${GREP} 'CRLF' | \
+ ${SED} -e "s/:.*//" | ${SED} -e 's/ /\\ /g' | \
+ ${XARGS} ${REINPLACE_CMD} -i "" -e "s/`${PRINTF} '\r'`$$//"
+. endif
+.endif
--- /dev/null
+++ games/quake3-data/pkg-plist
@@ -0,0 +1,15 @@
+%%DATADIR%%/baseq3/pak1.pk3
+%%DATADIR%%/baseq3/pak2.pk3
+%%DATADIR%%/baseq3/pak3.pk3
+%%DATADIR%%/baseq3/pak4.pk3
+%%DATADIR%%/baseq3/pak5.pk3
+%%DATADIR%%/baseq3/pak6.pk3
+%%DATADIR%%/baseq3/pak7.pk3
+%%DATADIR%%/baseq3/pak8.pk3
+%%TEAMARENA%%%%DATADIR%%/missionpack/pak1.pk3
+%%TEAMARENA%%%%DATADIR%%/missionpack/pak2.pk3
+%%TEAMARENA%%%%DATADIR%%/missionpack/pak3.pk3
+share/pixmaps/quake3.xpm
+%%TEAMARENA%%@dirrmtry %%DATADIR%%/missionpack
+ at dirrmtry %%DATADIR%%/baseq3
+ at unexec rmdir %D/%%DATADIR%% >/dev/null 2>&1 || echo "If you are permanently removing this port, you should remove any configuration files, data files, and mods left in %D/%%DATADIR%%." | fmt
--- /dev/null
+++ games/quake3-data/Makefile
@@ -0,0 +1,56 @@
+# New ports collection makefile for: Quake 3 paks
+# Date created: 1st March 2003
+# Whom: nik at FreeBSD.org
+#
+# $MidnightBSD: mports/games/quake3-data/Makefile,v 1.1 2008/05/01 07:04:29 laffer1 Exp $
+# $FreeBSD: ports/games/quake3-data/Makefile,v 1.14 2007/05/19 20:07:23 flz Exp $
+#
+
+PORTNAME= data
+DISTVERSION= 1.32b-3
+CATEGORIES= games
+MASTER_SITES= ${MASTER_SITE_IDSOFTWARE}
+MASTER_SITE_SUBDIR= quake3/linux
+PKGNAMEPREFIX= ${Q3PKGNAMEPREFIX}
+DISTNAME= linuxq3apoint-${DISTVERSION}.x86
+EXTRACT_SUFX= .run
+
+MAINTAINER= ports at MidnightBSD.org
+COMMENT= Quake III Arena data files
+LICENSE= unknown
+
+NO_BUILD= yes
+NO_WRKSUBDIR= yes
+
+OPTIONS= TEAMARENA "Install Quake III Team Arena data files" on
+
+DATADIR= ${Q3DIR}
+
+SUB_FILES= pkg-message
+
+do-extract:
+ @${RM} -rf ${WRKDIR}
+ @${MKDIR} ${WRKDIR}
+ @cd ${WRKDIR} && ${TAIL} +356 ${_DISTDIR}/${DISTNAME}${EXTRACT_SUFX} | \
+ ${TAR} zxf - >/dev/null
+
+.include "Makefile.include"
+
+.include <bsd.port.pre.mk>
+
+.if !defined(WITHOUT_TEAMARENA)
+PLIST_SUB+= TEAMARENA=""
+.else
+PLIST_SUB+= TEAMARENA="@comment "
+.endif
+
+do-install:
+ @${MKDIR} ${FAKE_DESTDIR}${DATADIR}
+ @${CP} -R ${WRKSRC}/baseq3 ${FAKE_DESTDIR}${DATADIR}
+ @${MKDIR} ${PREFIX}/share/pixmaps
+ @${INSTALL_DATA} ${WRKSRC}/quake3.xpm ${PREFIX}/share/pixmaps
+.if !defined(WITHOUT_TEAMARENA)
+ @${CP} -R ${WRKSRC}/missionpack ${FAKE_DESTDIR}${DATADIR}
+.endif
+
+.include <bsd.port.post.mk>
--- /dev/null
+++ games/quake3-data/distinfo
@@ -0,0 +1,3 @@
+MD5 (linuxq3apoint-1.32b-3.x86.run) = c71fdddccb20e8fc393d846e9c61d685
+SHA256 (linuxq3apoint-1.32b-3.x86.run) = c36132c5556b35e01950f1e9c646235033a5130f87ad776ba2bc7becf4f4f186
+SIZE (linuxq3apoint-1.32b-3.x86.run) = 30923961
--- /dev/null
+++ games/quake3-data/files/pkg-message.in
@@ -0,0 +1,9 @@
+
+To complete the installation of this port you need to copy the file
+"baseq3/pak0.pk3" from the original Quake III Arena distribution to
+"%%DATADIR%%/baseq3".
+
+If you have the expansion pack then you have to copy the file
+"missionpack/pak0.pk3" from the original Quake III Team Arena
+distribution to "%%DATADIR%%/missionpack".
+
More information about the Midnightbsd-cvs
mailing list