aboutsummaryrefslogtreecommitdiff
path: root/games/sdlquake2
diff options
context:
space:
mode:
authorAlejandro Pulver <alepulver@FreeBSD.org>2006-05-05 17:42:08 +0000
committerAlejandro Pulver <alepulver@FreeBSD.org>2006-05-05 17:42:08 +0000
commit0eaf5b215b56bd6026193c3ab57d2bd4b2e1f27c (patch)
treeeab7e9db652d0f8ac3e12a5b93cf161fbc782524 /games/sdlquake2
parent0b0a8361b233410f6f037985910521c75efa8865 (diff)
downloadports-0eaf5b215b56bd6026193c3ab57d2bd4b2e1f27c.tar.gz
ports-0eaf5b215b56bd6026193c3ab57d2bd4b2e1f27c.zip
Notes
Diffstat (limited to 'games/sdlquake2')
-rw-r--r--games/sdlquake2/Makefile45
-rw-r--r--games/sdlquake2/distinfo3
-rw-r--r--games/sdlquake2/files/patch-Makefile42
-rw-r--r--games/sdlquake2/files/patch-cl_main.c11
-rw-r--r--games/sdlquake2/files/patch-files.c60
-rw-r--r--games/sdlquake2/files/patch-gl_image.c32
-rw-r--r--games/sdlquake2/files/patch-gl_local.h11
-rw-r--r--games/sdlquake2/files/patch-gl_rmain.c11
-rw-r--r--games/sdlquake2/files/patch-menu.c10
-rw-r--r--games/sdlquake2/files/patch-q_shared.h19
-rw-r--r--games/sdlquake2/files/patch-q_shlinux.c48
-rw-r--r--games/sdlquake2/files/patch-qgl.h20
-rw-r--r--games/sdlquake2/files/patch-snd_mix.c22
-rw-r--r--games/sdlquake2/files/patch-snd_openal.h23
-rw-r--r--games/sdlquake2/files/patch-sv_ccmds.c12
-rw-r--r--games/sdlquake2/files/patch-sv_user.c11
-rw-r--r--games/sdlquake2/files/patch-sys_linux.c29
-rw-r--r--games/sdlquake2/files/patch-vid_so.c11
-rw-r--r--games/sdlquake2/pkg-descr5
-rw-r--r--games/sdlquake2/pkg-message13
-rw-r--r--games/sdlquake2/pkg-plist6
21 files changed, 444 insertions, 0 deletions
diff --git a/games/sdlquake2/Makefile b/games/sdlquake2/Makefile
new file mode 100644
index 000000000000..f7df90bf2a22
--- /dev/null
+++ b/games/sdlquake2/Makefile
@@ -0,0 +1,45 @@
+# New ports collection makefile for: sdlquake2
+# Date created: 5 May 2006
+# Whom: alepulver
+#
+# $FreeBSD$
+#
+
+PORTNAME= sdlquake2
+PORTVERSION= 0.1.4
+CATEGORIES= games
+MASTER_SITES= http://koti.mbnet.fi/~turol/sdlquake2/
+
+MAINTAINER= alepulver@FreeBSD.org
+COMMENT= Combination of R1Q2 and R1GL with SDL code from Quake2Forge
+
+LIB_DEPENDS= execinfo.1:${PORTSDIR}/devel/libexecinfo \
+ jpeg.9:${PORTSDIR}/graphics/jpeg \
+ png.5:${PORTSDIR}/graphics/png
+
+USE_BZIP2= yes
+USE_GCC= 3.2+
+USE_GMAKE= yes
+USE_GL= yes
+USE_SDL= sdl
+
+MAKE_ENV= LIBDIR="${LIBDIR}"
+
+LIBDIR= ${PREFIX}/lib/${PORTNAME}
+PLIST_SUB= LIBDIR=${LIBDIR:S/${PREFIX}\///}
+
+do-install:
+ ${MKDIR} ${LIBDIR}/baseq2
+ ${INSTALL_PROGRAM} ${WRKSRC}/ref_sdlgl.so ${LIBDIR}
+ ${INSTALL_PROGRAM} ${WRKSRC}/baseq2/game.so ${LIBDIR}/baseq2
+ ${INSTALL_PROGRAM} ${WRKSRC}/quake2 ${PREFIX}/bin/${PORTNAME}
+ ${INSTALL_PROGRAM} ${WRKSRC}/q2ded ${PREFIX}/bin/${PORTNAME}-ded
+
+post-install:
+ @${ECHO_CMD}
+ @${CAT} ${PKGMESSAGE}
+ @${ECHO_CMD}
+
+.include "${.CURDIR}/../quake2-data/Makefile.include"
+
+.include <bsd.port.mk>
diff --git a/games/sdlquake2/distinfo b/games/sdlquake2/distinfo
new file mode 100644
index 000000000000..3e58dae1cf9e
--- /dev/null
+++ b/games/sdlquake2/distinfo
@@ -0,0 +1,3 @@
+MD5 (sdlquake2-0.1.4.tar.bz2) = 7f7b9b871558e09783c404472d593478
+SHA256 (sdlquake2-0.1.4.tar.bz2) = 5e44652f474236f8d94257c17132f68af6e70437df891856892e594572dfea73
+SIZE (sdlquake2-0.1.4.tar.bz2) = 581563
diff --git a/games/sdlquake2/files/patch-Makefile b/games/sdlquake2/files/patch-Makefile
new file mode 100644
index 000000000000..1254e31ae689
--- /dev/null
+++ b/games/sdlquake2/files/patch-Makefile
@@ -0,0 +1,42 @@
+--- ./Makefile.orig Thu May 19 17:56:13 2005
++++ ./Makefile Sun Feb 26 11:24:53 2006
+@@ -1,5 +1,18 @@
+-CC:=gcc
+-CFLAGS:=-O3 -ffast-math -march=athlon-xp -g -Wall $(shell sdl-config --cflags)
++CC?=gcc
++SDL_CONFIG?=sdl-config
++LOCALBASE?=/usr/local
++X11BASE?=/usr/X11R6
++CFLAGS+=-O3 -ffast-math -DDATADIR='"$(Q2DIR)"' -DLIBDIR='"$(LIBDIR)"' $(shell $(SDL_CONFIG) --cflags) -I$(X11BASE)/include
++
++LIBS=-lm -lz
++
++ifeq ($(shell uname),Linux)
++LIBS+=-ldl
++endif
++
++ifeq ($(shell uname),FreeBSD)
++LIBS+=-L$(LOCALBASE)/lib -lexecinfo
++endif
+
+ GAMES:=baseq2
+
+@@ -43,15 +56,14 @@
+ @sed "s@^\(.*\)\.o:@$(dir $*)\1.o:@" < .depends/$*.d > .depends/$*.d.new
+ @mv .depends/$*.d.new .depends/$*.d
+
+-
+ quake2: $(quake2_OBJ)
+- $(CC) -g -o $@ $(shell sdl-config --libs) -lz -ldl $^
++ $(CC) -g -o $@ $(shell $(SDL_CONFIG) --libs) $(LIBS) $^
+
+ q2ded: $(q2ded_OBJ)
+- $(CC) -g -o $@ $^ -lz -ldl
++ $(CC) -g -o $@ $^ $(LIBS)
+
+ ref_sdlgl.so: $(sdlgl_OBJ)
+- $(CC) -shared -g -o $@ $(shell sdl-config --libs) -lGL -ljpeg -lpng12 $^
++ $(CC) -shared -g -o $@ $(shell $(SDL_CONFIG) --libs) -L$(X11BASE)/lib -lGL -ljpeg -lpng $^
+
+ ALLOBJ:=$(quake2_OBJ) $(sdlgl_OBJ)
+
diff --git a/games/sdlquake2/files/patch-cl_main.c b/games/sdlquake2/files/patch-cl_main.c
new file mode 100644
index 000000000000..a9d4a77842a0
--- /dev/null
+++ b/games/sdlquake2/files/patch-cl_main.c
@@ -0,0 +1,11 @@
+--- ./cl_main.c.orig Thu May 19 17:56:13 2005
++++ ./cl_main.c Sun Feb 26 11:23:56 2006
+@@ -3657,7 +3657,7 @@
+ Cbuf_Execute ();
+
+ Con_Init ();
+-#if defined __linux__ || defined __sgi
++#if defined __linux__ || defined __sgi || defined __FreeBSD__
+ S_Init (true);
+
+ VID_Init ();
diff --git a/games/sdlquake2/files/patch-files.c b/games/sdlquake2/files/patch-files.c
new file mode 100644
index 000000000000..0e9626afaa2e
--- /dev/null
+++ b/games/sdlquake2/files/patch-files.c
@@ -0,0 +1,60 @@
+--- ./files.c.orig Thu May 19 17:56:13 2005
++++ ./files.c Sun Feb 26 11:23:56 2006
+@@ -233,7 +233,7 @@
+ #ifdef MAGIC_BTREE
+ rb = rbinit (_compare, 1);
+ #else
+-#ifdef LINUX
++#if defined(__linux__) || defined(__FreeBSD__)
+ rb = rbinit ((int (*)(const void *, const void *))strcmp, 0);
+ #else
+ rb = rbinit ((int (*)(const void *, const void *))Q_stricmp, 0);
+@@ -1158,6 +1158,7 @@
+ 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", fs_basedir->string, dir) );
++ FS_AddGameDirectory (va("%s/%s", LIBDIR, dir));
+ }
+ }
+
+@@ -1383,6 +1384,9 @@
+ */
+ void FS_InitFilesystem (void)
+ {
++ char *home;
++ char homedir[MAX_OSPATH];
++
+ current_filename = "unknown";
+
+ Cmd_AddCommand ("path", FS_Path_f);
+@@ -1405,7 +1409,7 @@
+ // basedir <path>
+ // allows the game to run from outside the data tree
+ //
+- fs_basedir = Cvar_Get ("basedir", ".", CVAR_NOSET);
++ fs_basedir = Cvar_Get ("basedir", DATADIR, CVAR_NOSET);
+ fs_cache = Cvar_Get ("fs_cache", "7", 0);
+ fs_noextern = Cvar_Get ("fs_noextern", "0", 0);
+
+@@ -1413,6 +1417,7 @@
+ // start up with baseq2 by default
+ //
+ FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );
++ FS_AddGameDirectory (va("%s/"BASEDIRNAME, LIBDIR));
+
+ // any set gamedirs will be freed up to here
+ fs_base_searchpaths = fs_searchpaths;
+@@ -1421,4 +1426,13 @@
+ fs_gamedirvar = Cvar_Get ("game", "", CVAR_LATCH|CVAR_SERVERINFO);
+ if (fs_gamedirvar->string[0])
+ FS_SetGamedir (fs_gamedirvar->string);
++
++ if ((home = getenv("HOME")) != NULL) {
++ strncpy(homedir, home, sizeof(homedir)-1);
++ strncat(homedir, "/.sdlquake2/", sizeof(homedir)-strlen(homedir)-1);
++ Sys_Mkdir(homedir);
++ strncat(homedir, fs_gamedirvar->string[0] ? fs_gamedirvar->string : BASEDIRNAME, sizeof(homedir)-strlen(homedir)-1);
++ Sys_Mkdir(homedir);
++ FS_AddGameDirectory(homedir);
++ }
+ }
diff --git a/games/sdlquake2/files/patch-gl_image.c b/games/sdlquake2/files/patch-gl_image.c
new file mode 100644
index 000000000000..f5cce181947b
--- /dev/null
+++ b/games/sdlquake2/files/patch-gl_image.c
@@ -0,0 +1,32 @@
+--- ./gl_image.c.orig Thu May 19 17:56:13 2005
++++ ./gl_image.c Sun Feb 26 11:23:56 2006
+@@ -555,7 +555,7 @@
+ size_t Pos;
+ } TPngFileBuffer;
+
+-void __cdecl PngReadFunc(png_struct *Png, png_bytep buf, png_size_t size)
++void PngReadFunc(png_struct *Png, png_bytep buf, png_size_t size)
+ {
+ TPngFileBuffer *PngFileBuffer=(TPngFileBuffer*)png_get_io_ptr(Png);
+ memcpy(buf,PngFileBuffer->Buffer+PngFileBuffer->Pos,size);
+@@ -1007,17 +1007,17 @@
+ =================================================================
+ */
+
+-void __cdecl jpg_null(j_decompress_ptr cinfo)
++void jpg_null(j_decompress_ptr cinfo)
+ {
+ }
+
+-unsigned char __cdecl jpg_fill_input_buffer(j_decompress_ptr cinfo)
++unsigned char jpg_fill_input_buffer(j_decompress_ptr cinfo)
+ {
+ ri.Con_Printf(PRINT_ALL, "Premature end of JPEG data\n");
+ return 1;
+ }
+
+-void __cdecl jpg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
++void jpg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
+ {
+
+ cinfo->src->next_input_byte += (size_t) num_bytes;
diff --git a/games/sdlquake2/files/patch-gl_local.h b/games/sdlquake2/files/patch-gl_local.h
new file mode 100644
index 000000000000..867c4838b610
--- /dev/null
+++ b/games/sdlquake2/files/patch-gl_local.h
@@ -0,0 +1,11 @@
+--- ./gl_local.h.orig Thu May 19 17:56:13 2005
++++ ./gl_local.h Sun Feb 26 11:23:56 2006
+@@ -28,7 +28,7 @@
+ #include <GL/glu.h>
+ #include <math.h>
+
+-#ifndef __linux__
++#if !defined(__linux__) && !defined(__FreeBSD__)
+ #ifndef GL_COLOR_INDEX8_EXT
+ #define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
+ #endif
diff --git a/games/sdlquake2/files/patch-gl_rmain.c b/games/sdlquake2/files/patch-gl_rmain.c
new file mode 100644
index 000000000000..dda7bfdcee6a
--- /dev/null
+++ b/games/sdlquake2/files/patch-gl_rmain.c
@@ -0,0 +1,11 @@
+--- ./gl_rmain.c.orig Thu May 19 17:56:13 2005
++++ ./gl_rmain.c Sun Feb 26 11:23:56 2006
+@@ -1450,7 +1450,7 @@
+ ri.Cvar_Set( "scr_drawall", "0" );
+ }
+
+-#ifdef __linux__
++#if defined(__linux__) || defined(__FreeBSD__)
+ ri.Cvar_SetValue( "gl_finish", 0 );
+ #endif
+
diff --git a/games/sdlquake2/files/patch-menu.c b/games/sdlquake2/files/patch-menu.c
new file mode 100644
index 000000000000..c9ec4a80dcda
--- /dev/null
+++ b/games/sdlquake2/files/patch-menu.c
@@ -0,0 +1,10 @@
+--- ./menu.c.orig Thu May 19 17:56:13 2005
++++ ./menu.c Sun Feb 26 11:23:56 2006
+@@ -587,6 +587,7 @@
+ {
+ {"+attack", "attack"},
+ {"weapnext", "next weapon"},
++{"weapprev", "previous weapon"},
+ {"+forward", "walk forward"},
+ {"+back", "backpedal"},
+ {"+left", "turn left"},
diff --git a/games/sdlquake2/files/patch-q_shared.h b/games/sdlquake2/files/patch-q_shared.h
new file mode 100644
index 000000000000..b201a7727e94
--- /dev/null
+++ b/games/sdlquake2/files/patch-q_shared.h
@@ -0,0 +1,19 @@
+--- ./q_shared.h.orig Thu May 19 17:56:13 2005
++++ ./q_shared.h Sun Feb 26 11:25:24 2006
+@@ -97,7 +97,16 @@
+ typedef unsigned __int16 uint16;
+ typedef unsigned __int64 uint64;
+ #else /* NON-WIN32 */
++#ifdef __FreeBSD__
++#include <sys/param.h>
++#if __FreeBSD_version < 500000
++#include <inttypes.h>
++#else
+ #include <stdint.h>
++#endif
++#else
++#include <stdint.h>
++#endif
+ typedef int32_t int32;
+ typedef int16_t int16;
+ typedef int64_t int64;
diff --git a/games/sdlquake2/files/patch-q_shlinux.c b/games/sdlquake2/files/patch-q_shlinux.c
new file mode 100644
index 000000000000..8e371636f9b3
--- /dev/null
+++ b/games/sdlquake2/files/patch-q_shlinux.c
@@ -0,0 +1,48 @@
+--- ./q_shlinux.c.orig Thu May 19 17:56:13 2005
++++ ./q_shlinux.c Sun Feb 26 11:23:56 2006
+@@ -12,6 +12,10 @@
+
+ #include "qcommon.h"
+
++#ifdef __FreeBSD__
++#include <machine/param.h>
++#endif
++
+ //===============================================================================
+
+ byte *membase;
+@@ -54,14 +58,32 @@
+
+ int Hunk_End (void)
+ {
+-#ifndef __FreeBSD__
+ byte *n;
+
++#ifdef __FreeBSD__
++ 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;
++ }
++#endif
++#ifdef __linux__
+ 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/sdlquake2/files/patch-qgl.h b/games/sdlquake2/files/patch-qgl.h
new file mode 100644
index 000000000000..2e3950a52437
--- /dev/null
+++ b/games/sdlquake2/files/patch-qgl.h
@@ -0,0 +1,20 @@
+--- ./qgl.h.orig Thu May 19 17:56:13 2005
++++ ./qgl.h Sun Feb 26 11:23:56 2006
+@@ -31,7 +31,7 @@
+ #include <GL/gl.h>
+ #include "glext.h"
+
+-#ifdef __linux__
++#if defined(__linux__) || defined(__FreeBSD__)
+ //#include <GL/fxmesa.h>
+ #include <GL/glx.h>
+ #endif
+@@ -436,7 +436,7 @@
+
+ #endif
+
+-#ifdef __linux__
++#if defined(__linux__) || defined(__FreeBSD__)
+
+ // local function in dll
+ extern void *qwglGetProcAddress(char *symbol);
diff --git a/games/sdlquake2/files/patch-snd_mix.c b/games/sdlquake2/files/patch-snd_mix.c
new file mode 100644
index 000000000000..822506d6124a
--- /dev/null
+++ b/games/sdlquake2/files/patch-snd_mix.c
@@ -0,0 +1,22 @@
+--- ./snd_mix.c.orig Thu May 19 17:56:13 2005
++++ ./snd_mix.c Sun Feb 26 11:23:56 2006
+@@ -168,8 +168,8 @@
+ ===============================================================================
+ */
+
+-void __cdecl S_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int endtime, int offset);
+-void __cdecl S_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime, int offset);
++void S_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int endtime, int offset);
++void S_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime, int offset);
+
+ void S_PaintChannels(int endtime)
+ {
+@@ -349,7 +349,7 @@
+ }
+
+
+-void __cdecl S_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count, int offset)
++void S_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count, int offset)
+ {
+ int data;
+ int left, right;
diff --git a/games/sdlquake2/files/patch-snd_openal.h b/games/sdlquake2/files/patch-snd_openal.h
new file mode 100644
index 000000000000..0271067c2a63
--- /dev/null
+++ b/games/sdlquake2/files/patch-snd_openal.h
@@ -0,0 +1,23 @@
+--- ./snd_openal.h.orig Thu May 19 17:56:13 2005
++++ ./snd_openal.h Sun Feb 26 11:23:56 2006
+@@ -18,7 +18,7 @@
+ #ifdef _WIN32
+ #include "alw_win.h"
+ #endif
+-#ifdef __linux__
++#if defined(__linux__) || defined(__FreeBSD__)
+ #include "al_linux.h"
+ #endif
+ #endif
+@@ -162,9 +162,9 @@
+ #define ALimp_Shutdown ALW_Shutdown
+
+ #else
+-#ifdef __linux__
++#if defined(__linux__) || defined(__FreeBSD__)
+
+-#define AL_DRIVER_OPENAL "/usr/lib/libopenal.so"
++#define AL_DRIVER_OPENAL "libopenal.so"
+
+ #define ALimp_Init AL_Init
+ #define ALimp_Shutdown AL_Shutdown
diff --git a/games/sdlquake2/files/patch-sv_ccmds.c b/games/sdlquake2/files/patch-sv_ccmds.c
new file mode 100644
index 000000000000..be8d43f2f079
--- /dev/null
+++ b/games/sdlquake2/files/patch-sv_ccmds.c
@@ -0,0 +1,12 @@
+--- ./sv_ccmds.c.orig Thu May 19 17:56:13 2005
++++ ./sv_ccmds.c Sun Feb 26 11:23:56 2006
+@@ -589,7 +589,8 @@
+ SV_Map (false, Cmd_Argv(1), false );
+
+ // archive server state
+- strncpy (svs.mapcmd, Cmd_Argv(1), sizeof(svs.mapcmd)-1);
++ if (Cmd_Argv(1)[0] != '\0')
++ strncpy (svs.mapcmd, Cmd_Argv(1), sizeof(svs.mapcmd)-1);
+
+ // copy off the level to the autosave slot
+ if (!dedicated->intvalue && !Cvar_IntValue ("deathmatch"))
diff --git a/games/sdlquake2/files/patch-sv_user.c b/games/sdlquake2/files/patch-sv_user.c
new file mode 100644
index 000000000000..2d71d225b4ae
--- /dev/null
+++ b/games/sdlquake2/files/patch-sv_user.c
@@ -0,0 +1,11 @@
+--- ./sv_user.c.orig Thu May 19 17:56:13 2005
++++ ./sv_user.c Sun Feb 26 11:23:56 2006
+@@ -1183,7 +1183,7 @@
+ sv_client->downloadsize = FS_LoadFile (name, NULL);
+
+ //adjust case and re-try
+-#ifdef LINUX
++#if defined(__linux__) || defined(__FreeBSD__)
+ if (sv_client->downloadsize == -1)
+ {
+ Q_strlwr (name);
diff --git a/games/sdlquake2/files/patch-sys_linux.c b/games/sdlquake2/files/patch-sys_linux.c
new file mode 100644
index 000000000000..6a77ae750b4b
--- /dev/null
+++ b/games/sdlquake2/files/patch-sys_linux.c
@@ -0,0 +1,29 @@
+--- ./sys_linux.c.orig Thu May 19 17:56:13 2005
++++ ./sys_linux.c Sun Feb 26 11:23:56 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
+
+@@ -423,7 +423,7 @@
+
+ if (baseq2)
+ {
+- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, BASEDIRNAME, gamename);
++ Com_sprintf (name, sizeof(name), "%s/%s/%s", LIBDIR, BASEDIRNAME, gamename);
+ game_library = dlopen (name, RTLD_NOW );
+ }
+ else
+@@ -435,7 +435,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/sdlquake2/files/patch-vid_so.c b/games/sdlquake2/files/patch-vid_so.c
new file mode 100644
index 000000000000..c29feb7457ec
--- /dev/null
+++ b/games/sdlquake2/files/patch-vid_so.c
@@ -0,0 +1,11 @@
+--- ./vid_so.c.orig Thu May 19 17:56:13 2005
++++ ./vid_so.c Sun Feb 26 11:23:56 2006
+@@ -225,7 +225,7 @@
+ fn[strlen(fn) - 1] = 0;
+ */
+
+- strcpy (fn, ".");
++ strcpy (fn, LIBDIR);
+ strcat(fn, "/");
+ strcat(fn, name);
+
diff --git a/games/sdlquake2/pkg-descr b/games/sdlquake2/pkg-descr
new file mode 100644
index 000000000000..caad73638446
--- /dev/null
+++ b/games/sdlquake2/pkg-descr
@@ -0,0 +1,5 @@
+Basically this is a combination of R1Q2 and R1GL with SDL code from
+Quake2Forge. Meaning it's R1Q2 protocol 35 compatible Linux client. Tested on
+Debian Sarge. Both client and dedicated server.
+
+WWW: http://koti.mbnet.fi/~turol/sdlquake2/
diff --git a/games/sdlquake2/pkg-message b/games/sdlquake2/pkg-message
new file mode 100644
index 000000000000..39a19cb4e9d5
--- /dev/null
+++ b/games/sdlquake2/pkg-message
@@ -0,0 +1,13 @@
+==============================================================================
+
+SDLQuake2 has been installed.
+
+The binaries have been renamed to "sdlquake2" and "sdlquake2-ded" to avoid
+conflicting with the "games/quake2lnx" port.
+
+The configuration will be written to the "~/.sdlquake2" directory.
+
+The gamma can not be adjusted from the game. You can use "xgamma" to change it
+before running it, and restore it later.
+
+==============================================================================
diff --git a/games/sdlquake2/pkg-plist b/games/sdlquake2/pkg-plist
new file mode 100644
index 000000000000..5e1ec27bd9c7
--- /dev/null
+++ b/games/sdlquake2/pkg-plist
@@ -0,0 +1,6 @@
+bin/sdlquake2
+bin/sdlquake2-ded
+%%LIBDIR%%/baseq2/game.so
+%%LIBDIR%%/ref_sdlgl.so
+@dirrm %%LIBDIR%%/baseq2
+@dirrm %%LIBDIR%%