summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /games-fps/duke3d
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'games-fps/duke3d')
-rw-r--r--games-fps/duke3d/Manifest2
-rw-r--r--games-fps/duke3d/duke3d-20040817-r2.ebuild134
-rw-r--r--games-fps/duke3d/files/20040817-credits.patch38
-rw-r--r--games-fps/duke3d/files/20040817-duke3d-makefile-opts.patch33
-rw-r--r--games-fps/duke3d/files/20040817-endian.patch26
-rw-r--r--games-fps/duke3d/files/20040817-gcc34.patch82
-rw-r--r--games-fps/duke3d/files/20040817-gcc4.patch75
-rw-r--r--games-fps/duke3d/files/duke3d-20040817-as-needed.patch74
-rw-r--r--games-fps/duke3d/files/duke3d-20040817-gcc4.patch180
-rw-r--r--games-fps/duke3d/files/duke3d-20040817-ldflags.patch66
-rw-r--r--games-fps/duke3d/files/duke3d-20040817-noinline.patch18
-rw-r--r--games-fps/duke3d/files/duke3d.cfg194
-rw-r--r--games-fps/duke3d/files/network.cfg15
-rw-r--r--games-fps/duke3d/metadata.xml58
14 files changed, 995 insertions, 0 deletions
diff --git a/games-fps/duke3d/Manifest b/games-fps/duke3d/Manifest
new file mode 100644
index 000000000000..79912b73fed3
--- /dev/null
+++ b/games-fps/duke3d/Manifest
@@ -0,0 +1,2 @@
+DIST 3dduke13.zip 5924374 SHA256 c67efd179022bc6d9bde54f404c707cbcbdc15423c20be72e277bc2bdddf3d0e SHA512 eb92daa88b4e7cfeebe1fb3d2c021e0a4a66262d0d6e76b5e27fe3cedd382e381d23b392a6d9adb42a418b9318e011c2d8adfbdc77d7c5371e61d8c091c7eb65 WHIRLPOOL 9f3b9620d042a0209c707e83822fa1acff370504c76a558a6c36452b7f7c701e8289f8b389146cdd6899f47783c318a81792a7702f68d1ca62b31fc2c6844921
+DIST duke3d-20040817.tar.bz2 1509273 SHA256 c0dd72030f9c5b84aea3e4989831311c94ef21641d6a1fdb0f557d04076f641f SHA512 a08aa07153458501fb01878769af9797460525015b34d743250e3f04f15ee2dcfbb4110c94c83912ba2435e6d6c48127e2d36c0dc29833e0f6f95e3b925b571c WHIRLPOOL b0e27cae348601980e18f95a6507bc3080a51fe4f70919127eefd9cc90185dcd4cb287e970c2fa1ecc4a6b04422804748a071006e1b4551cde73e4cd18abe40a
diff --git a/games-fps/duke3d/duke3d-20040817-r2.ebuild b/games-fps/duke3d/duke3d-20040817-r2.ebuild
new file mode 100644
index 000000000000..34155305c748
--- /dev/null
+++ b/games-fps/duke3d/duke3d-20040817-r2.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+fromcvs=0
+ECVS_MODULE="duke3d"
+if [[ ${fromcvs} -eq 1 ]] ; then
+ ECVS_PASS="anonymous"
+ ECVS_SERVER="icculus.org:/cvs/cvsroot"
+ inherit unpacker cvs eutils flag-o-matic games
+else
+ inherit unpacker eutils flag-o-matic games
+fi
+
+DEMO="3dduke13.zip"
+
+DESCRIPTION="Port of the original Duke Nukem 3D"
+HOMEPAGE="http://icculus.org/projects/duke3d/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2
+ demo? (
+ ftp://ftp.3drealms.com/share/${DEMO}
+ ftp://ftp.planetmirror.com/pub/gameworld/downloads/${DEMO}
+ )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="hppa ppc x86"
+IUSE="demo pic perl opengl"
+
+RDEPEND="media-libs/libsdl
+ media-libs/sdl-mixer
+ media-sound/timidity++
+ media-sound/timidity-eawpatches
+ perl? ( dev-lang/perl[-ithreads] )
+ opengl? ( virtual/opengl )"
+DEPEND="${RDEPEND}
+ demo? ( app-arch/unzip )
+ !pic? ( x86? ( dev-lang/nasm ) )"
+
+S=${WORKDIR}/${PN}
+
+use_tf() { use ${1} && echo "true" || echo "false"; }
+
+src_unpack() {
+ if [[ ${fromcvs} -eq 1 ]] ; then
+ cvs_src_unpack
+ cd duke3d/source
+ ECVS_MODULE="buildengine"
+ cvs_src_unpack
+ else
+ unpack ${A}
+ fi
+
+ if use demo ; then
+ unpack_zip DN3DSW13.SHR
+ fi
+}
+
+src_prepare() {
+ # configure buildengine
+ cd "${S}/source/buildengine"
+ sed -i \
+ -e "/^useperl := / s:=.*:= $(use_tf perl):" \
+ -e "/^useopengl := / s:=.*:= $(use_tf opengl):" \
+ -e "/^usephysfs := / s:=.*:= false:" \
+ -e 's:-O3::' -e 's: -g : :' \
+ -e 's:/usr/lib/perl5/i386-linux/CORE/libperl.a::' \
+ Makefile \
+ || die "sed build Makefile failed"
+ epatch "${FILESDIR}/${PV}-endian.patch"
+
+ # configure duke3d
+ cd "${S}/source"
+ # need to sync features with build engine
+ epatch \
+ "${FILESDIR}/${PV}-credits.patch" \
+ "${FILESDIR}/${PV}-duke3d-makefile-opts.patch" \
+ "${FILESDIR}/${PV}-gcc34.patch" \
+ "${FILESDIR}"/${P}-gcc4.patch \
+ "${FILESDIR}"/${P}-noinline.patch \
+ "${FILESDIR}"/${P}-as-needed.patch \
+ "${FILESDIR}"/${P}-ldflags.patch
+ sed -i \
+ -e "/^use_opengl := / s:=.*:= $(use_tf opengl):" \
+ -e "/^use_physfs := / s:=.*:= false:" \
+ Makefile \
+ || die "sed duke3d Makefile failed"
+ if ! use pic && use x86 ; then
+ sed -i \
+ -e 's:^#USE_ASM:USE_ASM:' buildengine/Makefile \
+ || die "sed failed"
+ sed -i \
+ -e '/^#use_asm := /s:#::' Makefile \
+ || die "sed failed"
+ fi
+
+ # causes crazy redefine errors with gcc-3.[2-4].x
+ replace-flags -O3 -O2
+ strip-flags #203969
+}
+
+src_compile() {
+ emake -C source/buildengine OPTFLAGS="${CFLAGS}" || die "buildengine failed"
+ emake -C source OPTIMIZE="${CFLAGS}" || die "duke3d failed"
+}
+
+src_install() {
+ games_make_wrapper duke3d "${GAMES_BINDIR}/duke3d.bin" "${GAMES_DATADIR}/${PN}"
+ newgamesbin source/duke3d duke3d.bin || die "newgamesbin failed"
+
+ dodoc readme.txt
+
+ cd testdata
+ insinto "${GAMES_DATADIR}/${PN}"
+ newins defs.con DEFS.CON
+ newins game.con GAME.CON
+ newins user.con USER.CON
+ newins "${FILESDIR}/network.cfg" network.cfg.template
+ if use demo ; then
+ doins "${WORKDIR}/DUKE3D.GRP" || die "doins DUKE3D.GRP failed"
+ fi
+
+ insinto "${GAMES_SYSCONFDIR}"
+ doins "${FILESDIR}/duke3d.cfg"
+ dosym "${GAMES_SYSCONFDIR}/duke3d.cfg" "${GAMES_DATADIR}/${PN}/DUKE3D.CFG"
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ use demo || elog "Put the data files in ${GAMES_DATADIR}/${PN} before playing"
+}
diff --git a/games-fps/duke3d/files/20040817-credits.patch b/games-fps/duke3d/files/20040817-credits.patch
new file mode 100644
index 000000000000..176fcd74752b
--- /dev/null
+++ b/games-fps/duke3d/files/20040817-credits.patch
@@ -0,0 +1,38 @@
+--- menues.c 2003-08-17 22:16:10.000000000 +0200
++++ menues.c 2004-03-29 01:59:28.000000000 +0200
+@@ -1747,9 +1747,10 @@
+ case 996:
+ case 997:
+
+-// rotatesprite(c<<16,200<<15,65536L,0,MENUSCREEN,16,0,10+64,0,0,xdim-1,ydim-1);
+-// rotatesprite(c<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
+-// menutext(c,24,0,0,"CREDITS");
++ c = (320>>1);
++ rotatesprite(c<<16,200<<15,65536L,0,MENUSCREEN,16,0,10+64,0,0,xdim-1,ydim-1);
++ rotatesprite(c<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
++ menutext(c,24,0,0,"CREDITS");
+
+ if(KB_KeyPressed(sc_Escape)) { cmenu(0); break; }
+
+@@ -1926,6 +1927,21 @@
+
+ menutext(c,67+16+16+16+16+16,SHX(-7),PHX(-7),"QUIT");
+
++ gametext(c,67+16+16+16+16+16+16+16,"Duke Nukem 3D for "
++#if defined PLATFORM_MACOSX
++ "MacOS"
++#elif defined PLATFORM_DOS
++ "MS-Dos"
++#elif defined PLATFORM_WIN32
++ "Win32"
++#elif defined PLATFORM_UNIX
++ "Gentoo"
++#else
++ "unknown"
++#endif
++ ,16,2+8+16);
++ gametext(c,67+16+16+16+16+16+16+16+9,"build " __DATE__ " " __TIME__,16,2+8+16);
++
+ break;
+ // CTW END - MODIFICATION
+
diff --git a/games-fps/duke3d/files/20040817-duke3d-makefile-opts.patch b/games-fps/duke3d/files/20040817-duke3d-makefile-opts.patch
new file mode 100644
index 000000000000..d23f7a118f77
--- /dev/null
+++ b/games-fps/duke3d/files/20040817-duke3d-makefile-opts.patch
@@ -0,0 +1,33 @@
+--- Makefile.orig 2003-08-17 17:45:35.948650760 -0400
++++ Makefile 2003-08-17 17:46:36.894385600 -0400
+@@ -4,6 +4,8 @@
+ beos := false
+ macosx := false
+ #use_asm := true
++use_opengl := true
++use_physfs := false
+
+ #-----------------------------------------------------------------------------#
+ # If this makefile fails to detect Cygwin correctly, or you want to force
+@@ -80,6 +81,10 @@
+ buildengine/pragmas.o \
+ buildengine/unix_compat.o
+
++ifeq ($(strip $(use_opengl)),true)
++ BUILDOBJS += buildengine/buildgl.o
++endif
++
+ ifeq ($(strip $(use_asm)),true)
+ BUILDOBJS += buildengine/a_gnu.o buildengine/a_nasm.o
+ else
+@@ -106,6 +106,10 @@
+
+ LDLIBS = $(SDL_LDFLAGS) -lSDL -lSDL_mixer $(EXTRALDFLAGS)
+
++ifeq ($(strip $(use_physfs)),true)
++ LDLIBS += -lphysfs
++endif
++
+ # !!! FIXME: Do we even need this? It doesn't fly on MacOS X. --ryan.
+ #LDLIBS += -Wl,-E
+
diff --git a/games-fps/duke3d/files/20040817-endian.patch b/games-fps/duke3d/files/20040817-endian.patch
new file mode 100644
index 000000000000..a22d07fb09f1
--- /dev/null
+++ b/games-fps/duke3d/files/20040817-endian.patch
@@ -0,0 +1,26 @@
+--- duke3d/source/buildengine/platform.h 2003-08-07 12:06:17.000000000 +0200
++++ duke3d.new/source/buildengine/platform.h 2004-08-24 18:35:05.292291088 +0200
+@@ -5,6 +5,7 @@
+ #include "win32_compat.h"
+ #elif (defined PLATFORM_UNIX)
+ #include "unix_compat.h"
++#include <endian.h>
+ #elif (defined PLATFORM_DOS)
+ #include "doscmpat.h"
+ #else
+@@ -60,9 +61,15 @@
+ #define BUILDSWAP_INTEL16(x) _swap16(x)
+ #define BUILDSWAP_INTEL32(x) _swap32(x)
+ #else
++#if __BYTE_ORDER == __LITTLE_ENDIAN
+ #define PLATFORM_LITTLEENDIAN 1
+ #define BUILDSWAP_INTEL16(x) (x)
+ #define BUILDSWAP_INTEL32(x) (x)
++#else
++#define PLATFORM_BIGENDIAN 1
++#define BUILDSWAP_INTEL16(x) _swap16(x)
++#define BUILDSWAP_INTEL32(x) _swap32(x)
++#endif
+ #endif
+
+ extern int has_altivec; /* PowerPC-specific. */
diff --git a/games-fps/duke3d/files/20040817-gcc34.patch b/games-fps/duke3d/files/20040817-gcc34.patch
new file mode 100644
index 000000000000..a7de9c116383
--- /dev/null
+++ b/games-fps/duke3d/files/20040817-gcc34.patch
@@ -0,0 +1,82 @@
+--- source/astub.c.orig 2004-08-22 14:44:50.691126872 +0100
++++ source/astub.c 2004-08-22 14:47:15.532107696 +0100
+@@ -540,6 +540,11 @@
+ return(tempbuf);
+ } //end
+
++void SpriteName(short spritenum, char *lo2)
++{
++ sprintf(lo2,names[sprite[spritenum].picnum]);
++}// end SpriteName
++
+ const char *ExtGetSpriteCaption(short spritenum)
+ {
+
+@@ -608,7 +613,11 @@
+ // y1, y2 0-143 (status bar is 144 high, origin is top-left of STATUS BAR)
+ // col 0-15
+
+-
++void PrintStatus(char *string,int num,char x,char y,char color)
++{
++ sprintf(tempbuf,"%s %d",string,num);
++ printext16(x*8,y*8,color,-1,tempbuf,0);
++}
+
+ void TotalMem()
+ {
+@@ -1276,18 +1285,6 @@
+
+ }
+
+-
+-void PrintStatus(char *string,int num,char x,char y,char color)
+-{
+- sprintf(tempbuf,"%s %d",string,num);
+- printext16(x*8,y*8,color,-1,tempbuf,0);
+-}
+-
+-void SpriteName(short spritenum, char *lo2)
+-{
+- sprintf(lo2,names[sprite[spritenum].picnum]);
+-}// end SpriteName
+-
+ char GAMEpalette[768];
+ char WATERpalette[768];
+ char SLIMEpalette[768];
+@@ -1326,6 +1323,17 @@
+ ReadGamePalette();
+ }// end ReadPaletteTable
+
++void Ver()
++{
++ sprintf(tempbuf,"DUKE NUKEM BUILD: V032696");
++ if (qsetmode == 200) //In 3D mode
++ { printext256(60*8,24*8,11,-1,tempbuf,1);
++ rotatesprite((320-8)<<16,(200-8)<<16,64<<9,0,SPINNINGNUKEICON+(((4-totalclock>>3))&7),0,0,0,0,0,xdim-1,ydim-1);
++ }else
++ { printext16(0,0,15,-1,tempbuf,0);
++ }
++}
++
+ void Keys3d(void)
+ {
+ long i,count,rate,nexti;
+@@ -2206,17 +2214,6 @@
+ }
+ }
+
+-void Ver()
+-{
+- sprintf(tempbuf,"DUKE NUKEM BUILD: V032696");
+- if (qsetmode == 200) //In 3D mode
+- { printext256(60*8,24*8,11,-1,tempbuf,1);
+- rotatesprite((320-8)<<16,(200-8)<<16,64<<9,0,SPINNINGNUKEICON+(((4-totalclock>>3))&7),0,0,0,0,0,xdim-1,ydim-1);
+- }else
+- { printext16(0,0,15,-1,tempbuf,0);
+- }
+-}
+-
+ ActorMem(int i)
+ {int total=0,j;
+ switch(i)
diff --git a/games-fps/duke3d/files/20040817-gcc4.patch b/games-fps/duke3d/files/20040817-gcc4.patch
new file mode 100644
index 000000000000..d79dda96c35b
--- /dev/null
+++ b/games-fps/duke3d/files/20040817-gcc4.patch
@@ -0,0 +1,75 @@
+iff -ur duke3d/source/buildengine/a.c duke3d-gcc4/source/buildengine/a.c
+--- duke3d/source/buildengine/a.c 2004-11-25 13:55:21.000000000 -0500
++++ duke3d-gcc4/source/buildengine/a.c 2005-06-18 18:14:24.000000000 -0400
+@@ -186,7 +186,9 @@
+ if (i3 == 0)
+ {
+ i1 += i4;
+- ((unsigned long)i4) >>= mach3_al;
++ unsigned long temp = i4;
++ temp >>= mach3_al;
++ i4 = temp;
+ i4 = (i4&0xffffff00) | (source[i4]&0xff);
+ *dest = ((unsigned char*)i2)[i4];
+ return i1;
+diff -ur duke3d/source/buildengine/pragmas.c duke3d-gcc4/source/buildengine/pragmas.c
+--- duke3d/source/buildengine/pragmas.c 2003-07-25 20:11:32.000000000 -0400
++++ duke3d-gcc4/source/buildengine/pragmas.c 2005-06-18 18:25:37.000000000 -0400
+@@ -56,28 +56,39 @@
+
+ void clearbufbyte(void *buffer, int size, long fill_value) {
+ int lsize;
++ unsigned char *p=buffer;
++ unsigned short *s=buffer;
+ switch(size){
+ case 0: return;
+- case 1: *((unsigned char*)buffer)++ = fill_value; return;
+- case 2: *((unsigned short*)buffer)++ = fill_value; return;
+- case 3: { unsigned char *p=buffer; p[2]=p[1]=p[0] = fill_value;} return;
++ case 1: ++p; *p = fill_value; return;
++ case 2: ++s; *s = fill_value; return;
++ case 3: { p[2]=p[1]=p[0] = fill_value;} return;
+ default:
+ if ((int)buffer&1) {
+- *((unsigned char*)buffer)++ = fill_value; size--;
++ ++p; *p = fill_value; size--;
++ buffer = p;
+ }
+ if ((int)buffer&2) {
+- *((unsigned short*)buffer)++ = fill_value; size-=2;
++ ++s; *s = fill_value; size-=2;
++ buffer = s;
+ }
+ lsize = size>>2;
++ unsigned int *up = buffer;
+ while(lsize) {
+- *((unsigned int*)buffer)++ = fill_value;
++ ++up;
++ *up = fill_value;
+ lsize--;
+ }
++ buffer = up;
+ if (size&2) {
+- *((unsigned short*)buffer)++ = fill_value;
++ s = buffer;
++ ++s;
++ *s = fill_value;
+ }
+ if (size&1) {
+- *((unsigned char*)buffer)++ = fill_value;
++ p = buffer;
++ ++p;
++ *p = fill_value;
+ }
+ }
+ }
+@@ -122,7 +133,7 @@
+ {
+ *((unsigned short *)source) = ((linum>>16)&0xffff);
+ linum += linum_inc;
+- ((unsigned char*)source) = ((unsigned char*)source) + 2;
++ source = ((unsigned char*)source) + 2;
+ size--;
+ if (size == 0) return;
+ }
+
diff --git a/games-fps/duke3d/files/duke3d-20040817-as-needed.patch b/games-fps/duke3d/files/duke3d-20040817-as-needed.patch
new file mode 100644
index 000000000000..5eb90fea3e14
--- /dev/null
+++ b/games-fps/duke3d/files/duke3d-20040817-as-needed.patch
@@ -0,0 +1,74 @@
+diff -ur duke3d/source/buildengine/Makefile duke3d-patched/source/buildengine/Makefile
+--- duke3d/source/buildengine/Makefile 2004-05-15 05:15:05.000000000 +0200
++++ duke3d-patched/source/buildengine/Makefile 2008-02-27 23:10:46.000000000 +0100
+@@ -99,11 +99,11 @@
+ ifeq ($(strip $(SDL_LIB_DIR)),please_set_me_cygwin_users)
+ $(error Cygwin users need to set the SDL_LIB_DIR envr var.)
+ else
+- SDL_LDFLAGS := -L$(SDL_LIB_DIR) -lSDL
++ SDL_LIBS := -L$(SDL_LIB_DIR) -lSDL
+ endif
+ else
+ SDL_CFLAGS := $(shell sdl-config --cflags)
+- SDL_LDFLAGS := $(shell sdl-config --libs)
++ SDL_LIBS := $(shell sdl-config --libs)
+ endif
+
+ CC = gcc
+@@ -202,7 +202,7 @@
+ ASMFLAGS = -f $(ASMOBJFMT) $(ASMDEFS)
+ LINKER = gcc
+ CFLAGS += $(USE_ASM) -funsigned-char -DPLATFORM_UNIX -Wall $(SDL_CFLAGS) -fno-omit-frame-pointer
+-LDFLAGS += $(SDL_LDFLAGS)
++LDLIBS += $(SDL_LIBS)
+
+ # Rules for turning source files into .o files
+ %.o: %.c
+@@ -236,17 +236,17 @@
+
+ ifeq ($(strip $(usedlls)),true)
+ $(ENGINEDLL) : $(ENGINEOBJS)
+- $(LINKER) -shared -o $(ENGINEDLL) $(LDFLAGS) $(ENGINEOBJS)
++ $(LINKER) -shared -o $(ENGINEDLL) $(LDFLAGS) $(ENGINEOBJS) $(LDLIBS)
+
+ $(NETDLL) : $(NETOBJS)
+- $(LINKER) -shared -o $(NETDLL) $(LDFLAGS) $(NETOBJS)
++ $(LINKER) -shared -o $(NETDLL) $(LDFLAGS) $(NETOBJS) $(LDLIBS)
+ endif
+
+ $(GAMEEXE) : $(ENGINEDLL) $(NETDLL) $(GAMEOBJS) $(PERLOBJS)
+- $(LINKER) -o $(GAMEEXE) $(LDFLAGS) $(LDPERL) $(PERLOBJS) $(GAMEOBJS) $(ENGINEDLL) $(NETDLL)
++ $(LINKER) -o $(GAMEEXE) $(LDFLAGS) $(PERLOBJS) $(GAMEOBJS) $(LDPERL) $(LDLIBS) $(ENGINEDLL) $(NETDLL)
+
+ $(BUILDEXE) : $(ENGINEDLL) $(BUILDOBJS)
+- $(LINKER) -o $(BUILDEXE) $(LDFLAGS) $(BUILDOBJS) $(ENGINEDLL)
++ $(LINKER) -o $(BUILDEXE) $(LDFLAGS) $(BUILDOBJS) $(LDLIBS) $(ENGINEDLL)
+
+ listclean:
+ @echo "A 'make clean' would remove" $(CLEANUP)
+diff -ur duke3d/source/Makefile duke3d-patched/source/Makefile
+--- duke3d/source/Makefile 2004-05-15 05:14:16.000000000 +0200
++++ duke3d-patched/source/Makefile 2008-02-27 23:09:57.000000000 +0100
+@@ -45,11 +45,11 @@
+ ifeq ($(strip $(SDL_LIB_DIR)),please_set_me_cygwin_users)
+ $(error Cygwin users need to set the SDL_LIB_DIR envr var.)
+ else
+- SDL_LDFLAGS := -L$(SDL_LIB_DIR) -lSDL
++ SDL_LIBS := -L$(SDL_LIB_DIR) -lSDL
+ endif
+ else
+ SDL_CFLAGS := $(shell sdl-config --cflags)
+- SDL_LDFLAGS := $(shell sdl-config --libs) -L.
++ SDL_LIBS := $(shell sdl-config --libs) -L.
+ endif
+
+ ifeq ($(strip $(macosx)),true)
+@@ -104,7 +104,7 @@
+ #CC = icc
+ #CFLAGS = -g $(SDL_CFLAGS) -DUSE_SDL=1 -DPLATFORM_UNIX=1 -DUSE_I386_ASM=1 $(EXTRACFLAGS) -O2
+
+-LDLIBS = $(SDL_LDFLAGS) -lSDL -lSDL_mixer $(EXTRALDFLAGS)
++LDLIBS = $(SDL_LIBS) -lSDL -lSDL_mixer $(EXTRALDFLAGS)
+
+ # !!! FIXME: Do we even need this? It doesn't fly on MacOS X. --ryan.
+ #LDLIBS += -Wl,-E
diff --git a/games-fps/duke3d/files/duke3d-20040817-gcc4.patch b/games-fps/duke3d/files/duke3d-20040817-gcc4.patch
new file mode 100644
index 000000000000..2a37148d799c
--- /dev/null
+++ b/games-fps/duke3d/files/duke3d-20040817-gcc4.patch
@@ -0,0 +1,180 @@
+iff -ur duke3d/source/buildengine/a.c duke3d-gcc4/source/buildengine/a.c
+--- duke3d/source/buildengine/a.c 2004-11-25 13:55:21.000000000 -0500
++++ duke3d-gcc4/source/buildengine/a.c 2005-06-18 18:14:24.000000000 -0400
+@@ -186,7 +186,9 @@
+ if (i3 == 0)
+ {
+ i1 += i4;
+- ((unsigned long)i4) >>= mach3_al;
++ unsigned long temp = i4;
++ temp >>= mach3_al;
++ i4 = temp;
+ i4 = (i4&0xffffff00) | (source[i4]&0xff);
+ *dest = ((unsigned char*)i2)[i4];
+ return i1;
+diff -ur duke3d/source/buildengine/pragmas.c duke3d-gcc4/source/buildengine/pragmas.c
+--- duke3d/source/buildengine/pragmas.c 2003-07-25 20:11:32.000000000 -0400
++++ duke3d-gcc4/source/buildengine/pragmas.c 2005-06-18 18:25:37.000000000 -0400
+@@ -56,28 +56,39 @@
+
+ void clearbufbyte(void *buffer, int size, long fill_value) {
+ int lsize;
++ unsigned char *p=buffer;
++ unsigned short *s=buffer;
+ switch(size){
+ case 0: return;
+- case 1: *((unsigned char*)buffer)++ = fill_value; return;
+- case 2: *((unsigned short*)buffer)++ = fill_value; return;
+- case 3: { unsigned char *p=buffer; p[2]=p[1]=p[0] = fill_value;} return;
++ case 1: *p = fill_value; return;
++ case 2: *s = fill_value; return;
++ case 3: { p[2]=p[1]=p[0] = fill_value;} return;
+ default:
+ if ((int)buffer&1) {
+- *((unsigned char*)buffer)++ = fill_value; size--;
++ *p = fill_value; ++p; size--;
++ buffer = p;
+ }
+ if ((int)buffer&2) {
+- *((unsigned short*)buffer)++ = fill_value; size-=2;
++ *s = fill_value; ++s; size-=2;
++ buffer = s;
+ }
+ lsize = size>>2;
++ unsigned int *up = buffer;
+ while(lsize) {
+- *((unsigned int*)buffer)++ = fill_value;
++ *up = fill_value;
++ ++up;
+ lsize--;
+ }
++ buffer = up;
+ if (size&2) {
+- *((unsigned short*)buffer)++ = fill_value;
++ s = buffer;
++ *s = fill_value;
++ ++s;
+ }
+ if (size&1) {
+- *((unsigned char*)buffer)++ = fill_value;
++ p = buffer;
++ *p = fill_value;
++ ++p;
+ }
+ }
+ }
+@@ -122,7 +133,7 @@
+ {
+ *((unsigned short *)source) = ((linum>>16)&0xffff);
+ linum += linum_inc;
+- ((unsigned char*)source) = ((unsigned char*)source) + 2;
++ source = ((unsigned char*)source) + 2;
+ size--;
+ if (size == 0) return;
+ }
+
+diff -u -r duke3d/source/buildengine/a.h duke3d.gcc4.1.1/source/buildengine/a.h
+--- duke3d/source/buildengine/a.h 2003-04-11 08:54:06.000000000 +0200
++++ duke3d.gcc4.1.1/source/buildengine/a.h 2006-06-22 12:14:40.366393568 +0200
+@@ -116,56 +116,56 @@
+
+ #if ((defined __GNUC__) && (!defined C_IDENTIFIERS_UNDERSCORED))
+
+- long asm_mmxoverlay(void) __attribute__ ((alias ("_asm_mmxoverlay")));
+- long asm_sethlinesizes(long,long,long) __attribute__ ((alias ("_asm_sethlinesizes")));
+- long asm_setpalookupaddress(char *) __attribute__ ((alias ("_asm_setpalookupaddress")));
+- long asm_setuphlineasm4(long,long) __attribute__ ((alias ("_asm_setuphlineasm4")));
+- long asm_hlineasm4(long,long,long,long,long,long) __attribute__ ((alias ("_asm_hlineasm4")));
+- long asm_setuprhlineasm4(long,long,long,long,long,long) __attribute__ ((alias ("_asm_setuprhlineasm4")));
+- long asm_rhlineasm4(long,long,long,long,long,long) __attribute__ ((alias ("_asm_rhlineasm4")));
+- long asm_setuprmhlineasm4(long,long,long,long,long,long) __attribute__ ((alias ("_asm_setuprmhlineasm4")));
+- long asm_rmhlineasm4(long,long,long,long,long,long) __attribute__ ((alias ("_asm_rmhlineasm4")));
+- long asm_setupqrhlineasm4(long,long,long,long,long,long) __attribute__ ((alias ("_asm_setupqrhlineasm4")));
+- long asm_qrhlineasm4(long,long,long,long,long,long) __attribute__ ((alias ("_asm_qrhlineasm4")));
+- long asm_setvlinebpl(long) __attribute__ ((alias ("_asm_setvlinebpl")));
+- long asm_fixtransluscence(long) __attribute__ ((alias ("_asm_fixtransluscence")));
+- long asm_prevlineasm1(long,long,long,long,long,long) __attribute__ ((alias ("_asm_prevlineasm1")));
+- long asm_vlineasm1(long,long,long,long,long,long) __attribute__ ((alias ("_asm_vlineasm1")));
+- long asm_setuptvlineasm(long) __attribute__ ((alias ("_asm_setuptvlineasm")));
+- long asm_tvlineasm1(long,long,long,long,long,long) __attribute__ ((alias ("_asm_tvlineasm1")));
+- long asm_setuptvlineasm2(long,long,long) __attribute__ ((alias ("_asm_setuptvlineasm2")));
+- long asm_tvlineasm2(long,long,long,long,long,long) __attribute__ ((alias ("_asm_tvlineasm2")));
+- long asm_mvlineasm1(long,long,long,long,long,long) __attribute__ ((alias ("_asm_mvlineasm1")));
+- long asm_setupvlineasm(long) __attribute__ ((alias ("_asm_setupvlineasm")));
+- long asm_vlineasm4(long,long) __attribute__ ((alias ("_asm_vlineasm4")));
+- long asm_setupmvlineasm(long) __attribute__ ((alias ("_asm_setupmvlineasm")));
+- long asm_mvlineasm4(long,long) __attribute__ ((alias ("_asm_mvlineasm4")));
+- void asm_setupspritevline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_setupspritevline")));
+- void asm_spritevline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_spritevline")));
+- void asm_msetupspritevline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_msetupspritevline")));
+- void asm_mspritevline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_mspritevline")));
+- void asm_tsetupspritevline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_tsetupspritevline")));
+- void asm_tspritevline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_tspritevline")));
+- long asm_mhline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_mhline")));
+- long asm_mhlineskipmodify(long,long,long,long,long,long) __attribute__ ((alias ("_asm_mhlineskipmodify")));
+- long asm_msethlineshift(long,long) __attribute__ ((alias ("_asm_msethlineshift")));
+- long asm_thline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_thline")));
+- long asm_thlineskipmodify(long,long,long,long,long,long) __attribute__ ((alias ("_asm_thlineskipmodify")));
+- long asm_tsethlineshift(long,long) __attribute__ ((alias ("_asm_tsethlineshift")));
+- long asm_setupslopevlin(long,long,long) __attribute__ ((alias ("_asm_setupslopevlin")));
+- long asm_slopevlin(long,long,long,long,long,long) __attribute__ ((alias ("_asm_slopevlin")));
+- long asm_settransnormal(void) __attribute__ ((alias ("_asm_settransnormal")));
+- long asm_settransreverse(void) __attribute__ ((alias ("_asm_settransreverse")));
+- long asm_setupdrawslab(long,long) __attribute__ ((alias ("_asm_setupdrawslab")));
+- long asm_drawslab(long,long,long,long,long,long) __attribute__ ((alias ("_asm_drawslab")));
+- long asm_stretchhline(long,long,long,long,long,long) __attribute__ ((alias ("_asm_stretchhline")));
+- long asm_isvmwarerunning(void) __attribute__ ((alias ("_asm_isvmwarerunning")));
++ long asm_mmxoverlay(void) asm ("_asm_mmxoverlay");
++ long asm_sethlinesizes(long,long,long) asm ("_asm_sethlinesizes");
++ long asm_setpalookupaddress(char *) asm ("_asm_setpalookupaddress");
++ long asm_setuphlineasm4(long,long) asm ("_asm_setuphlineasm4");
++ long asm_hlineasm4(long,long,long,long,long,long) asm ("_asm_hlineasm4");
++ long asm_setuprhlineasm4(long,long,long,long,long,long) asm ("_asm_setuprhlineasm4");
++ long asm_rhlineasm4(long,long,long,long,long,long) asm ("_asm_rhlineasm4");
++ long asm_setuprmhlineasm4(long,long,long,long,long,long) asm ("_asm_setuprmhlineasm4");
++ long asm_rmhlineasm4(long,long,long,long,long,long) asm ("_asm_rmhlineasm4");
++ long asm_setupqrhlineasm4(long,long,long,long,long,long) asm ("_asm_setupqrhlineasm4");
++ long asm_qrhlineasm4(long,long,long,long,long,long) asm ("_asm_qrhlineasm4");
++ long asm_setvlinebpl(long) asm ("_asm_setvlinebpl");
++ long asm_fixtransluscence(long) asm ("_asm_fixtransluscence");
++ long asm_prevlineasm1(long,long,long,long,long,long) asm ("_asm_prevlineasm1");
++ long asm_vlineasm1(long,long,long,long,long,long) asm ("_asm_vlineasm1");
++ long asm_setuptvlineasm(long) asm ("_asm_setuptvlineasm");
++ long asm_tvlineasm1(long,long,long,long,long,long) asm ("_asm_tvlineasm1");
++ long asm_setuptvlineasm2(long,long,long) asm ("_asm_setuptvlineasm2");
++ long asm_tvlineasm2(long,long,long,long,long,long) asm ("_asm_tvlineasm2");
++ long asm_mvlineasm1(long,long,long,long,long,long) asm ("_asm_mvlineasm1");
++ long asm_setupvlineasm(long) asm ("_asm_setupvlineasm");
++ long asm_vlineasm4(long,long) asm ("_asm_vlineasm4");
++ long asm_setupmvlineasm(long) asm ("_asm_setupmvlineasm");
++ long asm_mvlineasm4(long,long) asm ("_asm_mvlineasm4");
++ void asm_setupspritevline(long,long,long,long,long,long) asm ("_asm_setupspritevline");
++ void asm_spritevline(long,long,long,long,long,long) asm ("_asm_spritevline");
++ void asm_msetupspritevline(long,long,long,long,long,long) asm ("_asm_msetupspritevline");
++ void asm_mspritevline(long,long,long,long,long,long) asm ("_asm_mspritevline");
++ void asm_tsetupspritevline(long,long,long,long,long,long) asm ("_asm_tsetupspritevline");
++ void asm_tspritevline(long,long,long,long,long,long) asm ("_asm_tspritevline");
++ long asm_mhline(long,long,long,long,long,long) asm ("_asm_mhline");
++ long asm_mhlineskipmodify(long,long,long,long,long,long) asm("_asm_mhlineskipmodify");
++ long asm_msethlineshift(long,long) asm("_asm_msethlineshift");
++ long asm_thline(long,long,long,long,long,long) asm("_asm_thline");
++ long asm_thlineskipmodify(long,long,long,long,long,long) asm("_asm_thlineskipmodify");
++ long asm_tsethlineshift(long,long) asm("_asm_tsethlineshift");
++ long asm_setupslopevlin(long,long,long) asm("_asm_setupslopevlin");
++ long asm_slopevlin(long,long,long,long,long,long) asm("_asm_slopevlin");
++ long asm_settransnormal(void) asm("_asm_settransnormal");
++ long asm_settransreverse(void) asm("_asm_settransreverse");
++ long asm_setupdrawslab(long,long) asm("_asm_setupdrawslab");
++ long asm_drawslab(long,long,long,long,long,long) asm("_asm_drawslab");
++ long asm_stretchhline(long,long,long,long,long,long) asm("_asm_stretchhline");
++ long asm_isvmwarerunning(void) asm("_asm_isvmwarerunning");
+
+ /*
+ * !!! I need a reference to this, for mprotect(), but the actual function
+ * !!! is never called in BUILD...just from other ASM routines. --ryan.
+ */
+- long asm_prohlineasm4(void) __attribute__ ((alias ("_asm_prohlineasm4")));
++ long asm_prohlineasm4(void) asm("_asm_prohlineasm4");
+
+ #endif /* ELF/GCC */
+ #endif /* defined USE_I386_ASM */
diff --git a/games-fps/duke3d/files/duke3d-20040817-ldflags.patch b/games-fps/duke3d/files/duke3d-20040817-ldflags.patch
new file mode 100644
index 000000000000..79179e663805
--- /dev/null
+++ b/games-fps/duke3d/files/duke3d-20040817-ldflags.patch
@@ -0,0 +1,66 @@
+--- source/buildengine/Makefile.old 2010-10-08 14:32:05.000000000 +0200
++++ source/buildengine/Makefile 2010-10-08 14:35:10.000000000 +0200
+@@ -73,7 +73,7 @@
+ endif
+
+ ifeq ($(strip $(solaris)),true)
+- LDFLAGS += -lsocket -lnsl
++ LIBS += -lsocket -lnsl
+ CFLAGS += -DPLATFORM_SOLARIS
+ endif
+
+@@ -129,7 +129,7 @@
+
+ ifeq ($(strip $(macosx)),true)
+ CFLAGS += -DPLATFORM_MACOSX=1 -faltivec -falign-loops=32 -falign-functions=32
+- LDFLAGS += -framework AppKit -lSDL -lSDLmain
++ LIBS += -framework AppKit -lSDL -lSDLmain
+ endif
+
+ ifeq ($(strip $(useopengl)),true)
+@@ -146,7 +146,7 @@
+
+ ifeq ($(strip $(usephysfs)),true)
+ CFLAGS += -DUSE_PHYSICSFS
+- LDFLAGS += -lphysfs
++ LIBS += -lphysfs
+ endif
+
+ ifeq ($(strip $(usedlls)),true)
+@@ -236,17 +236,17 @@
+
+ ifeq ($(strip $(usedlls)),true)
+ $(ENGINEDLL) : $(ENGINEOBJS)
+- $(LINKER) -shared -o $(ENGINEDLL) $(LDFLAGS) $(ENGINEOBJS) $(LDLIBS)
++ $(LINKER) -shared -o $(ENGINEDLL) $(LIBS) $(ENGINEOBJS) $(LDLIBS)
+
+ $(NETDLL) : $(NETOBJS)
+- $(LINKER) -shared -o $(NETDLL) $(LDFLAGS) $(NETOBJS) $(LDLIBS)
++ $(LINKER) -shared -o $(NETDLL) $(LIBS) $(NETOBJS) $(LDLIBS)
+ endif
+
+ $(GAMEEXE) : $(ENGINEDLL) $(NETDLL) $(GAMEOBJS) $(PERLOBJS)
+- $(LINKER) -o $(GAMEEXE) $(LDFLAGS) $(PERLOBJS) $(GAMEOBJS) $(LDPERL) $(LDLIBS) $(ENGINEDLL) $(NETDLL)
++ $(LINKER) $(LDFLAGS) -o $(GAMEEXE) $(LIBS) $(PERLOBJS) $(GAMEOBJS) $(LDPERL) $(LDLIBS) $(ENGINEDLL) $(NETDLL)
+
+ $(BUILDEXE) : $(ENGINEDLL) $(BUILDOBJS)
+- $(LINKER) -o $(BUILDEXE) $(LDFLAGS) $(BUILDOBJS) $(LDLIBS) $(ENGINEDLL)
++ $(LINKER) $(LDFLAGS) -o $(BUILDEXE) $(LIBS) $(BUILDOBJS) $(LDLIBS) $(ENGINEDLL)
+
+ listclean:
+ @echo "A 'make clean' would remove" $(CLEANUP)
+--- source/Makefile.old 2010-10-08 14:35:54.000000000 +0200
++++ source/Makefile 2010-10-08 14:37:34.000000000 +0200
+@@ -152,10 +152,10 @@
+ sounds.o \
+ dukemusc.o \
+ audiolib/audiolib.a
+- $(CC) $^ $(BUILDOBJS) $(LDLIBS) -o $@
++ $(CC) $(LDFLAGS) $^ $(BUILDOBJS) $(LDLIBS) -o $@
+
+ build: astub.o
+- $(CC) $^ $(BUILDOBJS) buildengine/build.o $(LDLIBS) -o $@
++ $(CC) $(LDFLAGS) $^ $(BUILDOBJS) buildengine/build.o $(LDLIBS) -o $@
+
+ clean:
+ $(MAKE) -C audiolib clean
diff --git a/games-fps/duke3d/files/duke3d-20040817-noinline.patch b/games-fps/duke3d/files/duke3d-20040817-noinline.patch
new file mode 100644
index 000000000000..a41c5c01d063
--- /dev/null
+++ b/games-fps/duke3d/files/duke3d-20040817-noinline.patch
@@ -0,0 +1,18 @@
+--- source/buildengine/engine.c.old 2009-02-06 09:11:54.000000000 +0100
++++ source/buildengine/engine.c 2009-02-06 09:19:12.000000000 +0100
+@@ -391,6 +391,7 @@
+ modify exact [eax ebx ecx]\
+
+ #elif (defined __GNUC__) || (defined __ICC)
++ __attribute__ ((noinline))
+ static long nsqrtasm(int i1)
+ {
+ long retval;
+@@ -601,6 +602,7 @@
+
+ #elif (defined __GNUC__) || (defined __ICC)
+
++ __attribute__ ((noinline))
+ int setgotpic(long i1)
+ {
+ int retval = 0;
diff --git a/games-fps/duke3d/files/duke3d.cfg b/games-fps/duke3d/files/duke3d.cfg
new file mode 100644
index 000000000000..2e8c4a0671b7
--- /dev/null
+++ b/games-fps/duke3d/files/duke3d.cfg
@@ -0,0 +1,194 @@
+[Setup]
+SetupVersion = "1.3D"
+
+[Screen Setup]
+ScreenMode = 2
+ScreenWidth = 1024
+ScreenHeight = 768
+Shadows = 1
+Password = ""
+Detail = 1
+Tilt = 1
+Messages = 1
+Out = 0
+ScreenSize = 8
+ScreenGamma = 0
+
+[Sound Setup]
+FXDevice = 0
+MusicDevice = 0
+FXVolume = 220
+MusicVolume = 200
+NumVoices = 8
+NumChannels = 2
+NumBits = 16
+MixRate = 44100
+MidiPort = 0x330
+BlasterAddress = 0x220
+BlasterType = 1
+BlasterInterrupt = 5
+BlasterDma8 = 1
+BlasterDma16 = 5
+BlasterEmu = 0x620
+ReverseStereo = 0
+SoundToggle = 1
+VoiceToggle = 1
+AmbienceToggle = 1
+MusicToggle = 1
+
+[KeyDefinitions]
+Move_Forward = "Up" "Kpad8"
+Move_Backward = "Down" "Kpad2"
+Turn_Left = "Left" "Kpad4"
+Turn_Right = "Right" "KPad6"
+Strafe = "LAlt" "RAlt"
+Fire = "LCtrl" "RCtrl"
+Open = "Space" ""
+Run = "LShift" "RShift"
+AutoRun = "CapLck" ""
+Jump = "A" "/"
+Crouch = "Z" ""
+Look_Up = "PgUp" "Kpad9"
+Look_Down = "PgDn" "Kpad3"
+Look_Left = "Insert" "Kpad0"
+Look_Right = "Delete" "Kpad."
+Strafe_Left = "," ""
+Strafe_Right = "." ""
+Aim_Up = "Home" "KPad7"
+Aim_Down = "End" "Kpad1"
+Weapon_1 = "1" ""
+Weapon_2 = "2" ""
+Weapon_3 = "3" ""
+Weapon_4 = "4" ""
+Weapon_5 = "5" ""
+Weapon_6 = "6" ""
+Weapon_7 = "7" ""
+Weapon_8 = "8" ""
+Weapon_9 = "9" ""
+Weapon_10 = "0" ""
+Inventory = "Enter" "KpdEnt"
+Inventory_Left = "[" ""
+Inventory_Right = "]" ""
+Holo_Duke = "H" ""
+Jetpack = "J" ""
+NightVision = "N" ""
+MedKit = "M" ""
+TurnAround = "BakSpc" ""
+SendMessage = "T" ""
+Map = "Tab" ""
+Shrink_Screen = "-" "Kpad-"
+Enlarge_Screen = "=" "Kpad+"
+Center_View = "KPad5" ""
+Holster_Weapon = "ScrLck" ""
+Show_Opponents_Weapon = "W" ""
+Map_Follow_Mode = "F" ""
+See_Coop_View = "K" ""
+Mouse_Aiming = "U" ""
+Toggle_Crosshair = "I" ""
+Steroids = "R" ""
+Quick_Kick = "`" ""
+Next_Weapon = "'" ""
+Previous_Weapon = ";" ""
+
+[Controls]
+ControllerType = 1
+JoystickPort = 0
+MouseSensitivity = 32768
+ExternalFilename = "EXTERNAL.EXE"
+EnableRudder = 0
+MouseAiming = 0
+MouseButton0 = "Fire"
+MouseButtonClicked0 = ""
+MouseButton1 = "Strafe"
+MouseButtonClicked1 = "Open"
+MouseButton2 = "Move_Forward"
+MouseButtonClicked2 = ""
+JoystickButton0 = "Fire"
+JoystickButtonClicked0 = ""
+JoystickButton1 = "Strafe"
+JoystickButtonClicked1 = "Inventory"
+JoystickButton2 = "Run"
+JoystickButtonClicked2 = "Jump"
+JoystickButton3 = "Open"
+JoystickButtonClicked3 = "Crouch"
+JoystickButton4 = "Aim_Down"
+JoystickButtonClicked4 = ""
+JoystickButton5 = "Look_Right"
+JoystickButtonClicked5 = ""
+JoystickButton6 = "Aim_Up"
+JoystickButtonClicked6 = ""
+JoystickButton7 = "Look_Left"
+JoystickButtonClicked7 = ""
+MouseAnalogAxes0 = "analog_turning"
+MouseDigitalAxes0_0 = ""
+MouseDigitalAxes0_1 = ""
+MouseAnalogScale0 = 0
+MouseAnalogAxes1 = "analog_moving"
+MouseDigitalAxes1_0 = ""
+MouseDigitalAxes1_1 = ""
+MouseAnalogScale1 = 0
+JoystickAnalogAxes0 = "analog_turning"
+JoystickDigitalAxes0_0 = ""
+JoystickDigitalAxes0_1 = ""
+JoystickAnalogScale0 = 0
+JoystickAnalogAxes1 = "analog_moving"
+JoystickDigitalAxes1_0 = ""
+JoystickDigitalAxes1_1 = ""
+JoystickAnalogScale1 = 0
+JoystickAnalogAxes2 = "analog_strafing"
+JoystickDigitalAxes2_0 = ""
+JoystickDigitalAxes2_1 = ""
+JoystickAnalogScale2 = 0
+JoystickAnalogAxes3 = ""
+JoystickDigitalAxes3_0 = "Run"
+JoystickDigitalAxes3_1 = ""
+JoystickAnalogScale3 = 0
+GamePadDigitalAxes0_0 = "Turn_Left"
+GamePadDigitalAxes0_1 = "Turn_Right"
+GamePadDigitalAxes1_0 = "Move_Forward"
+GamePadDigitalAxes1_1 = "Move_Backward"
+MouseAimingFlipped = 0
+GameMouseAiming = 0
+AimingFlag = 0
+
+[Comm Setup]
+ComPort = 2
+IrqNumber = 65535
+UartAddress = 65535
+PortSpeed = 9600
+ToneDial = 1
+SocketNumber = 65535
+NumberPlayers = 2
+ModemName = ""
+InitString = "ATZ"
+HangupString = "ATH0=0"
+DialoutString = ""
+PlayerName = "DUKE"
+RTSName = "DUKE.RTS"
+PhoneNumber = ""
+ConnectType = 0
+CommbatMacro#0 = "An inspiration for birth control."
+CommbatMacro#1 = "You're gonna die for that!"
+CommbatMacro#2 = "It hurts to be you."
+CommbatMacro#3 = "Lucky Son of a Bitch."
+CommbatMacro#4 = "Hmmm....Payback time."
+CommbatMacro#5 = "You bottom dwelling scum sucker."
+CommbatMacro#6 = "Damn, you're ugly."
+CommbatMacro#7 = "Ha ha ha...Wasted!"
+CommbatMacro#8 = "You suck!"
+CommbatMacro#9 = "AARRRGHHHHH!!!"
+
+[Misc]
+Executions = 5
+RunMode = 0
+Crosshairs = 1
+WeaponChoice0 = 3
+WeaponChoice1 = 4
+WeaponChoice2 = 5
+WeaponChoice3 = 7
+WeaponChoice4 = 8
+WeaponChoice5 = 6
+WeaponChoice6 = 0
+WeaponChoice7 = 2
+WeaponChoice8 = 9
+WeaponChoice9 = 1
diff --git a/games-fps/duke3d/files/network.cfg b/games-fps/duke3d/files/network.cfg
new file mode 100644
index 000000000000..46db8b3119fb
--- /dev/null
+++ b/games-fps/duke3d/files/network.cfg
@@ -0,0 +1,15 @@
+# lifted from happypenguin.org
+
+INTERFACE [your ip address]
+
+# only peer appears to work [SERVER or CLIENT or PEER]
+MODE peer
+
+# create an allow line for everyone who will connect
+ALLOW [another player's ip address]
+ALLOW [another player's ip address]
+ALLOW [another player's ip address]
+ALLOW [another player's ip address]
+
+# try to find [number] of players and start the game
+BROADCAST [number]
diff --git a/games-fps/duke3d/metadata.xml b/games-fps/duke3d/metadata.xml
new file mode 100644
index 000000000000..e941f24a6212
--- /dev/null
+++ b/games-fps/duke3d/metadata.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <longdescription>
+The third chapter in the series, and the first with a 3D perspective
+(the original Duke Nukem and the sequel, Duke Nukem II, are side
+scrolling platform games). This game, set sometime in the early 21st
+century, begins in a ravaged LA, which was overtaken by aliens while you
+were abducted during Duke Nukem II. Duke, upon returning to Earth, finds
+himself with another mess to clean up, and another alien race that needs
+exterminating. Duke is a can-do hero who realizes that sometimes
+innocent people have to die in order to save Earth, so accuracy of gun
+fire is not a real concern to him. :)
+
+This game has a long list of cool things that haven't been attempted in
+3D action games, yet. The weapons, for example, kick-butt:
+
+ * There's a mine that can be placed on any wall and sends out a
+laser trip beam-- perfect for multiplayer games.
+ * There's also a shrinker ray that reduces an opponent to the size
+of a G.I. Joe, at which point they are foot fodder--watch them splat!
+ * As in Shadow Warrior, you can swim under water, and even shoot
+players who are standing outside the water, or vice versa.
+
+ What works:
+ * Basic gameplay seems fine.
+ * Sound and music.
+ * keyboard input.
+ * mouse input.
+ * Hi-res (what would be "VESA modes" in DOS).
+ * Windowed/fullscreen support.
+ * Save games.
+ * Record and playback demos compatible with the Atomic Edition (1.5).
+ * Shareware and retail versions should all work.
+ * BUILD editor works to a large degree.
+ * DukeBots for multiplayer AI.
+ * Assembly code all has portable C fallbacks, now.
+ * TCP/IP Networking!
+ * Linux/x86 port.
+ * Windows/x86 port.
+ * BeOS/x86 port.
+ * (incomplete) MacOS X port.
+
+What doesn't work/known bugs:
+ * Joystick input isn't working yet.
+ * File cases need to be exact in some places, not others.
+ * Engine (game?) relies on compiler treating "char" as "unsigned" by default...this needs to be flushed out, for sanity's sake. But I'm anal. :)
+ * Netcode handles packet loss _VERY_ poorly...it's fine for stable connections and LANs, though.
+ * Configuring a multiplayer game involves editing text files and filling in IP addresses. Not very user-friendly.
+ * Some text prompts try to read the SDL input queue instead of stdin like they should.
+ * Probably other stuff. Do NOT consider this stable and complete yet!
+</longdescription>
+ <use>
+ <flag name="demo">Install the demo files</flag>
+ <flag name='pic'>disable optimized assembly code that is not PIC friendly</flag>
+ </use>
+</pkgmetadata>