aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--games/r1q2/Makefile117
-rw-r--r--games/r1q2/distinfo9
-rw-r--r--games/r1q2/files/patch-Makefile119
-rw-r--r--games/r1q2/files/patch-binaries__client__Makefile11
-rw-r--r--games/r1q2/files/patch-binaries__make.inc12
-rw-r--r--games/r1q2/files/patch-binaries__r1q2ded__Makefile11
-rw-r--r--games/r1q2/files/patch-binaries__ref_gl__Makefile11
-rw-r--r--games/r1q2/files/patch-client__cl_main.c29
-rw-r--r--games/r1q2/files/patch-client__menu.c18
-rw-r--r--games/r1q2/files/patch-client__qal.h13
-rw-r--r--games/r1q2/files/patch-client__snd_openal.h28
-rw-r--r--games/r1q2/files/patch-game__q_shared.c11
-rw-r--r--games/r1q2/files/patch-game__q_shared.h11
-rw-r--r--games/r1q2/files/patch-linux__al_linux.h11
-rw-r--r--games/r1q2/files/patch-linux__cd_linux.c319
-rw-r--r--games/r1q2/files/patch-linux__q_shlinux.c126
-rw-r--r--games/r1q2/files/patch-linux__snd_linux.c95
-rw-r--r--games/r1q2/files/patch-linux__sys_linux.c147
-rw-r--r--games/r1q2/files/patch-linux__vid_so.c40
-rw-r--r--games/r1q2/files/patch-qcommon__common.c20
-rw-r--r--games/r1q2/files/patch-qcommon__files.c121
-rw-r--r--games/r1q2/files/patch-qcommon__qcommon.h22
-rw-r--r--games/r1q2/files/patch-ref_gl__gl_local.h11
-rw-r--r--games/r1q2/files/patch-ref_gl__qgl.h11
-rw-r--r--games/r1q2/pkg-plist5
25 files changed, 410 insertions, 918 deletions
diff --git a/games/r1q2/Makefile b/games/r1q2/Makefile
index 545b5ff9018f..9a7868581fa4 100644
--- a/games/r1q2/Makefile
+++ b/games/r1q2/Makefile
@@ -6,40 +6,30 @@
#
PORTNAME= r1q2
-PORTVERSION= 6557
-PORTREVISION= 4
+PORTVERSION= 6908
CATEGORIES= games
MASTER_SITES= http://www.r1ch.net/stuff/r1q2/src/
DISTNAME= ${PORTNAME}-b${PORTVERSION}-src
-PATCH_SITES= ${MASTER_SITE_LOCAL}
-PATCH_SITE_SUBDIR= alepulver
-PATCHFILES= r1q2_diff.gz
-PATCH_DIST_STRIP= -p1
-
MAINTAINER= alepulver@FreeBSD.org
COMMENT= Enhaced Quake II client/server focusing on stability
LIB_DEPENDS= execinfo.1:${PORTSDIR}/devel/libexecinfo
USE_ZIP= yes
-USE_GCC= 3.2+
+USE_DOS2UNIX= yes
+USE_GCC= 3.4+
USE_GMAKE= yes
NO_WRKSUBDIR= yes
+BUILD_WRKSRC= ${WRKSRC}/binaries
+ALL_TARGET= #
-OPTIONS= CLIENT "Build OpenGL client" on \
+OPTIONS= CLIENT "Build client" on \
DEDICATED "Build dedicated server" on \
GAME "Build a main game .so file" off \
- GLX "Build OpenGL renderer" on \
- HTTP "Enable HTTP download support" on \
- OPENAL "Enable OpenAL support" on \
- OPTIMIZED_CFLAGS "Enable compilation optimizations" on \
- SDL "Build SDL client" on \
- SDLGL "Build SDL OpenGL renderer" on
-
-ALL_TARGET= release
+ REF_GL "Build renderer (required by CLIENT)" on
-MAKE_ENV= LIBDIR="${LIBDIR}"
+MAKE_ENV= LIBDIR="${LIBDIR}" PTHREAD_LIBS="${PTHREAD_LIBS}"
PLIST_SUB= LIBDIR="${LIBDIR:S/${PREFIX}\///}"
LIBDIR= ${PREFIX}/lib/${PORTNAME}
@@ -48,100 +38,71 @@ LIBDIR= ${PREFIX}/lib/${PORTNAME}
.include <bsd.port.pre.mk>
-.if !defined(WITHOUT_CLIENT) || !defined(WITHOUT_GLX)
-USE_GL= yes
-.endif
-
-.if !defined(WITHOUT_SDL) && !defined(WITHOUT_SDLGL)
-USE_SDL= sdl
-.endif
-
-.if !defined(WITHOUT_GLX) || !defined(WITHOUT_SDLGL)
-LIB_DEPENDS+= jpeg.9:${PORTSDIR}/graphics/jpeg \
- png.5:${PORTSDIR}/graphics/png
+.if defined(WITHOUT_CLIENT) && defined(WITHOUT_DEDICATED)
+IGNORE= needs at least one executable (CLIENT and DEDICATED)
.endif
.if !defined(WITHOUT_CLIENT)
-MAKE_ENV+= BUILD_CLIENT=YES
+ALL_TARGET+= client
PLIST_SUB+= CLIENT=""
-R1Q2_BIN+= r1q2
.else
PLIST_SUB+= CLIENT="@comment "
.endif
.if !defined(WITHOUT_DEDICATED)
-MAKE_ENV+= BUILD_DEDICATED=YES
+ALL_TARGET+= r1q2ded
PLIST_SUB+= DEDICATED=""
-R1Q2_BIN+= r1q2ded
.else
PLIST_SUB+= DEDICATED="@comment "
.endif
.if defined(WITH_GAME)
-MAKE_ENV+= BUILD_GAME=YES
+ALL_TARGET+= game
PLIST_SUB+= GAME=""
.else
PLIST_SUB+= GAME="@comment "
.endif
-.if !defined(WITHOUT_GLX)
-MAKE_ENV+= BUILD_GLX=YES
-PLIST_SUB+= GLX=""
-R1Q2_REF+= r1gl
-.else
-PLIST_SUB+= GLX="@comment "
-.endif
-
-.if !defined(WITHOUT_HTTP)
-LIB_DEPENDS+= curl.4:${PORTSDIR}/ftp/curl
-MAKE_ENV+= WITH_HTTP_DOWNLOAD_SUPPORT=YES
-.endif
-
-.if !defined(WITHOUT_OPENAL)
-LIB_DEPENDS+= openal.0:${PORTSDIR}/audio/openal
-MAKE_ENV+= WITH_OPENAL_SUPPORT=YES
-.endif
-
-.if !defined(WITHOUT_OPTIMIZED_CFLAGS)
-MAKE_ENV+= OPTIMIZED_CFLAGS=YES
-.endif
-
-.if !defined(WITHOUT_SDL)
-MAKE_ENV+= BUILD_SDL=YES
-PLIST_SUB+= SDL=""
-R1Q2_BIN+= r1q2-sdl
-.else
-PLIST_SUB+= SDL="@comment "
-.endif
-
-.if !defined(WITHOUT_SDLGL)
-MAKE_ENV+= BUILD_SDLGL=YES
-PLIST_SUB+= SDLGL=""
-R1Q2_REF+= r1sdl
+.if !defined(WITHOUT_REF_GL)
+USE_GL= yes
+USE_SDL= sdl
+LIB_DEPENDS+= jpeg.9:${PORTSDIR}/graphics/jpeg \
+ png.5:${PORTSDIR}/graphics/png
+ALL_TARGET+= ref_gl
+PLIST_SUB+= REF_GL=""
.else
-PLIST_SUB+= SDLGL="@comment "
+PLIST_SUB+= REF_GL="@comment "
.endif
-.if ${OSVERSION} < 500000
post-patch:
+ @${REINPLACE_CMD} -e 's|game$$(ARCH)|game|g' \
+ ${BUILD_WRKSRC}/game/Makefile
+.if ${OSVERSION} < 500000
@${REINPLACE_CMD} -e 's|<stdint\.h>|<inttypes.h>|' \
${WRKSRC}/game/q_shared.h
.endif
+pre-build:
+ @${FIND} ${BUILD_WRKSRC} -type d -depth 1 -exec ${MKDIR} {}/.depends \;
+
do-install:
-.for f in ${R1Q2_BIN}
- ${INSTALL_PROGRAM} ${WRKSRC}/quake2/${f} ${PREFIX}/bin
-.endfor
+.if !defined(WITHOUT_CLIENT)
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/client/quake2 \
+ ${PREFIX}/bin/${PORTNAME}
+.endif
+.if !defined(WITHOUT_DEDICATED)
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/r1q2ded/r1q2ded ${PREFIX}/bin
+.endif
${MKDIR} ${LIBDIR}/baseq2
-.for f in ${R1Q2_REF}
- ${INSTALL_PROGRAM} ${WRKSRC}/quake2/ref_${f}.so ${LIBDIR}
-.endfor
.if defined(WITH_GAME)
- ${INSTALL_PROGRAM} ${WRKSRC}/quake2/baseq2/game.so ${LIBDIR}/baseq2
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/game/game.so ${LIBDIR}/baseq2
+.endif
+.if !defined(WITHOUT_REF_GL)
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/ref_gl/ref_gl.so ${LIBDIR}
.endif
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
- ${INSTALL_DATA} ${WRKSRC}/readme.txt ${WRKSRC}/r1q2.txt ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/r1q2.txt ${WRKSRC}/readme.txt ${DOCSDIR}
.endif
.include <bsd.port.post.mk>
diff --git a/games/r1q2/distinfo b/games/r1q2/distinfo
index d8c09b9f0322..22e169ae6838 100644
--- a/games/r1q2/distinfo
+++ b/games/r1q2/distinfo
@@ -1,6 +1,3 @@
-MD5 (r1q2-b6557-src.zip) = 6a77951783bf1fdfa074fd98533eb25a
-SHA256 (r1q2-b6557-src.zip) = f0be6e8b9748ea4505bfe033c4f316319390b444fadc7239ebb65fe611944dd7
-SIZE (r1q2-b6557-src.zip) = 1094217
-MD5 (r1q2_diff.gz) = 3a75c1c00060fee1733fda1a893ee341
-SHA256 (r1q2_diff.gz) = 5e958cec37cfc9bf5f6b4b3c17ddd99c8e80a94b7e3c1f7e7671833bb89cde24
-SIZE (r1q2_diff.gz) = 73430
+MD5 (r1q2-b6908-src.zip) = e134feab8313f69ed4ac48da726c33f2
+SHA256 (r1q2-b6908-src.zip) = 30e57c23dafaaba9b91674d84955eb0d8db5dd091b9efefe893711433fda2ab6
+SIZE (r1q2-b6908-src.zip) = 1117270
diff --git a/games/r1q2/files/patch-Makefile b/games/r1q2/files/patch-Makefile
deleted file mode 100644
index 687d485294b7..000000000000
--- a/games/r1q2/files/patch-Makefile
+++ /dev/null
@@ -1,119 +0,0 @@
---- Makefile.orig Sat Jul 22 13:50:12 2006
-+++ Makefile Sat Jul 22 14:08:33 2006
-@@ -16,30 +16,30 @@
- #===============================#
- # Game Library #
- #===============================#
--BUILD_GAME=YES
-+#BUILD_GAME=YES
-
- #===============================#
- # Quake 2 dedicated server only #
- #===============================#
--BUILD_DEDICATED=YES
-+#BUILD_DEDICATED=YES
-
- #===============================#
- # Quake 2 SDL Options #
- # Uses SDL for cdrom and sound #
- # SDL OpenGL ref library #
- #===============================#
--BUILD_SDL=YES
--BUILD_SDLGL=YES
-+#BUILD_SDL=YES
-+#BUILD_SDLGL=YES
-
- #===============================#
- # HTTP download stuff #
- #===============================#
--WITH_HTTP_DOWNLOAD_SUPPORT=YES
-+#WITH_HTTP_DOWNLOAD_SUPPORT=YES
-
- #===============================#
- # OpenAL stuff #
- #===============================#
--WITH_OPENAL_SUPPORT=YES
-+#WITH_OPENAL_SUPPORT=YES
-
- #===============================#
- # CD Audio #
-@@ -61,18 +61,21 @@
- REF_GL_DIR=$(MOUNT_DIR)/ref_gl
- SERVER_DIR=$(MOUNT_DIR)/server
-
--CC=gcc
-+CC?=gcc
-
--BASE_CFLAGS= -DLINUX -ffloat-store
--RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O2 -ffast-math -funroll-loops -fno-strict-aliasing
-+BASE_CFLAGS=$(CFLAGS) -DDATADIR='\"$(Q2DIR)\"' -DLIBDIR='\"$(LIBDIR)\"' -I$(LOCALBASE)/include -I$(X11BASE)/include -DLINUX -ffloat-store
-+RELEASE_CFLAGS=$(BASE_CFLAGS)
-
--ifeq ($(ARCH),i386)
-- RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2
-+ifdef OPTIMIZED_CFLAGS
-+RELEASE_CFLAGS+=-DNDEBUG -O2 -ffast-math -funroll-loops -fno-strict-aliasing
-+ ifeq ($(ARCH),i386)
-+RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2
-+ endif
- endif
-
- DEBUG_CFLAGS=$(BASE_CFLAGS) -g -ggdb -Wall -pipe
-
--LDFLAGS+=-lm -lz
-+LDFLAGS+=-L$(LOCALBASE)/lib -L$(X11BASE)/lib -lm -lz
-
- ifeq ($(OSTYPE),Linux)
- LDFLAGS+=-ldl
-@@ -91,16 +94,16 @@
- endif
-
- ifeq ($(strip $(WITH_HTTP_DOWNLOAD_SUPPORT)),YES)
--#LDFLAGS+= -lcurl
--LDFLAGS+= /usr/local/lib/libcurl.a # Statically linked, note the path, if curl is not installed in your system,
-+LDFLAGS+= -lcurl
-+#LDFLAGS+= /usr/local/lib/libcurl.a # Statically linked, note the path, if curl is not installed in your system,
- # set to NO in the build options
- BASE_CFLAGS+= -DUSE_CURL
- endif
-
--GLXLDFLAGS=-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lGL -lpng -ljpeg
-+GLXLDFLAGS=-L$(LOCALBASE)/lib -L$(X11BASE)/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lGL -lpng -ljpeg
-
--SDLCFLAGS=$(shell sdl-config --cflags)
--SDLLDFLAGS=$(shell sdl-config --libs)
-+SDLCFLAGS=$(shell $(SDL_CONFIG) --cflags)
-+SDLLDFLAGS=$(shell $(SDL_CONFIG) --libs)
- SDLGLCFLAGS=$(SDLCFLAGS) -DOPENGL
- SDLGLLDFLAGS=$(SDLLDFLAGS)
-
-@@ -118,11 +121,16 @@
- # SETUP AND BUILD
- #############################################################################
-
--TARGETS=$(BINDIR)/r1q2 \
-- $(BINDIR)/ref_r1gl.$(SHLIBEXT)
--
-+ifeq ($(strip $(BUILD_CLIENT)),YES)
-+TARGETS+=$(BINDIR)/r1q2
-+endif
-+
-+ifeq ($(strip $(BUILD_GLX)),YES)
-+TARGETS+=$(BINDIR)/ref_r1gl.$(SHLIBEXT)
-+endif
-+
- ifeq ($(strip $(BUILD_GAME)),YES)
-- TARGETS+=$(BINDIR)/baseq2/game$(ARCH).$(SHLIBEXT)
-+TARGETS+=$(BINDIR)/baseq2/game.$(SHLIBEXT)
- endif
-
- ifeq ($(strip $(BUILD_DEDICATED)),YES)
-@@ -618,7 +626,7 @@
- $(BUILDDIR)/objects/game/p_weapon.o \
- $(BUILDDIR)/objects/game/m_flash.o
-
--$(BINDIR)/baseq2/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
-+$(BINDIR)/baseq2/game.$(SHLIBEXT) : $(GAME_OBJS)
- $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
-
- $(BUILDDIR)/objects/game/g_ai.o : $(GAME_DIR)/g_ai.c
diff --git a/games/r1q2/files/patch-binaries__client__Makefile b/games/r1q2/files/patch-binaries__client__Makefile
new file mode 100644
index 000000000000..f25cafc29fec
--- /dev/null
+++ b/games/r1q2/files/patch-binaries__client__Makefile
@@ -0,0 +1,11 @@
+--- binaries/client/Makefile.orig Thu Dec 21 14:55:31 2006
++++ binaries/client/Makefile Fri Dec 22 00:38:19 2006
+@@ -24,7 +24,7 @@
+
+ include ../make.inc
+
+-LDFLAGS+=-lm -lz
++LDFLAGS+=-lm -lz $(PTHREAD_LIBS)
+
+ ifeq ($(shell uname),Linux)
+ LDFLAGS+=-ldl
diff --git a/games/r1q2/files/patch-binaries__make.inc b/games/r1q2/files/patch-binaries__make.inc
new file mode 100644
index 000000000000..8bb7235b2188
--- /dev/null
+++ b/games/r1q2/files/patch-binaries__make.inc
@@ -0,0 +1,12 @@
+--- ./binaries/make.inc.orig Sat Sep 16 16:16:38 2006
++++ ./binaries/make.inc Sat Dec 16 17:28:37 2006
+@@ -1,7 +1,8 @@
+ #turol: for some reason -ffast-math causes strange errors
+ #and it's not really any faster
+-CFLAGS+=-DNDEBUG -DLINUX -O2 -fno-strict-aliasing -Wall -ffloat-store -pipe -g -MF .depends/$*.d -MMD
++CFLAGS+=-I$(LOCALBASE)/include -I$(X11BASE)/include -DNDEBUG -DLINUX -DDATADIR='"$(Q2DIR)"' -DLIBDIR='"$(LIBDIR)"' -O2 -fno-strict-aliasing -Wall -ffloat-store -pipe -g -MF .depends/$*.d -MMD
+ ALLOBJ:=$(ALLSRC:.c=.o)
++LDFLAGS+=-L$(LOCALBASE)/lib -L$(X11BASE)/lib
+
+ .PHONY: clean distclean
+
diff --git a/games/r1q2/files/patch-binaries__r1q2ded__Makefile b/games/r1q2/files/patch-binaries__r1q2ded__Makefile
new file mode 100644
index 000000000000..56ad66a3a2cb
--- /dev/null
+++ b/games/r1q2/files/patch-binaries__r1q2ded__Makefile
@@ -0,0 +1,11 @@
+--- ./binaries/r1q2ded/Makefile.orig Mon Oct 30 15:26:12 2006
++++ ./binaries/r1q2ded/Makefile Sat Dec 16 17:28:37 2006
+@@ -15,7 +15,7 @@
+
+ default: r1q2ded
+
+-LDFLAGS=-lm -lz
++LDFLAGS+=-lm -lz
+
+ ifeq ($(shell uname),Linux)
+ LDFLAGS+=-ldl
diff --git a/games/r1q2/files/patch-binaries__ref_gl__Makefile b/games/r1q2/files/patch-binaries__ref_gl__Makefile
new file mode 100644
index 000000000000..c27fe753cec0
--- /dev/null
+++ b/games/r1q2/files/patch-binaries__ref_gl__Makefile
@@ -0,0 +1,11 @@
+--- ./binaries/ref_gl/Makefile.orig Mon Oct 30 15:26:12 2006
++++ ./binaries/ref_gl/Makefile Sat Dec 16 17:41:23 2006
+@@ -17,7 +17,7 @@
+
+ include ../make.inc
+
+-LDFLAGS+=$(shell sdl-config --libs) -lm -lGL -ljpeg -lpng12
++LDFLAGS+=$(shell sdl-config --libs) -lm -lGL -ljpeg -lpng
+
+ ref_gl.so: $(ref_gl_OBJ)
+ $(CC) -shared -g -o $@ $^ $(LDFLAGS)
diff --git a/games/r1q2/files/patch-client__cl_main.c b/games/r1q2/files/patch-client__cl_main.c
deleted file mode 100644
index edb0c1245813..000000000000
--- a/games/r1q2/files/patch-client__cl_main.c
+++ /dev/null
@@ -1,29 +0,0 @@
---- ./client/cl_main.c.orig Wed May 17 22:21:33 2006
-+++ ./client/cl_main.c Wed May 17 22:27:30 2006
-@@ -3629,7 +3629,7 @@
- //jec - updates all input events
-
- void CL_RefreshCmd (void);
--#if (defined JOYSTICK) || (defined LINUX)
-+#if (defined JOYSTICK) || (defined __unix__)
- extern void IN_Commands (void);
- #endif
- void CL_RefreshInputs (void)
-@@ -3637,7 +3637,7 @@
- // process new key events
- Sys_SendKeyEvents ();
-
--#if (defined JOYSTICK) || (defined LINUX)
-+#if (defined JOYSTICK) || (defined __unix__)
- // process mice & joystick events
- IN_Commands ();
- #endif
-@@ -4032,7 +4032,7 @@
- Cbuf_Execute ();
-
- Con_Init ();
--#if defined __linux__ || defined __sgi || defined __FreeBSD__
-+#if defined __unix__ || defined __sgi
- S_Init (true);
-
- VID_Init ();
diff --git a/games/r1q2/files/patch-client__menu.c b/games/r1q2/files/patch-client__menu.c
index 1334a53aff66..4ea8f799db7b 100644
--- a/games/r1q2/files/patch-client__menu.c
+++ b/games/r1q2/files/patch-client__menu.c
@@ -1,10 +1,10 @@
---- client/menu.c.orig Wed Jan 4 05:16:38 2006
-+++ client/menu.c Sat May 20 13:45:54 2006
+--- ./client/menu.c.orig Fri May 26 00:46:34 2006
++++ ./client/menu.c Sat Dec 16 17:28:37 2006
@@ -587,6 +587,7 @@
- {
- {"+attack", "attack"},
- {"weapnext", "next weapon"},
-+{"weapprev", "previous weapon"},
- {"+forward", "walk forward"},
- {"+back", "backpedal"},
- {"+left", "turn left"},
+ {
+ {"+attack", "attack"},
+ {"weapnext", "next weapon"},
++{"weapprev", "prev weapon"},
+ {"+forward", "walk forward"},
+ {"+back", "backpedal"},
+ {"+left", "turn left"},
diff --git a/games/r1q2/files/patch-client__qal.h b/games/r1q2/files/patch-client__qal.h
deleted file mode 100644
index f65a12056783..000000000000
--- a/games/r1q2/files/patch-client__qal.h
+++ /dev/null
@@ -1,13 +0,0 @@
---- client/qal.h.orig Sat Jun 26 15:20:12 2004
-+++ client/qal.h Thu May 18 20:40:19 2006
-@@ -22,6 +22,10 @@
- #ifndef __QAL_H__
- #define __QAL_H__
-
-+#undef ALCAPI
-+#define ALCAPI
-+#undef ALAPI
-+#define ALAPI
-
- qboolean QAL_Init (const char *driver);
- void QAL_Shutdown (void);
diff --git a/games/r1q2/files/patch-client__snd_openal.h b/games/r1q2/files/patch-client__snd_openal.h
deleted file mode 100644
index 8a5c555b45f3..000000000000
--- a/games/r1q2/files/patch-client__snd_openal.h
+++ /dev/null
@@ -1,28 +0,0 @@
---- client/snd_openal.h.orig Mon Dec 5 21:03:34 2005
-+++ client/snd_openal.h Thu May 18 20:09:05 2006
-@@ -3,7 +3,6 @@
- #ifdef USE_OPENAL
- #include <AL/al.h>
- #include <AL/alc.h>
--#include <AL/altypes.h>
-
- #include "client.h"
-
-@@ -14,7 +13,7 @@
- #ifdef _WIN32
- #include "../win32/alw_win.h"
- #endif
--#ifdef __linux__
-+#ifdef __unix__
- #include "../linux/al_linux.h"
- #endif
- #endif
-@@ -158,7 +157,7 @@
- #define ALimp_Shutdown ALW_Shutdown
-
- #else
--#ifdef __linux__
-+#ifdef __unix__
-
- #define AL_DRIVER_OPENAL "/usr/lib/libopenal.so"
-
diff --git a/games/r1q2/files/patch-game__q_shared.c b/games/r1q2/files/patch-game__q_shared.c
deleted file mode 100644
index 276de6bbce50..000000000000
--- a/games/r1q2/files/patch-game__q_shared.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./game/q_shared.c.orig Wed May 17 22:21:33 2006
-+++ ./game/q_shared.c Wed May 17 22:28:01 2006
-@@ -421,7 +421,7 @@
- Returns 1, 2, or 1 + 2
- ==================
- */
--#if !id386 || defined __linux__ || defined __FreeBSD__
-+#if !id386 || defined __unix__
- int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
- {
- float dist1, dist2;
diff --git a/games/r1q2/files/patch-game__q_shared.h b/games/r1q2/files/patch-game__q_shared.h
deleted file mode 100644
index ef2c67513e30..000000000000
--- a/games/r1q2/files/patch-game__q_shared.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./game/q_shared.h.orig Wed May 17 22:21:33 2006
-+++ ./game/q_shared.h Wed May 17 22:28:23 2006
-@@ -315,7 +315,7 @@
- //float Q_fabs (float f);
- //#define fabs(f) Q_fabs(f)
- //extern int sse2_enabled;
--#if !defined C_ONLY && !defined __linux__ && !defined __sgi && !defined SSE2 && !defined __FreeBSD__
-+#if !defined C_ONLY && !defined __unix__ && !defined __sgi && !defined SSE2
- //extern void __cdecl Q_sseinit (void);
- void __cdecl Q_ftol2( float f, int *out );
- int __cdecl Q_ftol( float f );
diff --git a/games/r1q2/files/patch-linux__al_linux.h b/games/r1q2/files/patch-linux__al_linux.h
deleted file mode 100644
index aa4904d71dd7..000000000000
--- a/games/r1q2/files/patch-linux__al_linux.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./linux/al_linux.h.orig Sat Sep 24 16:18:00 2005
-+++ ./linux/al_linux.h Wed May 17 22:28:37 2006
-@@ -23,7 +23,7 @@
- #define __AL_LINUX_H__
-
-
--#ifndef __linux__
-+#ifndef __unix__
- #error "You should not be including this file on this platform"
- #endif
-
diff --git a/games/r1q2/files/patch-linux__cd_linux.c b/games/r1q2/files/patch-linux__cd_linux.c
deleted file mode 100644
index 8639ead1d186..000000000000
--- a/games/r1q2/files/patch-linux__cd_linux.c
+++ /dev/null
@@ -1,319 +0,0 @@
---- ./linux/cd_linux.c.orig Wed May 17 22:21:33 2006
-+++ ./linux/cd_linux.c Wed May 17 22:42:46 2006
-@@ -13,7 +13,12 @@
- #include <time.h>
- #include <errno.h>
-
-+#ifdef __FreeBSD__
-+#include <sys/cdio.h>
-+#define CDROM_DATA_TRACK 4
-+#else
- #include <linux/cdrom.h>
-+#endif
-
- #include "../client/client.h"
-
-@@ -43,8 +48,13 @@
- if (cdfile == -1 || !enabled)
- return; // no cd init'd
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOCEJECT) == -1)
-+ Com_DPrintf ("ioctl cdioceject failed\n");
-+#else
- if ( ioctl(cdfile, CDROMEJECT) == -1 )
- Com_DPrintf("ioctl cdromeject failed\n");
-+#endif
- }
-
-
-@@ -53,30 +63,53 @@
- if (cdfile == -1 || !enabled)
- return; // no cd init'd
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOCCLOSE) == -1)
-+ Com_DPrintf ("ioctl cdiocclose failed\n");
-+#else
- if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 )
- Com_DPrintf("ioctl cdromclosetray failed\n");
-+#endif
- }
-
- static int CDAudio_GetAudioDiskInfo(void)
- {
-+#ifdef __FreeBSD__
-+ struct ioc_toc_header tochdr;
-+#else
- struct cdrom_tochdr tochdr;
-+#endif
-
- cdValid = false;
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1)
-+ {
-+ Com_DPrintf ("ioctl cdioreadtocheader failed\n");
-+#else
- if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 )
- {
- Com_DPrintf("ioctl cdromreadtochdr failed\n");
-+#endif
- return -1;
- }
-
-+#ifdef __FreeBSD__
-+ if (tochdr.starting_track < 1)
-+#else
- if (tochdr.cdth_trk0 < 1)
-+#endif
- {
- Com_DPrintf("CDAudio: no music tracks\n");
- return -1;
- }
-
- cdValid = true;
-+#ifdef __FreeBSD__
-+ maxTrack = tochdr.ending_track;
-+#else
- maxTrack = tochdr.cdth_trk1;
-+#endif
-
- return 0;
- }
-@@ -84,8 +117,14 @@
-
- void CDAudio_Play(int track, qboolean looping)
- {
-+#ifdef __FreeBSD__
-+ struct ioc_read_toc_entry entry;
-+ struct cd_toc_entry toc_buffer;
-+ struct ioc_play_track ti;
-+#else
- struct cdrom_tocentry entry;
- struct cdrom_ti ti;
-+#endif
-
- if (cdfile == -1 || !enabled)
- return;
-@@ -105,6 +144,20 @@
- return;
- }
-
-+#ifdef __FreeBSD__
-+ bzero((char *)&toc_buffer, sizeof(toc_buffer));
-+ entry.data_len = sizeof(toc_buffer);
-+ entry.data = &toc_buffer;
-+ // don't try to play a non-audio track
-+ entry.starting_track = track;
-+ entry.address_format = CD_MSF_FORMAT;
-+ if ( ioctl(cdfile, CDIOREADTOCENTRYS, &entry) == -1 )
-+ {
-+ Com_DPrintf("ioctl cdromreadtocentry failed\n");
-+ return;
-+ }
-+ if (toc_buffer.control == CDROM_DATA_TRACK)
-+#else
- // don't try to play a non-audio track
- entry.cdte_track = track;
- entry.cdte_format = CDROM_MSF;
-@@ -114,6 +167,7 @@
- return;
- }
- if (entry.cdte_ctrl == CDROM_DATA_TRACK)
-+#endif
- {
- Com_Printf("CDAudio: track %i is not audio\n", LOG_CLIENT, track);
- return;
-@@ -126,19 +180,37 @@
- CDAudio_Stop();
- }
-
-+#ifdef __FreeBSD__
-+ ti.start_track = track;
-+ ti.end_track = track;
-+ ti.start_index = 1;
-+ ti.end_index = 99;
-+#else
- ti.cdti_trk0 = track;
- ti.cdti_trk1 = track;
- ti.cdti_ind0 = 1;
- ti.cdti_ind1 = 99;
-+#endif
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1)
-+ {
-+ Com_DPrintf ("ioctl cdiocplaytracks failed\n");
-+#else
- if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 )
- {
- Com_DPrintf("ioctl cdromplaytrkind failed\n");
-+#endif
- return;
- }
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOCRESUME) == -1)
-+ Com_DPrintf ("ioctl cdiocresume failed\n");
-+#else
- if ( ioctl(cdfile, CDROMRESUME) == -1 )
- Com_DPrintf("ioctl cdromresume failed\n");
-+#endif
-
- playLooping = looping;
- playTrack = track;
-@@ -153,8 +225,14 @@
- int track, i = 0, free_tracks = 0, remap_track;
- float f;
- byte *track_bools;
-+#ifdef __FreeBSD__
-+ struct ioc_read_toc_entry entry;
-+ struct cd_toc_entry toc_buffer;
-+ struct ioc_play_track ti;
-+#else
- struct cdrom_tocentry entry;
- struct cdrom_ti ti;
-+#endif
-
- if (cdfile == -1 || !enabled)
- return;
-@@ -167,13 +245,25 @@
- // create array of available audio tracknumbers
-
- for (; i < maxTrack; i++) {
-+#ifdef __FreeBSD__
-+ bzero((char *)&toc_buffer, sizeof(toc_buffer));
-+ entry.data_len = sizeof(toc_buffer);
-+ entry.data = &toc_buffer;
-+ // don't try to play a non-audio track
-+ entry.starting_track = remap[i];
-+ entry.address_format = CD_LBA_FORMAT;
-+ if (ioctl(cdfile, CDIOREADTOCENTRYS, &entry) == -1)
-+ track_bools[i] = 0;
-+ else
-+ track_bools[i] = (toc_buffer.control != CDROM_DATA_TRACK);
-+#else
- entry.cdte_track = remap[i];
- entry.cdte_format = CDROM_LBA;
- if (ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1) {
- track_bools[i] = 0;
- } else
- track_bools[i] = (entry.cdte_ctrl != CDROM_DATA_TRACK);
--
-+#endif
- free_tracks += track_bools[i];
- }
-
-@@ -197,12 +287,23 @@
- }
- CDAudio_Stop();
- }
-+#ifdef __FreeBSD__
-+ ti.start_track = remap_track;
-+ ti.end_track = remap_track;
-+ ti.start_index = 0;
-+ ti.end_index = 0;
-+#else
- ti.cdti_trk0 = remap_track;
- ti.cdti_trk1 = remap_track;
- ti.cdti_ind0 = 0;
- ti.cdti_ind1 = 0;
-+#endif
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1) {
-+#else
- if (ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1) {
-+#endif
- track_bools[track] = 0;
- free_tracks--;
- } else {
-@@ -227,8 +328,13 @@
- if (!playing)
- return;
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOCSTOP) == -1)
-+ Com_DPrintf ("ioctl cdiocstop failed (%d)\n", errno);
-+#else
- if ( ioctl(cdfile, CDROMSTOP) == -1 )
- Com_DPrintf("ioctl cdromstop failed (%d)\n", errno);
-+#endif
-
- wasPlaying = false;
- playing = false;
-@@ -242,8 +348,13 @@
- if (!playing)
- return;
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOCPAUSE) == -1)
-+ Com_DPrintf ("ioctl cdiocpause failed\n");
-+#else
- if ( ioctl(cdfile, CDROMPAUSE) == -1 )
- Com_DPrintf("ioctl cdrompause failed\n");
-+#endif
-
- wasPlaying = playing;
- playing = false;
-@@ -261,8 +372,13 @@
- if (!wasPlaying)
- return;
-
-+#ifdef __FreeBSD__
-+ if (ioctl(cdfile, CDIOCRESUME) == -1)
-+ Com_DPrintf ("ioctl cdiocresume failed\n");
-+#else
- if ( ioctl(cdfile, CDROMRESUME) == -1 )
- Com_DPrintf("ioctl cdromresume failed\n");
-+#endif
- playing = true;
- }
-
-@@ -391,7 +507,12 @@
-
- void CDAudio_Update(void)
- {
-+#ifdef __FreeBSD__
-+ struct ioc_read_subchannel subchnl;
-+ struct cd_sub_channel_info data;
-+#else
- struct cdrom_subchnl subchnl;
-+#endif
- static time_t lastchk;
-
- if (cdfile == -1 || !enabled)
-@@ -415,6 +536,24 @@
-
- if (playing && lastchk < time(NULL)) {
- lastchk = time(NULL) + 2; //two seconds between chks
-+#if defined(__FreeBSD__)
-+ subchnl.address_format = CD_MSF_FORMAT;
-+ subchnl.data_format = CD_CURRENT_POSITION;
-+ subchnl.data_len = sizeof(data);
-+ subchnl.track = playTrack;
-+ subchnl.data = &data;
-+ if (ioctl(cdfile, CDIOCREADSUBCHANNEL, &subchnl) == -1 ) {
-+ Com_DPrintf("ioctl cdiocreadsubchannel failed\n");
-+ playing = false;
-+ return;
-+ }
-+ if (subchnl.data->header.audio_status != CD_AS_PLAY_IN_PROGRESS &&
-+ subchnl.data->header.audio_status != CD_AS_PLAY_PAUSED) {
-+ playing = false;
-+ if (playLooping)
-+ CDAudio_Play(playTrack, true);
-+ }
-+#else
- subchnl.cdsc_format = CDROM_MSF;
- if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) {
- Com_DPrintf("ioctl cdromsubchnl failed\n");
-@@ -427,6 +566,7 @@
- if (playLooping)
- CDAudio_Play(playTrack, true);
- }
-+#endif
- }
- }
-
diff --git a/games/r1q2/files/patch-linux__q_shlinux.c b/games/r1q2/files/patch-linux__q_shlinux.c
index dbefc8dded25..29220bdf5696 100644
--- a/games/r1q2/files/patch-linux__q_shlinux.c
+++ b/games/r1q2/files/patch-linux__q_shlinux.c
@@ -1,65 +1,65 @@
---- linux/q_shlinux.c.orig Sat Feb 19 22:17:58 2005
-+++ linux/q_shlinux.c Fri May 19 20:26:48 2006
+--- ./linux/q_shlinux.c.orig Mon Oct 30 15:11:00 2006
++++ ./linux/q_shlinux.c Sat Dec 16 17:28:37 2006
@@ -12,25 +12,23 @@
-
- #include "../qcommon/qcommon.h"
-
-+#ifndef __linux__
-+#include <machine/param.h>
-+#endif
-+
- //===============================================================================
-
- byte *membase;
- int maxhunksize;
- int curhunksize;
-
--#ifdef __FreeBSD__
--#define MMAP_ANON MAP_ANON
--#else
--#define MMAP_ANON MAP_ANONYMOUS
--#endif
--
- void *Hunk_Begin (int maxsize)
- {
- // reserve a huge chunk of memory, but don't commit any yet
- maxhunksize = maxsize + sizeof(int);
- curhunksize = 0;
- membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE,
-- MAP_PRIVATE|MMAP_ANON, -1, 0);
-+ MAP_PRIVATE|MAP_ANON, -1, 0);
- if (membase == NULL || membase == (byte *)-1)
- Sys_Error("unable to virtual allocate %d bytes", maxsize);
-
+
+ #include "../qcommon/qcommon.h"
+
++#ifndef __linux__
++#include <machine/param.h>
++#endif
++
+ //===============================================================================
+
+ byte *membase;
+ int maxhunksize;
+ int curhunksize;
+
+-#ifdef __FreeBSD__
+-#define MMAP_ANON MAP_ANON
+-#else
+-#define MMAP_ANON MAP_ANONYMOUS
+-#endif
+-
+ void *Hunk_Begin (int maxsize)
+ {
+ // reserve a huge chunk of memory, but don't commit any yet
+ maxhunksize = maxsize + sizeof(int);
+ curhunksize = 0;
+ membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE,
+- MAP_PRIVATE|MMAP_ANON, -1, 0);
++ MAP_PRIVATE|MAP_ANON, -1, 0);
+ if (membase == NULL || membase == (byte *)-1)
+ Sys_Error("unable to virtual allocate %d bytes", maxsize);
+
@@ -54,14 +52,29 @@
-
- int Hunk_End (void)
- {
--#ifndef __FreeBSD__
- byte *n;
-
-+#ifndef __linux__
-+ size_t old_size = maxhunksize;
-+ size_t new_size = curhunksize + sizeof(int);
-+ void * unmap_base;
-+ size_t unmap_len;
-+
-+ new_size = round_page(new_size);
-+ old_size = round_page(old_size);
-+ if (new_size > old_size)
-+ n = 0; /* error */
-+ else if (new_size < old_size) {
-+ unmap_base = (caddr_t)(membase + new_size);
-+ unmap_len = old_size - new_size;
-+ n = munmap(unmap_base, unmap_len) + membase;
-+ }
-+#else
- n = mremap(membase, maxhunksize, curhunksize + sizeof(int), 0);
-+#endif
- if (n != membase)
- Sys_Error("Hunk_End: Could not remap virtual block (%d)", errno);
- *((int *)membase) = curhunksize + sizeof(int);
--#endif
-
- return curhunksize;
- }
+
+ int Hunk_End (void)
+ {
+-#ifndef __FreeBSD__
+ byte *n;
+
++#ifndef __linux__
++ size_t old_size = maxhunksize;
++ size_t new_size = curhunksize + sizeof(int);
++ void * unmap_base;
++ size_t unmap_len;
++
++ new_size = round_page(new_size);
++ old_size = round_page(old_size);
++ if (new_size > old_size)
++ n = 0; /* error */
++ else if (new_size < old_size) {
++ unmap_base = (caddr_t)(membase + new_size);
++ unmap_len = old_size - new_size;
++ n = munmap(unmap_base, unmap_len) + membase;
++ }
++#else
+ n = mremap(membase, maxhunksize, curhunksize + sizeof(int), 0);
++#endif
+ if (n != membase)
+ Sys_Error("Hunk_End: Could not remap virtual block (%d)", errno);
+ *((int *)membase) = curhunksize + sizeof(int);
+-#endif
+
+ return curhunksize;
+ }
diff --git a/games/r1q2/files/patch-linux__snd_linux.c b/games/r1q2/files/patch-linux__snd_linux.c
index 2111ecd7670f..8cb16f61f8f3 100644
--- a/games/r1q2/files/patch-linux__snd_linux.c
+++ b/games/r1q2/files/patch-linux__snd_linux.c
@@ -1,12 +1,83 @@
---- ./linux/snd_linux.c.orig Wed May 17 22:21:33 2006
-+++ ./linux/snd_linux.c Wed May 17 22:28:57 2006
-@@ -8,8 +8,7 @@
- #include <sys/wait.h>
- #if defined (__linux__)
- #include <linux/soundcard.h>
--#endif
--#if defined (__FreeBSD__)
-+#else
- #include <sys/soundcard.h>
- #endif
- #include <stdio.h>
+--- linux/snd_linux.c.orig Thu Dec 21 14:55:31 2006
++++ linux/snd_linux.c Thu Dec 21 14:56:41 2006
+@@ -6,7 +6,11 @@
+ #include <sys/mman.h>
+ #include <sys/shm.h>
+ #include <sys/wait.h>
++#ifdef __linux__
+ #include <linux/soundcard.h>
++#else
++#include <sys/soundcard.h>
++#endif
+ #include <stdio.h>
+
+ #include "../client/client.h"
+@@ -82,14 +86,6 @@
+ return false;
+ }
+
+- if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1)
+- {
+- perror("GETOSPACE");
+- Com_Printf("Um, can't do GETOSPACE?\n", LOG_CLIENT);
+- close(audio_fd);
+- return 0;
+- }
+-
+ // set sample bits & speed
+
+ dma.samplebits = (int)sndbits->value;
+@@ -113,22 +109,6 @@
+ dma.channels = (int)sndchannels->value;
+ if (dma.channels < 1 || dma.channels > 2)
+ dma.channels = 2;
+-
+- dma.samples = info.fragstotal * info.fragsize / (dma.samplebits/8);
+- dma.submission_chunk = 1;
+-
+-// memory map the dma buffer
+-
+- if (!dma.buffer)
+- dma.buffer = (unsigned char *) mmap(NULL, info.fragstotal
+- * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
+- if (!dma.buffer)
+- {
+- perror(snddevice->string);
+- Com_Printf("Could not mmap %s\n", LOG_CLIENT, snddevice->string);
+- close(audio_fd);
+- return false;
+- }
+
+ tmp = 0;
+ if (dma.channels == 2)
+@@ -183,6 +163,30 @@
+ {
+ perror(snddevice->string);
+ Com_Printf("%d-bit sound not supported.", LOG_CLIENT, dma.samplebits);
++ close(audio_fd);
++ return false;
++ }
++
++ if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1)
++ {
++ perror("GETOSPACE");
++ Com_Printf("Um, can't do GETOSPACE?\n", LOG_CLIENT);
++ close(audio_fd);
++ return 0;
++ }
++
++ dma.samples = info.fragstotal * info.fragsize / (dma.samplebits/8);
++ dma.submission_chunk = 1;
++
++// memory map the dma buffer
++
++ if (!dma.buffer)
++ dma.buffer = (unsigned char *) mmap(NULL, info.fragstotal
++ * info.fragsize, PROT_WRITE, MAP_FILE|MAP_SHARED, audio_fd, 0);
++ if (!dma.buffer)
++ {
++ perror(snddevice->string);
++ Com_Printf("Could not mmap %s\n", LOG_CLIENT, snddevice->string);
+ close(audio_fd);
+ return false;
+ }
diff --git a/games/r1q2/files/patch-linux__sys_linux.c b/games/r1q2/files/patch-linux__sys_linux.c
index 484c05cfee7d..fde44ba399d8 100644
--- a/games/r1q2/files/patch-linux__sys_linux.c
+++ b/games/r1q2/files/patch-linux__sys_linux.c
@@ -1,62 +1,85 @@
---- linux/sys_linux.c.orig Fri Sep 15 15:50:28 2006
-+++ linux/sys_linux.c Fri Sep 15 15:51:43 2006
-@@ -230,7 +230,7 @@
-
- size = backtrace (array, sizeof(array)/sizeof(void*));
-
--#ifndef __x86_64__
-+#if !defined(__x86_64__) && !defined(__FreeBSD__)
- array[1] = (void *) uc->uc_mcontext.gregs[REG_EIP];
- #endif
-
-@@ -309,7 +309,9 @@
-
- void Sys_DebugBreak (void)
- {
-+#ifdef __i386__
- __asm ("int $3");
-+#endif
- }
-
- void Sys_Warn (char *warning, ...)
-@@ -414,29 +416,17 @@
- void *(*GetGameAPI) (void *);
-
- char name[MAX_OSPATH];
-- char curpath[MAX_OSPATH];
- char *path;
--#ifdef __i386__
-- const char *gamename = "gamei386.so";
--#elif defined __alpha__
-- const char *gamename = "gameaxp.so";
--#elif defined __x86_64__
-- const char *gamename = "gamex86_64.so";
--#else
--#error "Don't know what kind of dynamic objects to use for this architecture."
--#endif
-+ const char *gamename = "game.so";
-
- if (game_library)
- Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
-
-- getcwd(curpath, sizeof(curpath)-1);
-- curpath[sizeof(curpath)-1] = 0;
--
- Com_Printf("------- Loading %s -------\n", LOG_SERVER|LOG_NOTICE, gamename);
-
- if (baseq2)
- {
-- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, BASEDIRNAME, gamename);
-+ Com_sprintf (name, sizeof(name), "%s/%s", BASEDIRNAME, gamename);
- game_library = dlopen (name, RTLD_NOW );
- }
- else
-@@ -448,7 +438,7 @@
- path = FS_NextPath (path);
- if (!path)
- return NULL; // couldn't find one anywhere
-- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, path, gamename);
-+ Com_sprintf (name, sizeof(name), "%s/%s", path, gamename);
- game_library = dlopen (name, RTLD_NOW );
- if (game_library)
- {
+--- ./linux/sys_linux.c.orig Mon Oct 30 15:26:12 2006
++++ ./linux/sys_linux.c Sat Dec 16 17:28:37 2006
+@@ -177,7 +177,7 @@
+ /* Obtain a backtrace and print it to stderr.
+ * Adapted from http://www.delorie.com/gnu/docs/glibc/libc_665.html
+ */
+-#ifdef __x86_64__
++#ifndef __i386__
+ void Sys_Backtrace (int sig)
+ #else
+ void Sys_Backtrace (int sig, siginfo_t *siginfo, void *secret)
+@@ -188,7 +188,7 @@
+ size_t size;
+ size_t i;
+ char **strings;
+-#ifndef __x86_64__
++#ifdef __i386__
+ ucontext_t *uc = (ucontext_t *)secret;
+ #endif
+
+@@ -214,9 +214,13 @@
+
+ size = backtrace (array, sizeof(array)/sizeof(void*));
+
+-#ifndef __x86_64__
++#ifdef __i386__
++#ifdef __FreeBSD__
++ array[1] = (void *) uc->uc_mcontext.mc_eip;
++#else /* __linux__ */
+ array[1] = (void *) uc->uc_mcontext.gregs[REG_EIP];
+ #endif
++#endif
+
+ strings = backtrace_symbols (array, size);
+
+@@ -246,7 +250,7 @@
+ // Sys_SetFPCW();
+ #endif
+ /* Install our signal handler */
+-#ifndef __x86_64__
++#ifdef __i386__
+ struct sigaction sa;
+
+ if (sizeof(uint32) != 4)
+@@ -393,29 +397,17 @@
+ void *(*GetGameAPI) (void *);
+
+ char name[MAX_OSPATH];
+- char curpath[MAX_OSPATH];
+ char *path;
+-#ifdef __i386__
+- const char *gamename = "gamei386.so";
+-#elif defined __alpha__
+- const char *gamename = "gameaxp.so";
+-#elif defined __x86_64__
+- const char *gamename = "gamex86_64.so";
+-#else
+-#error "Don't know what kind of dynamic objects to use for this architecture."
+-#endif
++ const char *gamename = "game.so";
+
+ if (game_library)
+ Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
+
+- getcwd(curpath, sizeof(curpath)-1);
+- curpath[sizeof(curpath)-1] = 0;
+-
+ Com_Printf("------- Loading %s -------\n", LOG_SERVER|LOG_NOTICE, gamename);
+
+ if (baseq2)
+ {
+- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, BASEDIRNAME, gamename);
++ Com_sprintf (name, sizeof(name), "%s/%s", BASEDIRNAME, gamename);
+ game_library = dlopen (name, RTLD_NOW );
+
+ if (game_library == NULL) {
+@@ -433,7 +425,7 @@
+ path = FS_NextPath (path);
+ if (!path)
+ return NULL; // couldn't find one anywhere
+- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, path, gamename);
++ Com_sprintf (name, sizeof(name), "%s/%s", path, gamename);
+ game_library = dlopen (name, RTLD_NOW );
+ if (game_library)
+ {
diff --git a/games/r1q2/files/patch-linux__vid_so.c b/games/r1q2/files/patch-linux__vid_so.c
index ad62b938fde4..d588b81f8d4a 100644
--- a/games/r1q2/files/patch-linux__vid_so.c
+++ b/games/r1q2/files/patch-linux__vid_so.c
@@ -1,29 +1,11 @@
---- ./linux/vid_so.c.orig Fri May 19 17:48:09 2006
-+++ ./linux/vid_so.c Fri May 19 17:49:23 2006
-@@ -196,7 +196,6 @@
-
- char fn[MAX_OSPATH];
- struct stat st;
-- char *path;
-
- if ( reflib_active )
- {
-@@ -212,17 +211,12 @@
-
- Com_Printf( "------- Loading %s -------\n", LOG_CLIENT, name);
-
-- path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
-- snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
-+ snprintf (fn, MAX_OSPATH, "%s/%s", LIBDIR, name );
-
- if (stat(fn, &st) == -1) {
- Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", LOG_CLIENT, name, strerror(errno));
- return false;
- }
--
-- strcpy (fn, ".");
-- strcat(fn, "/");
-- strcat(fn, name);
-
- if ( ( reflib_library = dlopen( fn, RTLD_NOW ) ) == 0 )
- {
+--- ./linux/vid_so.c.orig Mon Oct 30 15:26:12 2006
++++ ./linux/vid_so.c Sat Dec 16 17:28:37 2006
+@@ -222,7 +222,7 @@
+ fn[strlen(fn) - 1] = 0;
+ */
+
+- strcpy (fn, ".");
++ strcpy (fn, LIBDIR);
+ strcat(fn, "/");
+ strcat(fn, name);
+
diff --git a/games/r1q2/files/patch-qcommon__common.c b/games/r1q2/files/patch-qcommon__common.c
deleted file mode 100644
index e3e4de4d7f2d..000000000000
--- a/games/r1q2/files/patch-qcommon__common.c
+++ /dev/null
@@ -1,20 +0,0 @@
---- ./qcommon/common.c.orig Wed May 17 22:21:33 2006
-+++ ./qcommon/common.c Wed May 17 22:29:35 2006
-@@ -1986,7 +1986,7 @@
-
- #if defined _WIN32
- z->allocationLocation = _ReturnAddress ();
--#elif defined LINUX
-+#elif defined __unix__
- z->allocationLocation = __builtin_return_address (0);
- #else
- //FIXME: other OSes/CCs
-@@ -2046,7 +2046,7 @@
-
- #if defined _WIN32
- retAddr = _ReturnAddress ();
--#elif defined LINUX
-+#elif defined __unix__
- retAddr = __builtin_return_address (0);
- #else
- //FIXME: other OSes/CCs
diff --git a/games/r1q2/files/patch-qcommon__files.c b/games/r1q2/files/patch-qcommon__files.c
index 43379f7d6ac9..d020c27e3334 100644
--- a/games/r1q2/files/patch-qcommon__files.c
+++ b/games/r1q2/files/patch-qcommon__files.c
@@ -1,63 +1,58 @@
---- qcommon/files.c.orig Sat May 20 09:53:45 2006
-+++ qcommon/files.c Sat May 20 09:59:37 2006
-@@ -1232,11 +1232,6 @@
-
- Q_strncpy (fs_gamedir, dir, sizeof(fs_gamedir)-1);
-
--#if defined (__unix__)
-- // Create directory if it does not exist
-- Sys_Mkdir(fs_gamedir);
--#endif
--
- Com_DPrintf ("FS_AddGameDirectory: Added '%s'\n", dir);
-
- //
-@@ -1391,6 +1386,17 @@
- FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
- }
-
-+void FS_AddHomeAsGameDirectory(char *dir)
-+{
-+ char gdir[MAX_OSPATH]; /* Game directory. */
-+ char *homedir; /* Home directory. */
-+
-+ if ((homedir = getenv("HOME")) != NULL) {
-+ Com_sprintf(gdir, sizeof(gdir), "%s/.r1q2/%s", homedir, dir);
-+ FS_AddGameDirectory(gdir);
-+ }
-+}
-+
- /*
- ================
- FS_SetGamedir
-@@ -1449,7 +1455,10 @@
- {
- Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);
- Cvar_FullSet ("gamedir", dir, CVAR_SERVERINFO|CVAR_NOSET);
-+ FS_AddGameDirectory (va("%s/%s", DATADIR, dir) );
-+ FS_AddGameDirectory (va("%s/%s", LIBDIR, dir) );
- FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
-+ FS_AddHomeAsGameDirectory(dir);
- }
- }
-
-@@ -1707,7 +1716,10 @@
- //
- // start up with baseq2 by default
- //
-+ FS_AddGameDirectory(va("%s/"BASEDIRNAME, DATADIR));
-+ FS_AddGameDirectory(va("%s/"BASEDIRNAME, LIBDIR));
- FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );
-+ FS_AddHomeAsGameDirectory(BASEDIRNAME);
-
- // any set gamedirs will be freed up to here
- fs_base_searchpaths = fs_searchpaths;
-@@ -1716,4 +1728,8 @@
- fs_gamedirvar = Cvar_Get ("game", "", CVAR_LATCH|CVAR_SERVERINFO);
- if (fs_gamedirvar->string[0])
- FS_SetGamedir (fs_gamedirvar->string);
-+
-+ FS_CreatePath(fs_gamedir);
-+ Sys_Mkdir(fs_gamedir);
-+ Com_Printf("Using '%s' for writing.\n", LOG_GENERAL, fs_gamedir);
- }
+--- ./qcommon/files.c.orig Fri Sep 29 02:06:34 2006
++++ ./qcommon/files.c Sat Dec 16 17:28:37 2006
+@@ -1382,6 +1382,24 @@
+
+ /*
+ ================
++FS_AddHomeAsGameDirectory
++
++Adds ~/.r1q2/<dir> as a game directory.
++================
++*/
++void FS_AddHomeAsGameDirectory(char *dir)
++{
++ char gdir[MAX_OSPATH]; /* Game directory. */
++ char *homedir; /* Home directory. */
++
++ if ((homedir = getenv("HOME")) != NULL) {
++ Com_sprintf(gdir, sizeof(gdir), "%s/.r1q2/%s", homedir, dir);
++ FS_AddGameDirectory(gdir);
++ }
++}
++
++/*
++================
+ FS_SetGamedir
+
+ Sets the gamedir and path to a different directory.
+@@ -1438,7 +1456,10 @@
+ {
+ Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);
+ Cvar_FullSet ("gamedir", dir, CVAR_SERVERINFO|CVAR_NOSET);
++ FS_AddGameDirectory (va("%s/%s", DATADIR, dir) );
++ FS_AddGameDirectory (va("%s/%s", LIBDIR, dir) );
+ FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
++ FS_AddHomeAsGameDirectory(dir);
+ }
+ }
+
+@@ -1696,7 +1717,10 @@
+ //
+ // start up with baseq2 by default
+ //
++ FS_AddGameDirectory(va("%s/"BASEDIRNAME, DATADIR));
++ FS_AddGameDirectory(va("%s/"BASEDIRNAME, LIBDIR));
+ FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );
++ FS_AddHomeAsGameDirectory(BASEDIRNAME);
+
+ // any set gamedirs will be freed up to here
+ fs_base_searchpaths = fs_searchpaths;
+@@ -1705,4 +1729,8 @@
+ fs_gamedirvar = Cvar_Get ("game", "", CVAR_LATCH|CVAR_SERVERINFO);
+ if (fs_gamedirvar->string[0])
+ FS_SetGamedir (fs_gamedirvar->string);
++
++ FS_CreatePath(fs_gamedir);
++ Sys_Mkdir(fs_gamedir);
++ Com_Printf("Using '%s' for writing.\n", LOG_GENERAL, fs_gamedir);
+ }
diff --git a/games/r1q2/files/patch-qcommon__qcommon.h b/games/r1q2/files/patch-qcommon__qcommon.h
index 4b02dd32c5ca..51d0cdb37caf 100644
--- a/games/r1q2/files/patch-qcommon__qcommon.h
+++ b/games/r1q2/files/patch-qcommon__qcommon.h
@@ -1,10 +1,12 @@
---- ./qcommon/qcommon.h.orig Wed Mar 15 17:18:50 2006
-+++ ./qcommon/qcommon.h Wed May 17 22:31:34 2006
-@@ -88,6 +88,7 @@
-
- #define BUILDSTRING "FreeBSD"
-
-+ #define __cdecl
- #ifdef __i386__
- #define CPUSTRING "i386"
- #elif defined __x86_64__
+--- ./qcommon/qcommon.h.orig Sat Sep 16 16:16:40 2006
++++ ./qcommon/qcommon.h Sat Dec 16 17:28:37 2006
+@@ -86,7 +86,8 @@
+
+ #elif defined __FreeBSD__
+
+-#define BUILDSTRING "FreeBSD"
++ #define BUILDSTRING "FreeBSD"
++ #define __cdecl
+
+ #ifdef __i386__
+ #define CPUSTRING "i386"
diff --git a/games/r1q2/files/patch-ref_gl__gl_local.h b/games/r1q2/files/patch-ref_gl__gl_local.h
deleted file mode 100644
index 3695e333a27a..000000000000
--- a/games/r1q2/files/patch-ref_gl__gl_local.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./ref_gl/gl_local.h.orig Mon Apr 24 14:23:20 2006
-+++ ./ref_gl/gl_local.h Wed May 17 22:29:52 2006
-@@ -28,7 +28,7 @@
- #include <GL/glu.h>
- #include <math.h>
-
--#ifndef __linux__
-+#ifndef __unix__
- #ifndef GL_COLOR_INDEX8_EXT
- #define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
- #endif
diff --git a/games/r1q2/files/patch-ref_gl__qgl.h b/games/r1q2/files/patch-ref_gl__qgl.h
deleted file mode 100644
index fab293290ec0..000000000000
--- a/games/r1q2/files/patch-ref_gl__qgl.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./ref_gl/qgl.h.orig Wed May 17 22:21:33 2006
-+++ ./ref_gl/qgl.h Wed May 17 22:29:57 2006
-@@ -436,7 +436,7 @@
-
- #endif
-
--#ifdef __linux__
-+#ifdef __unix__
-
- // local function in dll
- extern void *qwglGetProcAddress(char *symbol);
diff --git a/games/r1q2/pkg-plist b/games/r1q2/pkg-plist
index 842928a6c347..850aa560b124 100644
--- a/games/r1q2/pkg-plist
+++ b/games/r1q2/pkg-plist
@@ -1,9 +1,8 @@
+@exec mkdir -p %%LIBDIR%%/baseq2
%%CLIENT%%bin/r1q2
%%DEDICATED%%bin/r1q2ded
-%%SDL%%bin/r1q2-sdl
%%GAME%%%%LIBDIR%%/baseq2/game.so
-%%GLX%%%%LIBDIR%%/ref_r1gl.so
-%%SDLGL%%%%LIBDIR%%/ref_r1sdl.so
+%%REF_GL%%%%LIBDIR%%/ref_gl.so
%%PORTDOCS%%%%DOCSDIR%%/r1q2.txt
%%PORTDOCS%%%%DOCSDIR%%/readme.txt
@dirrm %%LIBDIR%%/baseq2