aboutsummaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authoralepulver <alepulver@FreeBSD.org>2006-05-22 05:37:13 +0800
committeralepulver <alepulver@FreeBSD.org>2006-05-22 05:37:13 +0800
commit41cd7669e72dc75d3d3f1e6ce6a8e3a8e45288bf (patch)
treea0715f4a85c57ccf734518d5bac8fd2d25ead8c1 /games
parent99a0e6a964ee2fd75043ed0b0444e9afceff6843 (diff)
downloadfreebsd-ports-gnome-41cd7669e72dc75d3d3f1e6ce6a8e3a8e45288bf.tar.gz
freebsd-ports-gnome-41cd7669e72dc75d3d3f1e6ce6a8e3a8e45288bf.tar.zst
freebsd-ports-gnome-41cd7669e72dc75d3d3f1e6ce6a8e3a8e45288bf.zip
Enhanced Quake2 OpenGL only engine with integrated Lazarus support.
WWW: http://www.geocities.com/knightmare66/ Approved by: garga (mentor)
Diffstat (limited to 'games')
-rw-r--r--games/Makefile1
-rw-r--r--games/kmquake2/Makefile153
-rw-r--r--games/kmquake2/distinfo18
-rw-r--r--games/kmquake2/files/extra-patch-addons__Makefile174
-rw-r--r--games/kmquake2/files/patch-Makefile91
-rw-r--r--games/kmquake2/files/patch-client__snd_loc.h11
-rw-r--r--games/kmquake2/files/patch-qcommon__files.c19
-rw-r--r--games/kmquake2/files/patch-unix__gl_glx.c30
-rw-r--r--games/kmquake2/files/patch-unix__sys_unix.c45
-rw-r--r--games/kmquake2/pkg-descr3
-rw-r--r--games/kmquake2/pkg-plist48
11 files changed, 593 insertions, 0 deletions
diff --git a/games/Makefile b/games/Makefile
index 4994c008dcf2..61a026ab8917 100644
--- a/games/Makefile
+++ b/games/Makefile
@@ -332,6 +332,7 @@
SUBDIR += kgeography
SUBDIR += kiki
SUBDIR += klondike
+ SUBDIR += kmquake2
SUBDIR += knights
SUBDIR += kobodeluxe
SUBDIR += koth
diff --git a/games/kmquake2/Makefile b/games/kmquake2/Makefile
new file mode 100644
index 000000000000..d96cb05440b3
--- /dev/null
+++ b/games/kmquake2/Makefile
@@ -0,0 +1,153 @@
+# New ports collection makefile for: kmquake2
+# Date created: 19 May 2005
+# Whom: alepulver
+#
+# $FreeBSD$
+#
+
+PORTNAME= kmquake2
+PORTVERSION= 0.19
+CATEGORIES= games
+MASTER_SITES= http://qudos.quakedev.com/linux/quake2/engines/KMQuake2/:src \
+ http://qexpo.quakedev.com/uploaded/54/:data \
+ http://www.markshan.com/maps/:pax \
+ ftp://ftp.splatterworld.de/games/q2/mods/:pax \
+ http://www.markshan.com/engine/:paxpatch
+DISTNAME= KMQuake2_${PORTVERSION:S/.//}_src_unix
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:src \
+ ${KMQ2_FLARES}:src \
+ ${KMQ2_DATA}:data
+DIST_SUBDIR= ${PORTNAME}
+EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
+
+MAINTAINER= alepulver@FreeBSD.org
+COMMENT= Enhanced Quake2 OpenGL only engine with Lazarus support
+
+LIB_DEPENDS= jpeg.9:${PORTSDIR}/graphics/jpeg \
+ openal.0:${PORTSDIR}/audio/openal \
+ png.5:${PORTSDIR}/graphics/png \
+ vorbis.3:${PORTSDIR}/audio/libvorbis
+EXTRACT_DEPENDS=unzip:${PORTSDIR}/archivers/unzip
+
+WRKSRC= ${WRKDIR}/KMQuake2_${PORTVERSION:S/.//}_src_unix
+
+USE_BZIP2= yes
+USE_GCC= 3.2+
+USE_GMAKE= yes
+USE_GL= yes
+
+OPTIONS= 3ZB2 "Build 3zb2 modification (bots)" off \
+ CTF "Build Capture The Flag modification" off \
+ DEDICATED "Build dedicated server" on \
+ HYBRID "Build Rogue-Xatrix hybrid modification" off \
+ LIGHTS "Build Lights modification with bots" off \
+ OPTIMIZED_CFLAGS "Enable compilation optimizations" on \
+ PAX "Build Pax Imperia modification" off \
+ ROGUE "Build Ground Zero (Rogue( mission pack" off \
+ SDL "Build SDL client" on \
+ XATRIX "Build The Reckoning (Xatrix) mission pack" off \
+ ZAERO "Build Zaero mission pack" off
+
+ALL_TARGET= release
+
+MAKE_ENV= LIBDIR="${LIBDIR}"
+PLIST_SUB= LIBDIR=${LIBDIR:S/${PREFIX}\///}
+
+LIBDIR= ${PREFIX}/lib/${PORTNAME}
+
+KMQ2_ADDONS= KMQuake2_addons_src_unix${EXTRACT_SUFX}
+KMQ2_DATA= kmquake2_${PORTVERSION:S/.//}.zip
+KMQ2_FLARES= Flares.tar
+PAX_DATA= paximperia.zip
+PAX_PATCH= pax_101_patch.zip
+
+.include "${.CURDIR}/../quake2-data/Makefile.include"
+
+.include <bsd.port.pre.mk>
+
+MOD_LIST= 3ZB2 CTF HYBRID LIGHTS PAX ROGUE ROGUE_XATRIX XATRIX ZAERO
+
+.for mod in ${MOD_LIST}
+. if defined(WITH_${mod})
+MOD_REQUESTED+= ${mod:L}
+MAKE_ENV+= BUILD_${mod}=YES
+PLIST_SUB+= ${mod}=""
+. else
+PLIST_SUB+= ${mod}="@comment "
+. endif
+.endfor
+
+.if defined(MOD_REQUESTED)
+DISTFILES+= ${KMQ2_ADDONS}
+EXTRACT_ONLY+= ${KMQ2_ADDONS}
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-addons__Makefile
+MAKE_ENV+= KMQ2_ADDONS="${KMQ2_ADDONS:S/${EXTRACT_SUFX}//}"
+.endif
+
+.if !defined(WITHOUT_DEDICATED)
+MAKE_ENV+= BUILD_DEDICATED=YES
+PLIST_SUB+= DEDICATED=""
+.else
+PLIST_SUB+= DEDICATED="@comment "
+.endif
+
+.if !defined(WITHOUT_OPTIMIZED_CFLAGS)
+MAKE_ENV+= OPTIMIZED_CFLAGS=YES
+.endif
+
+.if defined(WITH_PAX)
+DISTFILES+= ${PAX_DATA}:pax \
+ ${PAX_PATCH}:paxpatch
+PLIST_SUB+= PAX=""
+.else
+PLIST_SUB+= PAX="@comment "
+.endif
+
+.if !defined(WITHOUT_SDL)
+USE_SDL= sdl
+MAKE_ENV+= BUILD_KMQUAKE2_SDL=YES
+PLIST_SUB+= SDL=""
+.else
+PLIST_SUB+= SDL="@comment "
+.endif
+
+.if defined(MOD_REQUESTED)
+post-patch:
+ @${FIND} ${WRKDIR}/${KMQ2_ADDONS:S/${EXTRACT_SUFX}//} \
+ -type f -print0 | ${XARGS} -0 ${REINPLACE_CMD} -e \
+ 's|__linux__|__unix__|; s|#include <bits/nan\.h>||'
+.endif
+
+post-extract:
+ @${UNZIP_CMD} -qo \
+ ${DISTDIR}/${DIST_SUBDIR}/${KMQ2_DATA} \
+ baseq2/kmquake2.pk3 -d ${WRKSRC}/quake2
+ @${TAR} xf ${DISTDIR}/${DIST_SUBDIR}/${KMQ2_FLARES} -C ${WRKSRC}
+ @${CHMOD} go-w ${WRKSRC}/quake2/baseq2/kmquake2.pk3
+.if defined(WITH_PAX)
+ @${UNZIP_CMD} -qo ${DISTDIR}/${DIST_SUBDIR}/${PAX_DATA} \
+ -x "*.dll" "*.bat" -d ${WRKSRC}/quake2/pax
+ @${UNZIP_CMD} -qo ${DISTDIR}/${DIST_SUBDIR}/${PAX_PATCH} \
+ -x "*.dll" -d ${WRKSRC}/quake2/pax
+.endif
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/quake2/${PORTNAME} ${PREFIX}/bin
+.if !defined(WITHOUT_SDL)
+ ${INSTALL_PROGRAM} ${WRKSRC}/quake2/${PORTNAME}-sdl ${PREFIX}/bin
+.endif
+ ${MKDIR} ${LIBDIR}/baseq2
+ ${CP} -Rp ${WRKSRC}/quake2/baseq2/* ${LIBDIR}/baseq2
+.if defined(MOD_REQUESTED)
+ ${CP} -Rp ${WRKDIR}/${KMQ2_ADDONS:S/${EXTRACT_SUFX}//}/quake2/* \
+ ${LIBDIR}
+.endif
+.if defined(WITH_PAX)
+ ${CP} -R ${WRKSRC}/quake2/pax ${LIBDIR}
+.endif
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+ cd ${WRKSRC} && ${INSTALL_DATA} Readme.unix kmquake2.txt ${DOCSDIR}
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/games/kmquake2/distinfo b/games/kmquake2/distinfo
new file mode 100644
index 000000000000..858faa7b1768
--- /dev/null
+++ b/games/kmquake2/distinfo
@@ -0,0 +1,18 @@
+MD5 (kmquake2/KMQuake2_019_src_unix.tar.bz2) = 9da8302911a94d0aee1451319cc4fa09
+SHA256 (kmquake2/KMQuake2_019_src_unix.tar.bz2) = ab2fa3ca4c19afed294863041d2b00ffe46ac376a5ff2486ce60873a26f70214
+SIZE (kmquake2/KMQuake2_019_src_unix.tar.bz2) = 888147
+MD5 (kmquake2/Flares.tar) = 3aabedce8651b870fb852e578adeab34
+SHA256 (kmquake2/Flares.tar) = 601107405d5aee315c71d0dccbae0a79e4f2f58801892022542f061dd724ce74
+SIZE (kmquake2/Flares.tar) = 501760
+MD5 (kmquake2/kmquake2_019.zip) = 3a870d17c26db5c3227b6779c6cc13e8
+SHA256 (kmquake2/kmquake2_019.zip) = 7a00ee04f75e5e9e8461ebead803e69b28fe9d189ab2fbdfdd3070be2697d8fb
+SIZE (kmquake2/kmquake2_019.zip) = 9671912
+MD5 (kmquake2/KMQuake2_addons_src_unix.tar.bz2) = 1378ef893ab0a513f3789d84e5a02125
+SHA256 (kmquake2/KMQuake2_addons_src_unix.tar.bz2) = 405ff591d0470698ea24e13fc431d96f9437e62150554df81da8d7c1cb180b8e
+SIZE (kmquake2/KMQuake2_addons_src_unix.tar.bz2) = 2651741
+MD5 (kmquake2/paximperia.zip) = 5231eb95c0b1209c470cf25e3473bfc5
+SHA256 (kmquake2/paximperia.zip) = 4ff15f652f191058736239a6480869bd39d9c4f3a1c77cc733167a79fc7398b5
+SIZE (kmquake2/paximperia.zip) = 38240357
+MD5 (kmquake2/pax_101_patch.zip) = 0b31bf31ea1e6c84550f1d5ff5848108
+SHA256 (kmquake2/pax_101_patch.zip) = 096da429ee0c34122c0cfbd49472b7a9ae6480e410546e6332d97fb15b3a02f5
+SIZE (kmquake2/pax_101_patch.zip) = 1342990
diff --git a/games/kmquake2/files/extra-patch-addons__Makefile b/games/kmquake2/files/extra-patch-addons__Makefile
new file mode 100644
index 000000000000..986990b1d16b
--- /dev/null
+++ b/games/kmquake2/files/extra-patch-addons__Makefile
@@ -0,0 +1,174 @@
+--- ../KMQuake2_addons_src_unix/Makefile.orig Sun Apr 9 13:33:05 2006
++++ ../KMQuake2_addons_src_unix/Makefile Sat May 20 11:55:47 2006
+@@ -17,32 +17,16 @@
+ #OPTIONS
+ ######################################
+
+-BUILD_3ZB2=YES # game$(ARCH).so for 3zb2 bots.
+-BUILD_CTF=YES # game$(ARCH).so for Capture the Flag.
+-BUILD_HYBRID=YES # game$(ARCH).so for Rogue-Xatrix hybrid.
+-BUILD_LAZARUS=YES # game$(ARCH).so for Lazarus mod.
+-BUILD_LIGHTS=YES # game$(ARCH).so for Lights mod with bots.
+-BUILD_PAX=YES # game$(ARCH).so for Pax Imperia Addon.
+-BUILD_ROGUE=YES # game$(ARCH).so for Rogue (see README for details)
+-BUILD_XATRIX=YES # game$(ARCH).so for Xatrix (see README for details)
+-BUILD_ZAERO=YES # game$(ARCH).so for Zaero (commercial expansion pack)
+
+ ######################################
+
+ ######################################
+
+-VERSION=KMQuake2_Addons
+ MOUNT_DIR=.
+ BINDIR=quake2
+
+ CC?=gcc
+-BASE_CFLAGS=
+ DEBUG_CFLAGS=$(BASE_CFLAGS) -g -ggdb -Wall -pipe
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations
+-
+-ifeq ($(ARCH),i386)
+- RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing
+-endif
+
+ BUILD_DEBUG_DIR=build_debug
+ BUILD_RELEASE_DIR=build_release
+@@ -97,39 +81,39 @@
+ endif
+
+ ifeq ($(strip $(BUILD_3ZB2)),YES)
+- TARGETS+=$(BINDIR)/3zb2/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/3zb2/kmq2game.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_CTF)),YES)
+- TARGETS+=$(BINDIR)/ctf/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/ctf/kmq2game.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_HYBRID)),YES)
+- TARGETS+=$(BINDIR)/rogue_xatrix/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/rogue_xatrix/kmq2game.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_PAX)),YES)
+- TARGETS+=$(BINDIR)/pax/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/pax/kmq2game.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_ROGUE)),YES)
+- TARGETS+=$(BINDIR)/rogue/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/rogue/kmq2game.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_XATRIX)),YES)
+- TARGETS+=$(BINDIR)/xatrix/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/xatrix/kmq2game.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_ZAERO)),YES)
+- TARGETS+=$(BINDIR)/zaero/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/zaero/kmq2game.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_LIGHTS)),YES)
+- TARGETS+=$(BINDIR)/lights/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/lights/kmq2game.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_LAZARUS)),YES)
+- TARGETS+=$(BINDIR)/lazarus/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/lazarus/kmq2game.$(SHLIBEXT)
+ endif
+
+ all:
+@@ -246,7 +230,7 @@
+ @-mkdir -p $(BINDIR)/lights
+ endif
+
+- $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS+="$(RELEASE_CFLAGS) -DKMQUAKE2_VERSION='\"$(VERSION)\"'"
++ $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS+="$(RELEASE_CFLAGS)"
+
+ targets: $(TARGETS)
+
+@@ -332,7 +316,7 @@
+ $(BUILDDIR)/lazarus/p_weapon.o \
+ $(BUILDDIR)/lazarus/q_shared.o
+
+-$(BINDIR)/lazarus/kmq2game$(ARCH).$(SHLIBEXT) : $(LAZARUS_OBJS)
++$(BINDIR)/lazarus/kmq2game.$(SHLIBEXT) : $(LAZARUS_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(LAZARUS_OBJS)
+
+ $(BUILDDIR)/lazarus/acebot_ai.o : $(LAZARUS_DIR)/acesrc/acebot_ai.c
+@@ -597,7 +581,7 @@
+ $(BUILDDIR)/ctf/p_weapon.o \
+ $(BUILDDIR)/ctf/q_shared.o
+
+-$(BINDIR)/ctf/kmq2game$(ARCH).$(SHLIBEXT) : $(CTF_OBJS)
++$(BINDIR)/ctf/kmq2game.$(SHLIBEXT) : $(CTF_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(CTF_OBJS)
+
+ $(BUILDDIR)/ctf/g_ai.o : $(CTF_DIR)/g_ai.c
+@@ -736,7 +720,7 @@
+ $(BUILDDIR)/xatrix/p_weapon.o \
+ $(BUILDDIR)/xatrix/q_shared.o
+
+-$(BINDIR)/xatrix/kmq2game$(ARCH).$(SHLIBEXT) : $(XATRIX_OBJS)
++$(BINDIR)/xatrix/kmq2game.$(SHLIBEXT) : $(XATRIX_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(XATRIX_OBJS)
+
+ $(BUILDDIR)/xatrix/g_ai.o : $(XATRIX_DIR)/g_ai.c
+@@ -963,7 +947,7 @@
+ $(BUILDDIR)/rogue/p_weapon.o \
+ $(BUILDDIR)/rogue/q_shared.o
+
+-$(BINDIR)/rogue/kmq2game$(ARCH).$(SHLIBEXT) : $(ROGUE_OBJS)
++$(BINDIR)/rogue/kmq2game.$(SHLIBEXT) : $(ROGUE_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(ROGUE_OBJS)
+
+ $(BUILDDIR)/rogue/dm_ball.o : $(ROGUE_DIR)/dm_ball.c
+@@ -1222,7 +1206,7 @@
+ $(BUILDDIR)/zaero/q_shared.o
+
+
+-$(BINDIR)/zaero/kmq2game$(ARCH).$(SHLIBEXT) : $(ZAERO_OBJS)
++$(BINDIR)/zaero/kmq2game.$(SHLIBEXT) : $(ZAERO_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(ZAERO_OBJS)
+
+ $(BUILDDIR)/zaero/g_ai.o : $(ZAERO_DIR)/g_ai.c
+@@ -1505,7 +1489,7 @@
+ $(BUILDDIR)/pax/p_weapon.o \
+ $(BUILDDIR)/pax/q_shared.o
+
+-$(BINDIR)/pax/kmq2game$(ARCH).$(SHLIBEXT) : $(PAX_OBJS)
++$(BINDIR)/pax/kmq2game.$(SHLIBEXT) : $(PAX_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(PAX_OBJS)
+
+ $(BUILDDIR)/pax/dm_ball.o : $(PAX_DIR)/dm_ball.c
+@@ -1802,7 +1786,7 @@
+ $(BUILDDIR)/3zb2/p_weapon.o \
+ $(BUILDDIR)/3zb2/q_shared.o
+
+-$(BINDIR)/3zb2/kmq2game$(ARCH).$(SHLIBEXT) : $(3ZB2_OBJS)
++$(BINDIR)/3zb2/kmq2game.$(SHLIBEXT) : $(3ZB2_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(3ZB2_OBJS)
+
+ $(BUILDDIR)/3zb2/bot.o : $(3ZB2_DIR)/bot.c
+@@ -1962,7 +1946,7 @@
+ $(BUILDDIR)/lights/scanner.o \
+ $(BUILDDIR)/lights/m_flash.o
+
+-$(BINDIR)/lights/kmq2game$(ARCH).$(SHLIBEXT) : $(LBOTS_OBJS)
++$(BINDIR)/lights/kmq2game.$(SHLIBEXT) : $(LBOTS_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(LBOTS_OBJS)
+
+ $(BUILDDIR)/lights/acebot_ai.o : $(LBOTS_DIR)/ace/acebot_ai.c
+@@ -2242,7 +2226,7 @@
+ $(BUILDDIR)/rogue_xatrix/p_weapon.o \
+ $(BUILDDIR)/rogue_xatrix/q_shared.o
+
+-$(BINDIR)/rogue_xatrix/kmq2game$(ARCH).$(SHLIBEXT) : $(HYBRID_OBJS)
++$(BINDIR)/rogue_xatrix/kmq2game.$(SHLIBEXT) : $(HYBRID_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(HYBRID_OBJS)
+
+ $(BUILDDIR)/rogue_xatrix/dm_ball.o : $(HYBRID_DIR)/dm_ball.c
diff --git a/games/kmquake2/files/patch-Makefile b/games/kmquake2/files/patch-Makefile
new file mode 100644
index 000000000000..a2a8708815a4
--- /dev/null
+++ b/games/kmquake2/files/patch-Makefile
@@ -0,0 +1,91 @@
+--- ./Makefile.orig Mon Apr 10 04:38:03 2006
++++ ./Makefile Sat May 20 13:44:43 2006
+@@ -20,12 +20,12 @@
+ #OPTIONS
+ ######################################
+
+-BUILD_DATADIR=NO # Use DATADIR to read (data, renderers, etc.) and ~/.quake2 to write.
++BUILD_DATADIR=YES # Use DATADIR to read (data, renderers, etc.) and ~/.quake2 to write.
+ BUILD_GAME=YES # game$(ARCH).so
+ BUILD_KMQUAKE2=YES # kmquake executable (uses OSS for cdrom and sound)
+-BUILD_KMQUAKE2_DEDICATED=YES # build a dedicated kmquake2 server
+-BUILD_KMQUAKE2_SDL=YES # kmquake2-sdl executable (uses SDL for cdrom and sound)
+-BUILD_LIBDIR=NO # Use LIBDIR to read data and renderers (independent from DATADIR).
++#BUILD_KMQUAKE2_DEDICATED=YES # build a dedicated kmquake2 server
++#BUILD_KMQUAKE2_SDL=YES # kmquake2-sdl executable (uses SDL for cdrom and sound)
++BUILD_LIBDIR=YES # Use LIBDIR to read data and renderers (independent from DATADIR).
+
+ ######################################
+
+@@ -38,13 +38,17 @@
+ BINDIR=quake2
+
+ CC?=gcc
+-BASE_CFLAGS=
++BASE_CFLAGS=$(CFLAGS)
+ DEBUG_CFLAGS=$(BASE_CFLAGS) -g -ggdb -Wall -pipe
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations
++RELEASE_CFLAGS=$(BASE_CFLAGS)
++
++ifdef OPTIMIZED_CFLAGS
++RELEASE_CFLAGS+=-O2 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations
+
+ ifeq ($(ARCH),i386)
+ RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing
+ endif
++endif
+
+ CLIENT_DIR=$(MOUNT_DIR)/client
+ SERVER_DIR=$(MOUNT_DIR)/server
+@@ -72,7 +76,7 @@
+ X11BASE?=/usr/X11R6
+ PREFIX?=$(LOCALBASE)
+
+-DATADIR?=$(LOCALBASE)/share/quake2
++Q2DIR?=$(LOCALBASE)/share/quake2
+ LIBDIR?=$(LOCALBASE)/lib/kmquake2
+
+ XCFLAGS=-I$(X11BASE)/include
+@@ -91,7 +95,7 @@
+ endif
+
+ ifeq ($(strip $(BUILD_DATADIR)),YES)
+- BASE_CFLAGS+=-DDATADIR='\"$(DATADIR)\"'
++ BASE_CFLAGS+=-DDATADIR='\"$(Q2DIR)\"'
+ endif
+
+ ifeq ($(strip $(BUILD_KMQUAKE2_SDL)),YES)
+@@ -136,7 +140,11 @@
+ endif
+
+ ifeq ($(strip $(BUILD_GAME)),YES)
+- TARGETS+=$(BINDIR)/baseq2/kmq2game$(ARCH).$(SHLIBEXT)
++ TARGETS+=$(BINDIR)/baseq2/kmq2game.$(SHLIBEXT)
++endif
++
++ifdef KMQ2_ADDONS
++ TARGETS += addons
+ endif
+
+ all:
+@@ -293,6 +301,9 @@
+ @echo
+ $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_AS_OBJS) $(QUAKE2_SDL_OBJS) $(GLXLDFLAGS) $(LDFLAGS) $(SDLLDFLAGS)
+
++addons:
++ $(MAKE) -C ../$(KMQ2_ADDONS) release
++
+ $(BUILDDIR)/client/cl_cin.o : $(CLIENT_DIR)/cl_cin.c
+ $(DO_CC)
+
+@@ -753,8 +764,8 @@
+ $(BUILDDIR)/game/p_weapon.o \
+ $(BUILDDIR)/game/q_shared.o
+
+-$(BINDIR)/baseq2/kmq2game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
+- $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) -lGL
++$(BINDIR)/baseq2/kmq2game.$(SHLIBEXT) : $(GAME_OBJS)
++ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) -L$(X11BASE)/lib -lGL
+
+ $(BUILDDIR)/game/acebot_ai.o : $(GAME_DIR)/acesrc/acebot_ai.c
+ $(DO_SHLIB_CC)
diff --git a/games/kmquake2/files/patch-client__snd_loc.h b/games/kmquake2/files/patch-client__snd_loc.h
new file mode 100644
index 000000000000..d92606a50972
--- /dev/null
+++ b/games/kmquake2/files/patch-client__snd_loc.h
@@ -0,0 +1,11 @@
+--- ./client/snd_loc.h.orig Wed Jan 11 10:51:56 2006
++++ ./client/snd_loc.h Sat May 20 13:44:43 2006
+@@ -22,7 +22,7 @@
+ #ifdef OGG_SUPPORT
+ #if defined __unix__
+ #include <vorbis/vorbisfile.h> // Knightmare added- vorbis support
+-#include <AL/altypes.h>
++#include <AL/al.h>
+ #else
+ #include "include/vorbisfile.h" // Knightmare added- vorbis support
+ #include "include/altypes.h"
diff --git a/games/kmquake2/files/patch-qcommon__files.c b/games/kmquake2/files/patch-qcommon__files.c
new file mode 100644
index 000000000000..48e12bec86f6
--- /dev/null
+++ b/games/kmquake2/files/patch-qcommon__files.c
@@ -0,0 +1,19 @@
+--- ./qcommon/files.c.orig Thu Mar 23 06:30:01 2006
++++ ./qcommon/files.c Sat May 20 13:44:43 2006
+@@ -1314,7 +1314,7 @@
+ char *homedir; /* Home directory. */
+
+ if ((homedir = getenv("HOME")) != NULL) {
+- Com_sprintf(gdir, sizeof(gdir), "%s/.quake2/%s", homedir, dir);
++ Com_sprintf(gdir, sizeof(gdir), "%s/.kmquake2/%s", homedir, dir);
+ FS_AddGameDirectory(gdir);
+ }
+ }
+@@ -1512,6 +1512,7 @@
+
+ #ifdef __unix__
+ /* Create directory if it does not exist. */
++ FS_CreatePath(fs_gamedir);
+ Sys_Mkdir(fs_gamedir);
+
+ Com_Printf("Using '%s' for writing.\n", fs_gamedir);
diff --git a/games/kmquake2/files/patch-unix__gl_glx.c b/games/kmquake2/files/patch-unix__gl_glx.c
new file mode 100644
index 000000000000..cd18c89ce56e
--- /dev/null
+++ b/games/kmquake2/files/patch-unix__gl_glx.c
@@ -0,0 +1,30 @@
+--- ./unix/gl_glx.c.orig Mon Apr 3 14:40:42 2006
++++ ./unix/gl_glx.c Sat May 20 13:51:55 2006
+@@ -379,15 +379,11 @@
+ }
+ else
+ {
+- if( !event.xmotion.send_event ) {
+- mx += event.xmotion.x - p_mouse_x;
+- my += event.xmotion.y - p_mouse_y;
++ mx += (event.xmotion.x - mwx) * 2;
++ my += (event.xmotion.y - mwy) * 2;
+
+- if( abs( mwx - event.xmotion.x ) > mwx / 2 || abs( mwy - event.xmotion.y ) > mwy / 2 )
++ if (mwx || mwy)
+ dowarp = true;
+- }
+- p_mouse_x = event.xmotion.x;
+- p_mouse_y = event.xmotion.y;
+ }
+ }
+ break;
+@@ -451,8 +447,6 @@
+ if (dowarp)
+ {
+ /* move the mouse to the window center again */
+- p_mouse_x = mwx;
+- p_mouse_y = mwy;
+ XWarpPointer (dpy, None, win, 0, 0, 0, 0, mwx, mwy);
+ }
+ }
diff --git a/games/kmquake2/files/patch-unix__sys_unix.c b/games/kmquake2/files/patch-unix__sys_unix.c
new file mode 100644
index 000000000000..3f0eac9af753
--- /dev/null
+++ b/games/kmquake2/files/patch-unix__sys_unix.c
@@ -0,0 +1,45 @@
+--- ./unix/sys_unix.c.orig Thu Apr 6 11:30:11 2006
++++ ./unix/sys_unix.c Sat May 20 13:44:43 2006
+@@ -219,23 +219,10 @@
+ void *(*GetGameAPI) (void *);
+
+ char name[MAX_OSPATH];
+- char curpath[MAX_OSPATH];
+ char *path;
+
+ // Knightmare- changed game library name for better cohabitation
+-#ifdef __i386__
+- const char *gamename = "kmq2gamei386.so";
+-#elif defined __alpha__
+- const char *gamename = "kmq2gameaxp.so";
+-#elif defined __x86_64__
+- const char *gamename = "kmq2gamex86_64.so";
+-#elif defined __powerpc__
+- const char *gamename = "kmq2gameppc.so";
+-#elif defined __sparc__
+- const char *gamename = "kmq2gamesparc.so";
+-#else
+-#error Unknown arch
+-#endif
++ const char *gamename = "kmq2game.so";
+
+ setreuid(getuid(), getuid());
+ setegid(getgid());
+@@ -243,8 +230,6 @@
+ if (game_library)
+ Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
+
+- getcwd(curpath, sizeof(curpath));
+-
+ Com_Printf("------- Loading %s -------\n", gamename);
+
+ // now run through the search paths
+@@ -254,7 +239,7 @@
+ path = FS_NextPath (path);
+ if (!path)
+ return NULL; // couldn't find one anywhere
+- sprintf (name, "%s/%s/%s", curpath, path, gamename);
++ sprintf (name, "%s/%s", path, gamename);
+ game_library = dlopen (name, RTLD_LAZY );
+ if (game_library)
+ {
diff --git a/games/kmquake2/pkg-descr b/games/kmquake2/pkg-descr
new file mode 100644
index 000000000000..37fa2cf949bd
--- /dev/null
+++ b/games/kmquake2/pkg-descr
@@ -0,0 +1,3 @@
+Enhanced Quake2 OpenGL only engine with integrated Lazarus support.
+
+WWW: http://www.geocities.com/knightmare66/
diff --git a/games/kmquake2/pkg-plist b/games/kmquake2/pkg-plist
new file mode 100644
index 000000000000..2b0e281029bd
--- /dev/null
+++ b/games/kmquake2/pkg-plist
@@ -0,0 +1,48 @@
+bin/kmquake2
+%%SDL%%bin/kmquake2-sdl
+%%3ZB2%%%%LIBDIR%%/3zb2/kmq2game.so
+%%LIBDIR%%/baseq2/gfx/flare1.png
+%%LIBDIR%%/baseq2/gfx/flare2.png
+%%LIBDIR%%/baseq2/gfx/flare3.png
+%%LIBDIR%%/baseq2/gfx/flare4.png
+%%LIBDIR%%/baseq2/gfx/flare5.png
+%%LIBDIR%%/baseq2/gfx/flare6.png
+%%LIBDIR%%/baseq2/kmq2game.so
+%%LIBDIR%%/baseq2/kmquake2.pk3
+%%CTF%%%%LIBDIR%%/ctf/kmq2game.so
+%%LIGHTS%%%%LIBDIR%%/lights/kmq2game.so
+%%PAX%%%%LIBDIR%%/pax/default.cfg
+%%PAX%%%%LIBDIR%%/pax/kmq2game.so
+%%PAX%%%%LIBDIR%%/pax/levelshots/pax.jpg
+%%PAX%%%%LIBDIR%%/pax/levelshots/pax2.jpg
+%%PAX%%%%LIBDIR%%/pax/levelshots/pax3.jpg
+%%PAX%%%%LIBDIR%%/pax/levelshots/pax4.jpg
+%%PAX%%%%LIBDIR%%/pax/levelshots/pax5.jpg
+%%PAX%%%%LIBDIR%%/pax/levelshots/pax6.jpg
+%%PAX%%%%LIBDIR%%/pax/levelshots/pax7.jpg
+%%PAX%%%%LIBDIR%%/pax/levelshots/pax8.jpg
+%%PAX%%%%LIBDIR%%/pax/pax.pak
+%%PAX%%%%LIBDIR%%/pax/paxpatch.pak
+%%PAX%%%%LIBDIR%%/pax/readme.html
+%%PAX%%%%LIBDIR%%/pax/sound/world/driller1.wav
+%%ROGUE%%%%LIBDIR%%/rogue/kmq2game.so
+%%HYBRID%%%%LIBDIR%%/rogue_xatrix/kmq2game.so
+%%XATRIX%%%%LIBDIR%%/xatrix/kmq2game.so
+%%ZAERO%%%%LIBDIR%%/zaero/kmq2game.so
+%%PORTDOCS%%%%DOCSDIR%%/Readme.unix
+%%PORTDOCS%%%%DOCSDIR%%/kmquake2.txt
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+%%ZAERO%%@dirrm %%LIBDIR%%/zaero
+%%XATRIX%%@dirrm %%LIBDIR%%/xatrix
+%%HYBRID%%@dirrm %%LIBDIR%%/rogue_xatrix
+%%ROGUE%%@dirrm %%LIBDIR%%/rogue
+%%PAX%%@dirrm %%LIBDIR%%/pax/sound/world
+%%PAX%%@dirrm %%LIBDIR%%/pax/sound
+%%PAX%%@dirrm %%LIBDIR%%/pax/levelshots
+%%PAX%%@dirrm %%LIBDIR%%/pax
+%%LIGHTS%%@dirrm %%LIBDIR%%/lights
+%%CTF%%@dirrm %%LIBDIR%%/ctf
+@dirrm %%LIBDIR%%/baseq2/gfx
+@dirrm %%LIBDIR%%/baseq2
+%%3ZB2%%@dirrm %%LIBDIR%%/3zb2
+@dirrm %%LIBDIR%%