summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorAlejandro Pulver <alepulver@FreeBSD.org>2007-04-21 03:09:06 +0000
committerAlejandro Pulver <alepulver@FreeBSD.org>2007-04-21 03:09:06 +0000
commitd826fcd87a1b814a0f9f0f31934564fbde90f6a3 (patch)
treea75ba3ee53c78e3dbae01ffb82ee32096aff3a0d /games
parentMark editors/emacs-devel as broken on ia64. It doesn't really (diff)
- Update to version 1.0a.
Notes
Notes: svn path=/head/; revision=190521
Diffstat (limited to 'games')
-rw-r--r--games/evq3/Makefile85
-rw-r--r--games/evq3/distinfo9
-rw-r--r--games/evq3/files/patch-SConscript_cgame15
-rw-r--r--games/evq3/files/patch-SConscript_evq341
-rw-r--r--games/evq3/files/patch-SConscript_game23
-rw-r--r--games/evq3/files/patch-SConscript_quake351
-rw-r--r--games/evq3/files/patch-SConscript_quake3-server58
-rw-r--r--games/evq3/files/patch-SConscript_ui23
-rw-r--r--games/evq3/files/patch-SConstruct123
-rw-r--r--games/evq3/files/patch-engine__client__cl_curl.c20
-rw-r--r--games/evq3/files/patch-engine__client__qal.c20
-rw-r--r--games/evq3/files/patch-engine__common__fs.c34
-rw-r--r--games/evq3/files/patch-engine__common__shared.h40
-rw-r--r--games/evq3/files/patch-engine__qcommon__common.c10
-rw-r--r--games/evq3/files/patch-engine__qcommon__files.c34
-rw-r--r--games/evq3/files/patch-engine__qcommon__q_math.c20
-rw-r--r--games/evq3/files/patch-engine__qcommon__vm_x86.c12
-rw-r--r--games/evq3/files/patch-engine__renderer__qgl.h40
-rw-r--r--games/evq3/files/patch-engine__renderer__tr_init.c11
-rw-r--r--games/evq3/files/patch-engine__renderer__tr_local.h11
-rw-r--r--games/evq3/files/patch-engine__renderer__tr_shade_calc.c11
-rw-r--r--games/evq3/files/patch-engine__splines__q_shared.h11
-rw-r--r--games/evq3/files/patch-engine__splines__q_shared.hpp11
-rw-r--r--games/evq3/files/patch-engine__unix__linux_glimp.c11
-rw-r--r--games/evq3/files/patch-engine__unix__linux_joystick.c105
-rw-r--r--games/evq3/files/patch-engine__unix__linux_qgl.c13
-rw-r--r--games/evq3/files/patch-engine__unix__linux_snd.c14
-rw-r--r--games/evq3/files/patch-engine__unix__unix_glw.h11
-rw-r--r--games/evq3/files/patch-engine__unix__unix_main.c117
-rw-r--r--games/evq3/files/patch-engine__unix__unix_shared.c27
-rw-r--r--games/evq3/files/pkg-message.in10
-rw-r--r--games/evq3/pkg-plist7
32 files changed, 657 insertions, 371 deletions
diff --git a/games/evq3/Makefile b/games/evq3/Makefile
index ab24c344f0df..b40c41ff3cbd 100644
--- a/games/evq3/Makefile
+++ b/games/evq3/Makefile
@@ -6,37 +6,43 @@
#
PORTNAME= evq3
-PORTVERSION= b2
+PORTVERSION= 1.0a
CATEGORIES= games
-MASTER_SITES= http://evolution.quakedev.com/files/Engine/
-DISTNAME= ${PORTNAME}-${PORTVERSION}-src
+MASTER_SITES= http://evolution.quakedev.com/dev/final/
+DISTNAME= ${PORTNAME}-final-src
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
+ pak-${PORTNAME}.pk3
+EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER= alepulver@FreeBSD.org
COMMENT= The Marriage of XreaL and Icculus.org Q3 w/ Improvements
-BUILD_DEPENDS= zip:${PORTSDIR}/archivers/zip
+LIB_DEPENDS= freetype.9:${PORTSDIR}/print/freetype2 \
+ vorbis.3:${PORTSDIR}/audio/libvorbis
USE_ZIP= yes
USE_DOS2UNIX= yes
-USE_GCC= 3.4+
USE_GL= yes
USE_SCONS= yes
SCONS_ARGS= warnings=0
-REINPLACE_ARGS= -i ''
NO_WRKSUBDIR= yes
-OPTIONS= FREETYPE2 "Compile engine with FreeType 2.x support" off \
+OPTIONS= GAMELIBS "Build game libraries (when not mandatory)" off \
+ LUA "Enable Lua support (for scripting)" off \
OPTIMIZED_CFLAGS "Enable compilation optimizations" on \
+ SDL "Use SDL for audio instead of OSS" off \
SIMD "Enable CPU optimizations (sse/3dnow)" on \
SMP "Build with SMP (threading) support" off
-CFLAGS+= -I${X11BASE}/include -DPNG_NO_ASSEMBLER_CODE
+CFLAGS+= -DDATADIR='"\"${Q3DIR}\""' -DLIBDIR='"\"${LIBDIR}\""'
PLIST_SUB= LIBDIR="${LIBDIR:S/${PREFIX}\///}"
LIBDIR= ${PREFIX}/lib/${PORTNAME}
VM_ARCHS= i386 amd64 powerpc
+.include "${.CURDIR}/../quake3-data/Makefile.include"
+
.include <bsd.port.pre.mk>
.for i in ${ARCH}
@@ -45,20 +51,31 @@ HAVE_VM_COMPILED= yes
. endif
.endfor
-.if !defined(HAVE_VM_COMPILED)
-SCONS_ARGS+= qvm=0
-SUB_FILES+= pkg-message
+.if defined(WITH_GAMELIBS) || !defined(HAVE_VM_COMPILED)
+SCONS_ARGS+= gamelibs=1
+PLIST_SUB+= GAMELIBS=""
+.else
+PLIST_SUB+= GAMELIBS="@comment "
.endif
-.if defined(WITH_FREETYPE2)
-LIB_DEPENDS+= freetype.9:${PORTSDIR}/print/freetype2
-SCONS_ARGS+= freetype=1
+.if defined(WITH_LUA)
+USE_LUA= 5.0
+SCONS_ARGS+= lua=1
+CPPPATH= ${LOCALBASE}/include ${X11BASE}/include ${LUA_INCDIR}
+LIBPATH= ${LOCALBASE}/lib ${X11BASE}/lib ${LUA_LIBDIR}
.endif
.if defined(WITHOUT_OPTIMIZED_CFLAGS)
SCONS_ARGS+= optimize=0
.endif
+.if defined(WITH_SDL)
+USE_SDL+= sdl
+SCONS_ARGS+= sound=sdl
+.else
+SCONS_ARGS+= sound=oss
+.endif
+
.if !defined(WITHOUT_SIMD) && !defined(PACKAGE_BUILDING)
.if ${MACHINE_CPU:Msse} != ""
SCONS_ARGS+= simd=sse
@@ -72,46 +89,20 @@ SCONS_ARGS+= smp=1
.endif
post-patch:
-.for f in CC CCFLAGS X11BASE
- @${REINPLACE_CMD} -e 's|%%${f}%%|${${f}}|' ${WRKSRC}/SConstruct
-.endfor
- @${REINPLACE_CMD} -e 's|%%X11BASE%%|${X11BASE}|' \
- ${WRKSRC}/SConscript_evq3
-.if defined(HAVE_VM_COMPILED) && ${ARCH} != "i386"
- @${REINPLACE_CMD} -e \
- 's|vm_x86|vm_${ARCH:S/amd64/x86_64/:S/powerpc/ppc/}|' \
- ${WRKSRC}/SConscript_evq3
-.endif
- @${REINPLACE_CMD} -e 's|^#if defined( __FreeBSD__ ).*|#if 0|' \
- ${WRKSRC}/engine/unix/linux_glimp.c
- @${REINPLACE_CMD} -e \
- 's|%%DATADIR%%|${Q3DIR}|; s|%%LIBDIR%%|${LIBDIR}|' \
- ${WRKSRC}/engine/common/fs.c ${WRKSRC}/engine/unix/unix_main.c
@${REINPLACE_CMD} -e 's|botlib\.log|/dev/null|' \
${WRKSRC}/engine/botlib/be_interface.c
- @${REINPLACE_CMD} -e 's|\.xreal|.${PORTNAME}|' \
- ${WRKSRC}/engine/unix/unix_shared.c
-
-# The .pk3 file (ZIP format) available in the web has wrong paths (everything
-# is under a "baseq3" directory), so we have to create our own one.
-post-build:
- @cd ${WRKSRC}/baseq3 && zip -r ../pak-evq3.pk3 *
do-install:
- ${INSTALL_PROGRAM} ${WRKSRC}/build/unix/evq3 ${PREFIX}/bin
+ ${INSTALL_PROGRAM} ${WRKSRC}/quake3 ${PREFIX}/bin/${PORTNAME}
+ ${INSTALL_PROGRAM} ${WRKSRC}/quake3-server ${PREFIX}/bin/${PORTNAME}-server
${MKDIR} ${LIBDIR}/baseq3
- ${INSTALL_DATA} ${WRKSRC}/pak-evq3.pk3 ${LIBDIR}/baseq3
+ ${INSTALL_DATA} ${DISTDIR}/pak-evq3.pk3 ${LIBDIR}/baseq3
+.if defined(WITH_GAMELIBS) || !defined(HAVE_VM_COMPILED)
+ ${INSTALL_PROGRAM} ${WRKSRC}/baseq3/*.so ${LIBDIR}/baseq3
+.endif
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
- ${INSTALL_DATA} ${WRKSRC}/README.html ${DOCSDIR}
+ cd ${WRKSRC} && ${INSTALL_DATA} ChangeLog.txt FEATURES.txt ${DOCSDIR}
.endif
-.if !defined(HAVE_VM_COMPILED)
-post-install:
- @${ECHO_CMD}
- @${CAT} ${PKGMESSAGE}
- @${ECHO_CMD}
-.endif
-
-.include "${.CURDIR}/../quake3-data/Makefile.include"
.include <bsd.port.post.mk>
diff --git a/games/evq3/distinfo b/games/evq3/distinfo
index c7b309516a20..f49e46fdbbf1 100644
--- a/games/evq3/distinfo
+++ b/games/evq3/distinfo
@@ -1,3 +1,6 @@
-MD5 (evq3-b2-src.zip) = 99278e2d098dcacee8bc853f43e917b3
-SHA256 (evq3-b2-src.zip) = 0beafd8ed65ba1006906e76204214461436a0e70840a1bb43bc43477d6a7d5b5
-SIZE (evq3-b2-src.zip) = 2879491
+MD5 (evq3-final-src.zip) = 54e0d7b4daafdcd5cf7f3319f725da1c
+SHA256 (evq3-final-src.zip) = 33ece0a56eafa4dd6efab1c5f10a4bdd1a3b145ebf33b43fc06d18c3125dffef
+SIZE (evq3-final-src.zip) = 3042231
+MD5 (pak-evq3.pk3) = 3ee963f2fa58bd36eb2538c1b2252753
+SHA256 (pak-evq3.pk3) = 7d812e608b1117e28b427123a4546b9cc11fb68bb7097d52b58af42fb2a1d9f2
+SIZE (pak-evq3.pk3) = 142174
diff --git a/games/evq3/files/patch-SConscript_cgame b/games/evq3/files/patch-SConscript_cgame
new file mode 100644
index 000000000000..c8791ad9d5fb
--- /dev/null
+++ b/games/evq3/files/patch-SConscript_cgame
@@ -0,0 +1,15 @@
+--- ./SConscript_cgame.orig Mon Apr 16 17:45:23 2007
++++ ./SConscript_cgame Mon Apr 16 17:45:23 2007
+@@ -36,10 +36,6 @@
+
+ cgame_env = env.Copy()
+
+-if env['arch'] == 'linux-i386':
+- cgame_env.SharedLibrary('cgame', [cgame_src, dll_src], LIBS=['m'])
+- cgame_env.InstallAs('#baseq3/cgamei386.so', 'libcgame.so')
+-
+-elif env['arch'] == 'linux-x86_64':
++if sys.platform != 'win32':
+ cgame_env.SharedLibrary('cgame', [cgame_src, dll_src], LIBS=['m'])
+- cgame_env.InstallAs('#baseq3/cgamex86_64.so', 'libcgame.so')
++ cgame_env.InstallAs('#baseq3/cgame.so', 'libcgame.so')
diff --git a/games/evq3/files/patch-SConscript_evq3 b/games/evq3/files/patch-SConscript_evq3
deleted file mode 100644
index 34c3e954fc2f..000000000000
--- a/games/evq3/files/patch-SConscript_evq3
+++ /dev/null
@@ -1,41 +0,0 @@
---- SConscript_evq3.orig Sun Feb 25 20:25:06 2007
-+++ SConscript_evq3 Sun Feb 25 20:27:04 2007
-@@ -208,9 +208,9 @@
-
- # Linux x86 (GCC)
- if env['arch'] == 'linux-i386':
-- evq3_env.Append(LIBPATH='/usr/X11R6/lib')
-+ evq3_env.Append(LIBPATH='%%X11BASE%%/lib')
- evq3_env.Append(LIBS=['X11', 'Xext', 'Xxf86dga', 'Xxf86vm'])
-- evq3_env.Append(LIBS=['dl', 'm'])
-+ evq3_env.Append(LIBS=['m'])
-
- if env['smp'] == 1:
- evq3_env.Append(CCFLAGS='-DSMP')
-@@ -220,19 +220,19 @@
- evq3_env.ParseConfig('freetype-config --cflags --libs')
- evq3_env.Append(CCFLAGS='-DBUILD_FREETYPE')
-
-- #if env['qvm'] == 1:
-- linux_src += ['engine/common/vm_x86.c']
-- #else:
-- #evq3_env.Append(CCFLAGS='-DDLL_ONLY')
-+ if env['qvm'] == 1:
-+ linux_src += ['engine/common/vm_x86.c']
-+ else:
-+ evq3_env.Append(CCFLAGS='-DDLL_ONLY')
-
- if env['sdl'] == 1:
- evq3_env.ParseConfig('sdl-config --cflags --libs')
- evq3_env.Append(CCFLAGS='-DUSE_SDL')
-- evq3_env.Program('evq3.x86', [evq3_src, libs_src, sdl_src])
-+ evq3_env.Program('evq3', [evq3_src, libs_src, sdl_src])
- else:
-- evq3_env.Program('evq3.x86', [evq3_src, libs_src, linux_src])
-+ evq3_env.Program('evq3', [evq3_src, libs_src, linux_src])
-
-- evq3_env.Install('#build/unix', 'evq3.x86')
-+ evq3_env.Install('#build/unix', 'evq3')
-
- # Linux x86_64 (GCC)
- elif env['arch'] == 'linux-x86_64':
diff --git a/games/evq3/files/patch-SConscript_game b/games/evq3/files/patch-SConscript_game
new file mode 100644
index 000000000000..2db8b2a67ec7
--- /dev/null
+++ b/games/evq3/files/patch-SConscript_game
@@ -0,0 +1,23 @@
+--- SConscript_game.orig Fri Apr 20 18:09:05 2007
++++ SConscript_game Fri Apr 20 18:10:16 2007
+@@ -79,16 +79,10 @@
+
+ game_env = env.Copy()
+
+-if env['arch'] == 'linux-i386':
+- if env['lua'] == 1:
++if sys.platform != 'win32':
++ if env['lua'] != 0:
+ game_env.Append(CCFLAGS='-DLUA')
+- game_env.Append(CCFLAGS='-Ilua/include')
+- game_env.SharedLibrary('game', [game_src, dll_src, lua_src], LIBS=['m'])
++ game_env.SharedLibrary('game', [game_src, dll_src], LIBS=['m', 'lua'])
+ else:
+ game_env.SharedLibrary('game', [game_src, dll_src], LIBS=['m'])
+- game_env.InstallAs('#baseq3/qagamei386.so', 'libgame.so')
+-
+-elif env['arch'] == 'linux-x86_64':
+- game_env.SharedLibrary('game', [game_src, dll_src], LIBS=['m'])
+- game_env.InstallAs('#baseq3/qagamex86_64.so', 'libgame.so')
+-
++ game_env.InstallAs('#baseq3/qagame.so', 'libgame.so')
diff --git a/games/evq3/files/patch-SConscript_quake3 b/games/evq3/files/patch-SConscript_quake3
new file mode 100644
index 000000000000..b19961539a6f
--- /dev/null
+++ b/games/evq3/files/patch-SConscript_quake3
@@ -0,0 +1,51 @@
+--- SConscript_quake3.orig Fri Apr 20 17:28:47 2007
++++ SConscript_quake3 Fri Apr 20 17:51:18 2007
+@@ -1,4 +1,4 @@
+-import os, string, sys
++import os, string, sys, fnmatch
+
+ Import('env')
+
+@@ -169,25 +169,29 @@
+ quake3_env.Append(CCFLAGS='-DBOTLIB')
+ quake3_env.Append(CCFLAGS='-DC_ONLY')
+
+-if env['arch'] == 'linux-i386':
+- quake3_env.Append(LIBPATH='/usr/X11R6/lib')
++if sys.platform != 'win32':
+ quake3_env.Append(LIBS=['X11', 'Xext', 'Xxf86dga', 'Xxf86vm'])
+- quake3_env.Append(LIBS=['dl', 'm'])
++ quake3_env.Append(LIBS=['m', 'vorbisfile'])
++
++ # The "dl" library is needed on Linux
++ if fnmatch.fnmatch(sys.platform, 'linux*'):
++ quake3_env.Append(LIBS=['dl'])
+
+- if env['vm'] == 1:
+- vm_src += ['engine/qcommon/vm_x86.c']
++ if env['vm'] != 0 and env['vm_archs'].count(env['arch']) > 0:
++ vm_src += ['engine/qcommon/vm_' + env['arch'] + '.c']
+ else:
+ quake3_env.Append(CCFLAGS='-DDLL_ONLY')
+-
+- if env['smp'] == 1:
++
++ if env['smp'] != 0:
+ quake3_env.Append(CCFLAGS='-DSMP')
+ quake3_env.Append(LIBS=['pthread'])
+
+ if env['sound'] == 'oss':
+- quake3_env.Program('quake3.x86', [quake3_src, unix_src, linux_src, vm_src, 'engine/unix/linux_snd.c'])
++ quake3_env.Program('quake3', [quake3_src, unix_src, linux_src, vm_src, 'engine/unix/linux_snd.c'])
+ else:
+- quake3_env.Append(CCFLAGS='`sdl-config --cflags`')
+- quake3_env.Append(LINKFLAGS='`sdl-config --libs`')
+- quake3_env.Program('quake3.x86', [quake3_src, unix_src, linux_src, vm_src, 'engine/unix/sdl_snd.c'])
+-
+- quake3_env.Install('#', 'quake3.x86')
++ quake3_env.Append(CCFLAGS='-DUSE_SDL_SOUND')
++ quake3_env.ParseConfig('sdl-config --cflags')
++ quake3_env.ParseConfig('sdl-config --libs')
++ quake3_env.Program('quake3', [quake3_src, unix_src, linux_src, vm_src, 'engine/unix/sdl_snd.c'])
++
++ quake3_env.Install('#', 'quake3')
diff --git a/games/evq3/files/patch-SConscript_quake3-server b/games/evq3/files/patch-SConscript_quake3-server
new file mode 100644
index 000000000000..6f1e093357a2
--- /dev/null
+++ b/games/evq3/files/patch-SConscript_quake3-server
@@ -0,0 +1,58 @@
+--- SConscript_quake3-server.orig Tue Apr 17 00:09:21 2007
++++ SConscript_quake3-server Tue Apr 17 00:10:29 2007
+@@ -1,4 +1,4 @@
+-import os, string, sys
++import os, string, sys, fnmatch
+
+ Import('env')
+
+@@ -30,8 +30,8 @@
+ 'engine/server/sv_net_chan.c',
+ 'engine/server/sv_snapshot.c',
+ 'engine/server/sv_world.c',
+-'engine/game/q_math.c',
+-'engine/game/q_shared.c',
++'engine/qcommon/q_math.c',
++'engine/qcommon/q_shared.c',
+ 'engine/qcommon/unzip.c',
+ 'engine/botlib/be_aas_bspq3.c',
+ 'engine/botlib/be_aas_cluster.c',
+@@ -70,7 +70,7 @@
+ ]
+
+ linux_src = [
+-'engine/unix/linux_common.c',
++#'engine/unix/linux_common.c',
+ 'engine/unix/linux_signals.c']
+
+ vm_src = [
+@@ -82,18 +82,17 @@
+ quake3_server_env.Append(CCFLAGS='-DC_ONLY')
+ quake3_server_env.Append(CCFLAGS='-DDEDICATED')
+
+-if env['arch'] == 'linux-i386':
+- if env['vm'] == 1:
+- vm_src += ['engine/qcommon/vm_x86.c']
++if sys.platform != 'win32':
++ quake3_server_env.Append(LIBS=['m'])
++
++ # The "dl" library is needed on Linux
++ if fnmatch.fnmatch(sys.platform, 'linux*'):
++ quake3_server_env.Append(LIBS=['dl'])
++
++ if env['vm'] != 0 and env['vm_archs'].count(env['arch']) > 0:
++ vm_src += ['engine/qcommon/vm_' + env['arch'] + '.c']
+ else:
+ quake3_server_env.Append(CCFLAGS='-DDLL_ONLY')
+
+- quake3_server_env.Append(LIBS=['dl', 'm'])
+- quake3_server_env.Program('quake3-server.x86', [quake3_server_src, unix_src, linux_src, vm_src])
+- quake3_server_env.Install('#', 'quake3-server.x86')
+-
+-elif env['arch'] == 'linux-x86_64':
+- quake3_server_env.Append(CCFLAGS='-DDLL_ONLY')
+- quake3_server_env.Append(LIBS=['dl', 'm'])
+- quake3_server_env.Program('quake3-server.x86_64', [quake3_server_src, unix_src, linux_src, vm_src])
+- quake3_server_env.Install('#', 'quake3-server.x86_64')
++ quake3_server_env.Program('quake3-server', [quake3_server_src, unix_src, linux_src, vm_src])
++ quake3_server_env.Install('#', 'quake3-server')
diff --git a/games/evq3/files/patch-SConscript_ui b/games/evq3/files/patch-SConscript_ui
new file mode 100644
index 000000000000..1f1e38a3f2c9
--- /dev/null
+++ b/games/evq3/files/patch-SConscript_ui
@@ -0,0 +1,23 @@
+--- SConscript_ui.orig Fri Apr 20 16:56:15 2007
++++ SConscript_ui Fri Apr 20 17:03:27 2007
+@@ -8,7 +8,6 @@
+ 'engine/q3_ui/ui_addbots.c',
+ 'engine/q3_ui/ui_atoms.c',
+ 'engine/q3_ui/ui_cdkey.c',
+-'engine/q3_ui/ui_cinematics.c',
+ 'engine/q3_ui/ui_confirm.c',
+ 'engine/q3_ui/ui_connect.c',
+ 'engine/q3_ui/ui_controls2.c',
+@@ -60,10 +59,6 @@
+
+ ui_env = env.Copy()
+
+-if env['arch'] == 'linux-i386':
+- ui_env.SharedLibrary('ui', [ui_src, dll_src], LIBS=['m'])
+- ui_env.InstallAs('#baseq3/uii386.so', 'libui.so')
+-
+-elif env['arch'] == 'linux-x86_64':
++if sys.platform != 'win32':
+ ui_env.SharedLibrary('ui', [ui_src, dll_src], LIBS=['m'])
+- ui_env.InstallAs('#baseq3/uix86_64.so', 'libui.so')
++ ui_env.InstallAs('#baseq3/ui.so', 'libui.so')
diff --git a/games/evq3/files/patch-SConstruct b/games/evq3/files/patch-SConstruct
index dc52cbfc353b..9b41d9bcd7f4 100644
--- a/games/evq3/files/patch-SConstruct
+++ b/games/evq3/files/patch-SConstruct
@@ -1,34 +1,105 @@
---- SConstruct.orig Sun Feb 25 20:22:51 2007
-+++ SConstruct Sun Feb 25 20:23:30 2007
-@@ -16,6 +16,7 @@
- opts.Add(BoolOption('sdl', 'Set to 1 to compile engine with a SDL backend instead of the native backend', 0))
- opts.Add(BoolOption('freetype', 'Set to 1 to compile engine with FreeType 2.x support', 0))
- opts.Add(BoolOption('tools', 'Set to 1 to compile xmap, gtkradiant, and master', 0))
-+opts.Add(BoolOption('qvm', 'Set to 1 to enable QVM support', 1))
+--- SConstruct.orig Fri Apr 20 18:52:56 2007
++++ SConstruct Fri Apr 20 18:53:14 2007
+@@ -1,4 +1,4 @@
+-import os, string, sys
++import os, string, sys, commands, fnmatch
+ import SCons
+ import SCons.Errors
+@@ -6,7 +6,10 @@
+ # Set configuration options
#
- # initialize compiler environment base
-@@ -32,7 +33,9 @@
+ opts = Options('quake3.conf')
+-opts.Add(EnumOption('arch', 'Choose architecture to build for', 'linux-i386', allowed_values=('linux-i386', 'linux-x86_64')))
++opts.Add('CC', 'C compiler')
++opts.Add('CCFLAGS', 'C compiler flags', Split(''))
++opts.Add('CPPPATH', 'Compiler include path', Split(''))
++opts.Add('LIBPATH', 'Linker library path', Split(''))
+ opts.Add(EnumOption('warnings', 'Choose warnings level', '1', allowed_values=('0', '1', '2')))
+ opts.Add(EnumOption('debug', 'Set to >= 1 to build for debug', '0', allowed_values=('0', '1', '2', '3')))
+ opts.Add(EnumOption('optimize', 'Set to >= 1 to build with general optimizations', '2', allowed_values=('0', '1', '2', '3', '4', '5', '6')))
+@@ -15,6 +18,7 @@
+ opts.Add(BoolOption('lua', 'Set to 1 to compile qagame with Lua scripting support', 0))
+ opts.Add(BoolOption('vm', 'Set to 1 to compile engine with virtual machine support', 1))
+ opts.Add(BoolOption('smp', 'Set to 1 to compile engine with symetric multiprocessor support', 0))
++opts.Add(BoolOption('gamelibs', 'Set to 1 to compile .so game libraries (cgame, game and ui) when they are not needed (i.e. when "vm" is 1 and supported for current arch)', 0))
+
+ #
+ # Initialize compiler environment base
+@@ -24,15 +28,32 @@
+ else:
+ env = Environment(ENV = {'PATH' : os.environ['PATH']}, options = opts)
+
+-Help(opts.GenerateHelpText(env))
++ # Some values need to be splitten
++ env['CCFLAGS'] = Split(env['CCFLAGS'])
++ env['CPPPATH'] = Split(env['CPPPATH'])
++ env['LIBPATH'] = Split(env['LIBPATH'])
++
++ # Supported VM architectures (Linux)
++ env['vm_archs'] = ['x86', 'x86_64', 'ppc']
++ env['arch'] = commands.getoutput('uname -m')
++
++ # Equivalent arch names in FreeBSD
++ if fnmatch.fnmatch(sys.platform, 'freebsd*'):
++ vm_archs_freebsd = {'i386' : 'x86', 'amd64' : 'x86_64', 'powerpc' : 'ppc'}
++ env['arch'] = vm_archs_freebsd[env['arch']]
++
++ # Build game libraries if VM is not supported in current arch
++ if env['vm_archs'].count(env['arch']) == 0 or env['vm'] == 0:
++ env['gamelibs'] = 1
+
++Help(opts.GenerateHelpText(env))
+
+ #
+ # Set common compiler flags
#
print 'compiling for architecture ', env['arch']
-env.Append(CCFLAGS = '-pipe -fsigned-char')
-+env['CC'] = '%%CC%%'
-+
-+env.Append(CCFLAGS = '%%CCFLAGS%% -pipe -fsigned-char')
++env.Append(CCFLAGS = Split('-pipe -fsigned-char'))
+
+ if env['warnings'] == '1':
+ env.Append(CCFLAGS = '-Wall')
+@@ -45,7 +66,7 @@
+ env.Append(CCFLAGS = '-DNDEBUG')
+
+ if env['optimize'] != '0':
+- env.Append(CCFLAGS = '-O${optimize} -ffast-math -fno-strict-aliasing -funroll-loops')
++ env.Append(CCFLAGS = Split('-O${optimize} -ffast-math -fno-strict-aliasing -funroll-loops'))
+
+ if env['simd'] == 'sse':
+ env.Append(CCFLAGS = '-DSIMD_SSE')
+@@ -54,15 +75,12 @@
+
+ conf = Configure(env)
+
+-if sys.platform == 'linux2' or sys.platform == 'linux-i386':
++# The "dl" library is needed on Linux
++if fnmatch.fnmatch(sys.platform, 'linux*'):
+ if not conf.CheckLib('dl', autoadd=0):
+ print 'Did not find libdl.a, exiting!'
+ Exit(1)
+
+-if not conf.CheckLib('m', autoadd=0):
+- print 'Did not find libm.a or m.lib, exiting!'
+- Exit(1)
+-
+ env = conf.Finish()
+
+ # Save options
+@@ -70,8 +88,10 @@
- if env['arch'] == 'xwin32':
- env.Tool('xmingw', ['SCons/Tools'])
-@@ -69,9 +72,9 @@
Export('env')
- SConscript('SConscript_evq3', build_dir='build/scons/evq3', duplicate=0)
- #SConscript('SConscript_evq3-ded', build_dir='build/scons/evq3-ded', duplicate=0)
--SConscript('SConscript_cgame', build_dir='build/scons/cgame', duplicate=0)
--SConscript('SConscript_game', build_dir='build/scons/game', duplicate=0)
--SConscript('SConscript_ui', build_dir='build/scons/ui', duplicate=0)
-+#SConscript('SConscript_cgame', build_dir='build/scons/cgame', duplicate=0)
-+#SConscript('SConscript_game', build_dir='build/scons/game', duplicate=0)
-+#SConscript('SConscript_ui', build_dir='build/scons/ui', duplicate=0)
-
- #if env['tools'] != '0':
- #SConscript('SConscript_bspc', build_dir='build/scons/bspc', duplicate=0)
+
+-SConscript('SConscript_quake3-server', build_dir='build/quake3-server', duplicate=0)
+ SConscript('SConscript_quake3', build_dir='build/quake3', duplicate=0)
+-SConscript('SConscript_cgame', build_dir='build/cgame', duplicate=0)
+-SConscript('SConscript_game', build_dir='build/game', duplicate=0)
+-SConscript('SConscript_ui', build_dir='build/ui', duplicate=0)
++SConscript('SConscript_quake3-server', build_dir='build/quake3-server', duplicate=0)
++
++if env['gamelibs'] != 0:
++ SConscript('SConscript_cgame', build_dir='build/cgame', duplicate=0)
++ SConscript('SConscript_game', build_dir='build/game', duplicate=0)
++ SConscript('SConscript_ui', build_dir='build/ui', duplicate=0)
diff --git a/games/evq3/files/patch-engine__client__cl_curl.c b/games/evq3/files/patch-engine__client__cl_curl.c
new file mode 100644
index 000000000000..d6d5ca8e2ca2
--- /dev/null
+++ b/games/evq3/files/patch-engine__client__cl_curl.c
@@ -0,0 +1,20 @@
+--- ./engine/client/cl_curl.c.orig Sat Mar 31 20:25:28 2007
++++ ./engine/client/cl_curl.c Mon Apr 16 23:56:57 2007
+@@ -41,7 +41,7 @@
+ #define SYMLOAD(x,y) GetProcAddress(x,y)
+ #define OBJFREE(x) FreeLibrary(x)
+
+-#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X || defined __sun
++#elif defined __unix__ || defined MACOS_X || defined __sun
+ #include <dlfcn.h>
+ #define OBJTYPE void *
+ #define OBJLOAD(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
+@@ -52,7 +52,7 @@
+ #error "Your platform has no lib loading code or it is disabled"
+ #endif
+
+-#if defined __linux__ || defined __FreeBSD__ || defined MACOS_X
++#if defined __unix__ || defined MACOS_X
+ #include <unistd.h>
+ #include <sys/types.h>
+ #endif
diff --git a/games/evq3/files/patch-engine__client__qal.c b/games/evq3/files/patch-engine__client__qal.c
new file mode 100644
index 000000000000..2f513df8e634
--- /dev/null
+++ b/games/evq3/files/patch-engine__client__qal.c
@@ -0,0 +1,20 @@
+--- ./engine/client/qal.c.orig Sat Mar 31 20:25:28 2007
++++ ./engine/client/qal.c Mon Apr 16 23:57:10 2007
+@@ -44,7 +44,7 @@
+ #define SYMLOAD(x,y) GetProcAddress(x,y)
+ #define OBJFREE(x) FreeLibrary(x)
+
+-#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X || defined __sun
++#elif defined __unix__ || defined MACOS_X || defined __sun
+ #include <dlfcn.h>
+ #define OBJTYPE void *
+ #define OBJLOAD(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
+@@ -55,7 +55,7 @@
+ #error "Your platform has no lib loading code or it is disabled"
+ #endif
+
+-#if defined __linux__ || defined __FreeBSD__ || defined MACOS_X
++#if defined __unix__ || defined MACOS_X
+ #include <unistd.h>
+ #include <sys/types.h>
+ #endif
diff --git a/games/evq3/files/patch-engine__common__fs.c b/games/evq3/files/patch-engine__common__fs.c
deleted file mode 100644
index b1f0257322e8..000000000000
--- a/games/evq3/files/patch-engine__common__fs.c
+++ /dev/null
@@ -1,34 +0,0 @@
---- engine/common/fs.c.orig Wed Dec 20 20:29:46 2006
-+++ engine/common/fs.c Sat Dec 23 13:16:38 2006
-@@ -3115,6 +3115,7 @@
- fs_debug = Cvar_Get("fs_debug", "0", 0);
- fs_copyfiles = Cvar_Get("fs_copyfiles", "0", CVAR_INIT);
- fs_cdpath = Cvar_Get("fs_cdpath", Sys_DefaultCDPath(), CVAR_INIT);
-+ Sys_SetDefaultInstallPath("%%DATADIR%%");
- fs_basepath = Cvar_Get("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT);
- fs_basegame = Cvar_Get("fs_basegame", "", CVAR_INIT);
- homePath = Sys_DefaultHomePath();
-@@ -3135,6 +3136,7 @@
- {
- 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))
-@@ -3153,6 +3155,7 @@
- {
- 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);
-@@ -3170,6 +3173,7 @@
- {
- 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);
diff --git a/games/evq3/files/patch-engine__common__shared.h b/games/evq3/files/patch-engine__common__shared.h
deleted file mode 100644
index 2e2801f58db2..000000000000
--- a/games/evq3/files/patch-engine__common__shared.h
+++ /dev/null
@@ -1,40 +0,0 @@
---- ./engine/common/shared.h.orig Wed Dec 20 20:29:46 2006
-+++ ./engine/common/shared.h Sat Dec 23 11:12:47 2006
-@@ -365,7 +365,9 @@
-
- // bk010116 - omitted Q3STATIC (see Linux above), broken target
-
--#if !idppc
-+#include <machine/endian.h>
-+
-+#if BYTE_ORDER == LITTLE_ENDIAN
- static short BigShort(short l)
- {
- return ShortSwap(l);
-@@ -384,7 +386,7 @@
- }
-
- #define LittleFloat
--#else
-+#elif BYTE_ORDER == BIG_ENDIAN
- #define BigShort
- static short LittleShort(short l)
- {
-@@ -402,6 +404,8 @@
- {
- return FloatSwap(l);
- }
-+#else
-+#error Unknown endianess
- #endif
-
- #endif
-@@ -542,7 +546,7 @@
- #endif
-
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
--#if __linux__
-+#if __unix__
- void Snd_Memset(void *dest, const int val, const size_t count);
- #else
- #define Snd_Memset memset
diff --git a/games/evq3/files/patch-engine__qcommon__common.c b/games/evq3/files/patch-engine__qcommon__common.c
new file mode 100644
index 000000000000..e0ae33cbca70
--- /dev/null
+++ b/games/evq3/files/patch-engine__qcommon__common.c
@@ -0,0 +1,10 @@
+--- engine/qcommon/common.c.orig Thu Apr 19 21:42:48 2007
++++ engine/qcommon/common.c Thu Apr 19 21:49:46 2007
+@@ -23,6 +23,7 @@
+
+ #include "q_shared.h"
+ #include "qcommon.h"
++#include <sys/types.h>
+ #include <setjmp.h>
+
+ int demo_protocols[] =
diff --git a/games/evq3/files/patch-engine__qcommon__files.c b/games/evq3/files/patch-engine__qcommon__files.c
new file mode 100644
index 000000000000..3bfdac621e1f
--- /dev/null
+++ b/games/evq3/files/patch-engine__qcommon__files.c
@@ -0,0 +1,34 @@
+--- engine/qcommon/files.c.orig Fri Apr 20 16:29:25 2007
++++ engine/qcommon/files.c Fri Apr 20 16:50:00 2007
+@@ -2798,6 +2798,7 @@
+ fs_debug = Cvar_Get( "fs_debug", "0", 0 );
+ fs_copyfiles = Cvar_Get( "fs_copyfiles", "0", CVAR_INIT );
+ fs_cdpath = Cvar_Get ("fs_cdpath", Sys_DefaultCDPath(), CVAR_INIT );
++ Sys_SetDefaultInstallPath(DATADIR);
+ fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT );
+ fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT );
+ homePath = Sys_DefaultHomePath();
+@@ -2815,6 +2816,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)) {
+@@ -2829,6 +2831,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);
+ }
+@@ -2842,6 +2845,7 @@
+ if (fs_basepath->string[0]) {
+ FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->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_gamedirvar->string);
+ }
diff --git a/games/evq3/files/patch-engine__qcommon__q_math.c b/games/evq3/files/patch-engine__qcommon__q_math.c
new file mode 100644
index 000000000000..f90e3b1c1abe
--- /dev/null
+++ b/games/evq3/files/patch-engine__qcommon__q_math.c
@@ -0,0 +1,20 @@
+--- ./engine/qcommon/q_math.c.orig Tue Apr 3 21:05:30 2007
++++ ./engine/qcommon/q_math.c Mon Apr 16 23:57:25 2007
+@@ -651,7 +651,7 @@
+ y = y * (threehalfs - (x2 * y * y)); // 1st iteration
+ // y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
+ #ifndef Q3_VM
+-#ifdef __linux__
++#ifdef __unix__
+ assert(!isnan(y)); // bk010122 - FPE?
+ #endif
+ #endif
+@@ -819,7 +819,7 @@
+ }
+
+
+-#if !( (defined __linux__ || __FreeBSD__) && (defined __i386__) && (!defined C_ONLY)) // rb010123
++#if !( (defined __unix__) && (defined __i386__) && (!defined C_ONLY)) // rb010123
+
+ #if defined __LCC__ || defined C_ONLY || !id386 || defined __VECTORC
+
diff --git a/games/evq3/files/patch-engine__qcommon__vm_x86.c b/games/evq3/files/patch-engine__qcommon__vm_x86.c
new file mode 100644
index 000000000000..d5b3b259f358
--- /dev/null
+++ b/games/evq3/files/patch-engine__qcommon__vm_x86.c
@@ -0,0 +1,12 @@
+--- ./engine/qcommon/vm_x86.c.orig Sat Dec 16 17:45:12 2006
++++ ./engine/qcommon/vm_x86.c Tue Apr 17 00:09:12 2007
+@@ -62,7 +62,9 @@
+
+ static int *instructionPointers = NULL;
+
++#ifndef __FreeBSD__
+ #define FTOL_PTR
++#endif
+
+ #ifdef _MSC_VER
+
diff --git a/games/evq3/files/patch-engine__renderer__qgl.h b/games/evq3/files/patch-engine__renderer__qgl.h
new file mode 100644
index 000000000000..5ace9a68199e
--- /dev/null
+++ b/games/evq3/files/patch-engine__renderer__qgl.h
@@ -0,0 +1,40 @@
+--- ./engine/renderer/qgl.h.orig Sun Mar 25 16:56:34 2007
++++ ./engine/renderer/qgl.h Mon Apr 16 23:58:33 2007
+@@ -45,7 +45,7 @@
+
+ #include "macosx_glimp.h"
+
+-#elif defined( __linux__ )
++#elif defined( __unix__ )
+
+ #include <GL/gl.h>
+ #include <GL/glx.h>
+@@ -325,7 +325,7 @@
+ //===========================================================================
+
+ // non-windows systems will just redefine qgl* to gl*
+-#if !defined( _WIN32 ) && !defined(MACOS_X) && !defined( __linux__ ) && !defined( __FreeBSD__ ) // rb010123
++#if !defined( _WIN32 ) && !defined(MACOS_X) && !defined( __unix__ ) // rb010123
+
+ #include "qgl_linked.h"
+
+@@ -712,7 +712,7 @@
+
+ #endif // _WIN32
+
+-#if ( (defined __linux__ ) || (defined __FreeBSD__ ) ) // rb010123
++#ifdef __unix__ // rb010123
+
+ //FX Mesa Functions
+ // bk001129 - from cvs1.17 (mkv)
+@@ -733,8 +733,8 @@
+ extern void (*qglXCopyContext)( Display *dpy, GLXContext src, GLXContext dst, GLuint mask );
+ extern void (*qglXSwapBuffers)( Display *dpy, GLXDrawable drawable );
+
+-#endif // __linux__ || __FreeBSD__ // rb010123
++#endif // __unix__ // rb010123
+
+-#endif // _WIN32 && __linux__
++#endif // _WIN32 && __unix__
+
+ #endif
diff --git a/games/evq3/files/patch-engine__renderer__tr_init.c b/games/evq3/files/patch-engine__renderer__tr_init.c
new file mode 100644
index 000000000000..1b5ea73ec1f3
--- /dev/null
+++ b/games/evq3/files/patch-engine__renderer__tr_init.c
@@ -0,0 +1,11 @@
+--- ./engine/renderer/tr_init.c.orig Tue Apr 3 15:02:50 2007
++++ ./engine/renderer/tr_init.c Mon Apr 16 23:58:43 2007
+@@ -1108,7 +1108,7 @@
+ r_simpleMipMaps = ri.Cvar_Get("r_simpleMipMaps", "1", CVAR_ARCHIVE | CVAR_LATCH);
+ r_uiFullScreen = ri.Cvar_Get("r_uifullscreen", "0", 0);
+ r_subdivisions = ri.Cvar_Get("r_subdivisions", "4", CVAR_ARCHIVE | CVAR_LATCH);
+-#if (defined(MACOS_X) || defined(__linux__)) && defined(SMP)
++#if (defined(MACOS_X) || defined(__unix__)) && defined(SMP)
+ // Default to using SMP on Mac OS X or Linux if we have multiple processors
+ r_smp = ri.Cvar_Get("r_smp", Sys_ProcessorCount() > 1 ? "1" : "0", CVAR_ARCHIVE | CVAR_LATCH);
+ #else
diff --git a/games/evq3/files/patch-engine__renderer__tr_local.h b/games/evq3/files/patch-engine__renderer__tr_local.h
new file mode 100644
index 000000000000..f3d0e78ddabd
--- /dev/null
+++ b/games/evq3/files/patch-engine__renderer__tr_local.h
@@ -0,0 +1,11 @@
+--- ./engine/renderer/tr_local.h.orig Tue Apr 3 14:30:38 2007
++++ ./engine/renderer/tr_local.h Mon Apr 16 23:58:54 2007
+@@ -33,7 +33,7 @@
+ typedef unsigned int glIndex_t;
+
+ // fast float to int conversion
+-#if id386 && !( (defined __linux__ || defined __FreeBSD__ ) && (defined __i386__ ) ) // rb010123
++#if id386 && !( (defined __unix__ ) && (defined __i386__ ) ) // rb010123
+ long myftol(float f);
+ #else
+ #define myftol(x) ((int)(x))
diff --git a/games/evq3/files/patch-engine__renderer__tr_shade_calc.c b/games/evq3/files/patch-engine__renderer__tr_shade_calc.c
new file mode 100644
index 000000000000..7a2ca765c089
--- /dev/null
+++ b/games/evq3/files/patch-engine__renderer__tr_shade_calc.c
@@ -0,0 +1,11 @@
+--- ./engine/renderer/tr_shade_calc.c.orig Thu Mar 29 18:53:40 2007
++++ ./engine/renderer/tr_shade_calc.c Mon Apr 16 23:59:03 2007
+@@ -1645,7 +1645,7 @@
+ }
+ }
+
+-#if id386 && !( (defined __linux__ || defined __FreeBSD__ ) && (defined __i386__ ) ) // rb010123
++#if id386 && !( (defined __unix__ ) && (defined __i386__ ) ) // rb010123
+
+ long myftol(float f)
+ {
diff --git a/games/evq3/files/patch-engine__splines__q_shared.h b/games/evq3/files/patch-engine__splines__q_shared.h
new file mode 100644
index 000000000000..5a6d3fe6b12b
--- /dev/null
+++ b/games/evq3/files/patch-engine__splines__q_shared.h
@@ -0,0 +1,11 @@
+--- ./engine/splines/q_shared.h.orig Thu Feb 22 18:28:58 2007
++++ ./engine/splines/q_shared.h Mon Apr 16 23:59:20 2007
+@@ -189,7 +189,7 @@
+
+ // the mac compiler can't handle >32k of locals, so we
+ // just waste space and make big arrays static...
+-#ifdef __linux__
++#ifdef __unix__
+
+ // bk001205 - from Makefile
+ #define stricmp strcasecmp
diff --git a/games/evq3/files/patch-engine__splines__q_shared.hpp b/games/evq3/files/patch-engine__splines__q_shared.hpp
new file mode 100644
index 000000000000..2cfbab2ee5c7
--- /dev/null
+++ b/games/evq3/files/patch-engine__splines__q_shared.hpp
@@ -0,0 +1,11 @@
+--- ./engine/splines/q_shared.hpp.orig Thu Feb 22 18:28:58 2007
++++ ./engine/splines/q_shared.hpp Mon Apr 16 23:59:30 2007
+@@ -189,7 +189,7 @@
+
+ // the mac compiler can't handle >32k of locals, so we
+ // just waste space and make big arrays static...
+-#ifdef __linux__
++#ifdef __unix__
+
+ // bk001205 - from Makefile
+ #define stricmp strcasecmp
diff --git a/games/evq3/files/patch-engine__unix__linux_glimp.c b/games/evq3/files/patch-engine__unix__linux_glimp.c
new file mode 100644
index 000000000000..d644afd9acde
--- /dev/null
+++ b/games/evq3/files/patch-engine__unix__linux_glimp.c
@@ -0,0 +1,11 @@
+--- engine/unix/linux_glimp.c.orig Fri Apr 20 15:49:55 2007
++++ engine/unix/linux_glimp.c Fri Apr 20 15:54:09 2007
+@@ -2116,7 +2116,7 @@
+ // bk010216 - added stubs for non-Linux UNIXes here
+ // FIXME - use NO_JOYSTICK or something else generic
+
+-#if (defined( __FreeBSD__ ) || defined( __sun)) // rb010123
++#if defined( __sun) // rb010123
+ void IN_StartupJoystick( void ) {}
+ void IN_JoyMove( void ) {}
+ #endif
diff --git a/games/evq3/files/patch-engine__unix__linux_joystick.c b/games/evq3/files/patch-engine__unix__linux_joystick.c
index d821644c5390..5cd1e21f5fd8 100644
--- a/games/evq3/files/patch-engine__unix__linux_joystick.c
+++ b/games/evq3/files/patch-engine__unix__linux_joystick.c
@@ -1,93 +1,72 @@
---- ./engine/unix/linux_joystick.c.orig Wed Dec 20 20:28:48 2006
-+++ ./engine/unix/linux_joystick.c Sat Dec 23 11:06:55 2006
-@@ -31,8 +31,10 @@
- **
- */
+--- engine/unix/linux_joystick.c.orig Fri Apr 20 15:49:05 2007
++++ engine/unix/linux_joystick.c Fri Apr 20 15:49:05 2007
+@@ -32,7 +32,11 @@
+
+ #if !USE_SDL_VIDEO
--#ifndef __x86_64__
+#ifdef __linux__
#include <linux/joystick.h>
+#elif defined(__FreeBSD__)
+#include <sys/joystick.h>
- #endif
-
++#endif
#include <sys/types.h>
-@@ -72,7 +74,7 @@
- // bk001130 - from cvs1.17 (mkv), removed from linux_glimp.c
- void IN_StartupJoystick(void)
- {
--#ifndef __x86_64__
-+#if defined(__linux__) || defined(__FreeBSD__)
- int i = 0;
-
- joy_fd = -1;
-@@ -87,20 +89,27 @@
- {
- char filename[PATH_MAX];
+ #include <fcntl.h>
+ #include <sys/ioctl.h>
+@@ -83,19 +87,26 @@
+ for( i = 0; i < 4; i++ ) {
+ char filename[PATH_MAX];
+#ifdef __linux__
- snprintf(filename, PATH_MAX, "/dev/js%d", i);
+ snprintf( filename, PATH_MAX, "/dev/js%d", i );
+#elif defined(__FreeBSD__)
-+ snprintf(filename, PATH_MAX, "/dev/joy%d", i);
++ snprintf( filename, PATH_MAX, "/dev/joy%d", i );
+#endif
- joy_fd = open(filename, O_RDONLY | O_NONBLOCK);
+ joy_fd = open( filename, O_RDONLY | O_NONBLOCK );
- if(joy_fd != -1)
- {
+ if( joy_fd != -1 ) {
+#ifdef __linux__
- struct js_event event;
- char axes = 0;
- char buttons = 0;
- char name[128];
- int n = -1;
+ struct js_event event;
+ char axes = 0;
+ char buttons = 0;
+ char name[128];
+ int n = -1;
+#endif
- Com_Printf("Joystick %s found\n", filename);
+ Com_Printf( "Joystick %s found\n", filename );
+#ifdef __linux__
- /* Get rid of initialization messages. */
- do
- {
-@@ -125,6 +134,7 @@
- Com_Printf("Name: %s\n", name);
- Com_Printf("Axes: %d\n", axes);
- Com_Printf("Buttons: %d\n", buttons);
+ /* Get rid of initialization messages. */
+ do {
+ n = read( joy_fd, &event, sizeof( event ) );
+@@ -117,6 +128,7 @@
+ Com_Printf( "Name: %s\n", name );
+ Com_Printf( "Axes: %d\n", axes );
+ Com_Printf( "Buttons: %d\n", buttons );
+#endif
- /* Our work here is done. */
- return;
-@@ -143,7 +153,7 @@
-
- void IN_JoyMove(void)
- {
--#ifndef __x86_64__
-+#if defined(__linux__) || defined(__FreeBSD__)
- /* Store instantaneous joystick state. Hack to get around
- * event model used in Linux joystick driver.
- */
-@@ -156,11 +166,16 @@
- unsigned int axes = 0;
- int i = 0;
+ /* Our work here is done. */
+ return;
+@@ -144,10 +156,15 @@
+ unsigned int axes = 0;
+ int i = 0;
+#ifdef __FreeBSD__
+ struct joystick event;
+#endif
+
- if(joy_fd == -1)
- {
- return;
- }
+ if( joy_fd == -1 ) {
+ return;
+ }
+#ifdef __linux__
- /* Empty the queue, dispatching button presses immediately
+ /* Empty the queue, dispatching button presses immediately
* and updating the instantaneous state for the axes.
*/
-@@ -197,7 +212,19 @@
- }
+@@ -177,6 +194,19 @@
+
+ } while( 1 );
- } while(1);
--
+#elif defined(__FreeBSD__)
+ /*
+ * FreeBSD does not fully support multi-buttoned joysticks.
@@ -102,5 +81,5 @@
+ }
+#endif
- /* Translate our instantaneous state to bits. */
- for(i = 0; i < 16; i++)
+ /* Translate our instantaneous state to bits. */
+ for( i = 0; i < 16; i++ ) {
diff --git a/games/evq3/files/patch-engine__unix__linux_qgl.c b/games/evq3/files/patch-engine__unix__linux_qgl.c
new file mode 100644
index 000000000000..577458e68a64
--- /dev/null
+++ b/games/evq3/files/patch-engine__unix__linux_qgl.c
@@ -0,0 +1,13 @@
+--- engine/unix/linux_qgl.c.orig Fri Apr 20 15:49:55 2007
++++ engine/unix/linux_qgl.c Fri Apr 20 15:52:28 2007
+@@ -2672,8 +2672,10 @@
+ // placing a short delay before libGL is unloaded works around the problem.
+ // This delay is changable via the r_GLlibCoolDownMsec cvar (nice name
+ // huh?), and it defaults to 0. For me, 500 seems to work.
++#if 0
+ if( r_GLlibCoolDownMsec->integer )
+ usleep( r_GLlibCoolDownMsec->integer * 1000 );
++#endif
+
+ #if USE_SDL_VIDEO
+ SDL_QuitSubSystem(SDL_INIT_VIDEO);
diff --git a/games/evq3/files/patch-engine__unix__linux_snd.c b/games/evq3/files/patch-engine__unix__linux_snd.c
new file mode 100644
index 000000000000..5a5466c0b622
--- /dev/null
+++ b/games/evq3/files/patch-engine__unix__linux_snd.c
@@ -0,0 +1,14 @@
+--- ./engine/unix/linux_snd.c.orig Sat Dec 16 17:32:42 2006
++++ ./engine/unix/linux_snd.c Mon Apr 16 23:59:59 2007
+@@ -32,9 +32,8 @@
+ #include <sys/wait.h>
+ #ifdef __linux__ // rb0101023 - guard this
+ #include <linux/soundcard.h>
+-#endif
+-#ifdef __FreeBSD__ // rb0101023 - added
+-#include <sys/soundcard.h>
++#else
++#include <sys/soundcard.h> // rb0101023 - added
+ #endif
+ #include <stdio.h>
+
diff --git a/games/evq3/files/patch-engine__unix__unix_glw.h b/games/evq3/files/patch-engine__unix__unix_glw.h
new file mode 100644
index 000000000000..f21d11dba48e
--- /dev/null
+++ b/games/evq3/files/patch-engine__unix__unix_glw.h
@@ -0,0 +1,11 @@
+--- ./engine/unix/unix_glw.h.orig Sat Dec 16 17:32:42 2006
++++ ./engine/unix/unix_glw.h Tue Apr 17 00:00:09 2007
+@@ -19,7 +19,7 @@
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ ===========================================================================
+ */
+-#if !( defined __linux__ || defined __FreeBSD__ || defined __sun || defined MACOS_X )
++#if !( defined __unix__ || defined __sun || defined MACOS_X )
+ #error You should include this file only on Linux/FreeBSD/Solaris platforms
+ #endif
+
diff --git a/games/evq3/files/patch-engine__unix__unix_main.c b/games/evq3/files/patch-engine__unix__unix_main.c
index 49575df6b0c8..f279c3e1513f 100644
--- a/games/evq3/files/patch-engine__unix__unix_main.c
+++ b/games/evq3/files/patch-engine__unix__unix_main.c
@@ -1,92 +1,33 @@
---- engine/unix/unix_main.c.orig Sat Dec 23 14:57:28 2006
-+++ engine/unix/unix_main.c Sat Dec 23 15:47:40 2006
-@@ -673,12 +673,12 @@
- {
- void *libHandle;
- void (*dllEntry) (intptr_t (*syscallptr) (intptr_t, ...));
-- 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;
+--- engine/unix/unix_main.c.orig Fri Apr 20 23:34:22 2007
++++ engine/unix/unix_main.c Fri Apr 20 23:43:23 2007
+@@ -765,6 +765,7 @@
+ void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
+ char curpath[MAX_OSPATH];
+ char fname[MAX_OSPATH];
++ char *libpath;
+ char *basepath;
+ char *homepath;
+ char *pwdpath;
+@@ -776,10 +777,11 @@
+ assert( name );
-@@ -687,20 +687,7 @@
- // bk001206 - let's have some paranoia
- assert(name);
+ getcwd(curpath, sizeof(curpath));
+- snprintf (fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name);
++ snprintf (fname, sizeof(fname), "%s" DLL_EXT, name);
-- getcwd(curpath, sizeof(curpath));
--#if defined __i386__
-- snprintf(fname, sizeof(fname), "%si386.so", name);
--#elif defined __x86_64__
-- snprintf(fname, sizeof(fname), "%sx86_64.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);
+ // TODO: use fs_searchpaths from files.c
+ pwdpath = Sys_Cwd();
++ libpath = LIBDIR;
+ basepath = Cvar_VariableString( "fs_basepath" );
+ homepath = Cvar_VariableString( "fs_homepath" );
+ cdpath = Cvar_VariableString( "fs_cdpath" );
+@@ -789,6 +791,9 @@
- // bk001129 - was RTLD_LAZY
- #define Q_RTLD RTLD_NOW
-@@ -722,29 +709,34 @@
- fn = FS_BuildOSPath(homepath, gamedir, fname);
- Com_Printf("Sys_LoadDll(%s)... \n", fn);
- libHandle = dlopen(fn, Q_RTLD);
-+ }
-
-- if(!libHandle)
-- {
-- Com_Printf("Sys_LoadDll(%s) failed:\n\"%s\"\n", fn, dlerror());
-- // fs_basepath
-- fn = FS_BuildOSPath(basepath, gamedir, fname);
-- Com_Printf("Sys_LoadDll(%s)... \n", fn);
-- libHandle = dlopen(fn, Q_RTLD);
-+ if(!libHandle)
-+ {
-+ Com_Printf("Sys_LoadDll(%s) failed:\n\"%s\"\n", fn, dlerror());
-+ // libdir
-+ fn = FS_BuildOSPath(libdir, gamedir, fname);
-+ Com_Printf("Sys_LoadDll(%s)... \n", fn);
-+ libHandle = dlopen(fn, Q_RTLD);
-+ }
-
-- if(!libHandle)
-- {
--#ifndef NDEBUG // bk001206 - in debug abort on failure
-- Com_Error(ERR_FATAL, "Sys_LoadDll(%s) failed dlopen() completely!\n", name);
-+ if(!libHandle)
-+ {
-+ Com_Printf("Sys_LoadDll(%s) failed:\n\"%s\"\n", fn, dlerror());
-+ // fs_basepath
-+ fn = FS_BuildOSPath(basepath, gamedir, fname);
-+ Com_Printf("Sys_LoadDll(%s)... \n", fn);
-+ libHandle = dlopen(fn, Q_RTLD);
-+ }
+ if(!libHandle && homepath)
+ libHandle = try_dlopen(homepath, gamedir, fname, fqpath);
+
-+ if(!libHandle)
-+ {
-+#ifndef NDEBUG // bk001206 - in debug abort on failure
-+ Com_Error(ERR_FATAL, "Sys_LoadDll(%s) failed dlopen() completely!\n", name);
- #else
-- Com_Printf("Sys_LoadDll(%s) failed dlopen() completely!\n", name);
-+ Com_Printf("Sys_LoadDll(%s) failed dlopen() completely!\n", name);
- #endif
-- return NULL;
-- }
-- else
-- Com_Printf("Sys_LoadDll(%s): succeeded ...\n", fn);
-- }
-- else
-- Com_Printf("Sys_LoadDll(%s): succeeded ...\n", fn);
-+ return NULL;
- }
- else
- Com_Printf("Sys_LoadDll(%s): succeeded ...\n", fn);
++ if(!libHandle && libpath)
++ libHandle = try_dlopen(libpath, gamedir, fname, fqpath);
+
+ if(!libHandle && basepath)
+ libHandle = try_dlopen(basepath, gamedir, fname, fqpath);
diff --git a/games/evq3/files/patch-engine__unix__unix_shared.c b/games/evq3/files/patch-engine__unix__unix_shared.c
index 23a56a7fbb4f..b3cdaa1e09dd 100644
--- a/games/evq3/files/patch-engine__unix__unix_shared.c
+++ b/games/evq3/files/patch-engine__unix__unix_shared.c
@@ -1,29 +1,20 @@
---- ./engine/unix/unix_shared.c.orig Wed Dec 20 20:28:48 2006
-+++ ./engine/unix/unix_shared.c Sat Dec 23 11:21:39 2006
-@@ -78,7 +78,7 @@
+--- ./engine/unix/unix_shared.c.orig Sat Mar 31 20:25:26 2007
++++ ./engine/unix/unix_shared.c Tue Apr 17 00:00:39 2007
+@@ -76,7 +76,7 @@
return curtime;
}
--#if defined(__linux__) && !defined(DEDICATED)
-+#if defined(__unix__) && !defined(DEDICATED)
+-#if (defined(__linux__) || defined(__FreeBSD__) || defined(__sun)) && !defined(DEDICATED)
++#if (defined(__unix__) || defined(__sun)) && !defined(DEDICATED)
/*
================
Sys_XTimeToSysTime
-@@ -143,7 +143,7 @@
-
- //#if 0 // bk001215 - see snapvector.nasm for replacement
- // rcg010206 - using this for PPC builds...
--#if defined(__APPLE__) || (defined(__linux__) && defined(C_ONLY)) || defined(__x86_64__)
-+#if defined(__APPLE__) || (defined(__unix__) && defined(C_ONLY)) || defined(__x86_64__)
- //#if !(defined __i386__)
- long fastftol(float f)
- { // bk001213 - from win32/win_shared.c
-@@ -459,7 +459,7 @@
+@@ -441,7 +441,7 @@
return p->pw_name;
}
--#if defined(__linux__)
-+#if defined(__unix__)
+-#if defined(__linux__) || defined(__FreeBSD__)
++#ifdef __unix__
// TTimo
// sysconf() in libc, POSIX.1 compliant
- unsigned int Sys_ProcessorCount()
+ unsigned int Sys_ProcessorCount(void)
diff --git a/games/evq3/files/pkg-message.in b/games/evq3/files/pkg-message.in
deleted file mode 100644
index af8abddacd49..000000000000
--- a/games/evq3/files/pkg-message.in
+++ /dev/null
@@ -1,10 +0,0 @@
-==============================================================================
-
-Evolution Q3 has been installed.
-
-The program does not support loading QVM files in your architecture, so to
-play it you have to copy the files "game.so", "cgame.so" and "ui.so" installed
-by the "games/quake3" or "games/ioquake3" port from
-"%%PREFIX%%/lib/${PORTNAME}/baseq3" to "%%LIBDIR%%/baseq3".
-
-==============================================================================
diff --git a/games/evq3/pkg-plist b/games/evq3/pkg-plist
index 3786f8001155..09d06afa5f06 100644
--- a/games/evq3/pkg-plist
+++ b/games/evq3/pkg-plist
@@ -1,6 +1,11 @@
bin/evq3
+bin/evq3-server
+%%GAMELIBS%%%%LIBDIR%%/baseq3/cgame.so
%%LIBDIR%%/baseq3/pak-evq3.pk3
-%%PORTDOCS%%%%DOCSDIR%%/README.html
+%%GAMELIBS%%%%LIBDIR%%/baseq3/qagame.so
+%%GAMELIBS%%%%LIBDIR%%/baseq3/ui.so
+%%PORTDOCS%%%%DOCSDIR%%/ChangeLog.txt
+%%PORTDOCS%%%%DOCSDIR%%/FEATURES.txt
%%PORTDOCS%%@dirrm %%DOCSDIR%%
@dirrm %%LIBDIR%%/baseq3
@dirrm %%LIBDIR%%