diff --git a/games/Makefile b/games/Makefile index d114cf73feab..c94b7c2b403a 100644 --- a/games/Makefile +++ b/games/Makefile @@ -97,6 +97,7 @@ SUBDIR += dopewars SUBDIR += drm SUBDIR += dsnake + SUBDIR += duke3d SUBDIR += dungeon SUBDIR += dungeoncrawl SUBDIR += easysok diff --git a/games/duke3d/Makefile b/games/duke3d/Makefile new file mode 100644 index 000000000000..5e2dd9aa6d06 --- /dev/null +++ b/games/duke3d/Makefile @@ -0,0 +1,86 @@ +# New ports collection makefile for: duke3d +# Date Created: 18 September 2003 +# Whom: +# +# $FreeBSD$ + +PORTNAME= duke3d +PORTVERSION= 20012306 +CATEGORIES= games +MASTER_SITES= http://sheepkiller.nerim.net/ports/${PORTNAME}/ +#DISTNAME= ${PORTNAME}-${PORTVERSION} + +MAINTAINER= arundel@gmx.net +COMMENT= Icculus Duke Nukem 3D port for various Operating Systems + +BUILD_DEPENDS= nasm:${PORTSDIR}/devel/nasm + +NO_CDROM= yes +USE_XLIB= yes +USE_GMAKE= yes +USE_SDL= mixer sdl +NO_PACKAGE= yes +USE_REINPLACE= yes +REINPLACE_ARGS= + +WRKSRC= ${WRKDIR}/${PORTNAME} + +TARGET_DIR= ${LOCALBASE}/${PORTNAME} + +DATA_FILES= defs.con game.con user.con +PROG_FILES= ${WRKSRC}/source/${PORTNAME} ${WRKSRC}/source/buildengine/build +DOC_FILES1= README BUILDLIC.TXT CONTRIB TODO CHANGELOG ../../readme.txt ../../gnu.txt + +pre-everything:: +.ifndef(WITHOUT_DOSBOX) + @${ECHO_MSG} "" + @${ECHO_MSG} "Define WITHOUT_DOSBOX to disable the dependency on dosbox." + @${ECHO_MSG} "Then however you will not be able to change the Duke3D config." + @${ECHO_MSG} "" + +RUN_DEPENDS= ${LOCALBASE}/bin/dosbox:${PORTSDIR}/emulators/dosbox +.endif + +post-patch: + @${SED} -e 's|%%DUKEDIR%%|${PREFIX}/${PORTNAME}|g' ${FILESDIR}/fix.sh > \ + ${WRKDIR}/fix.sh + @${SED} -e 's|%%DUKEDIR%%|${PREFIX}/${PORTNAME}|g' ${FILESDIR}/wrapper.sh > \ + ${WRKDIR}/wrapper.sh + @${FIND} ${WRKSRC} -name "*.[ch]" | ${XARGS} ${REINPLACE_CMD}-i.bak -e \ + 's|malloc\.h|stdlib.h|g' + @${FIND} ${WRKSRC} -name "Makefile" | ${XARGS} ${REINPLACE_CMD}-i.bak -e \ + 's|sdl-config|${SDL_CONFIG}|g ; s|%%X11BASE%%|${X11BASE}|g ; \ + s|%%CFLAGS%%|${CFLAGS} -I${X11BASE}/include|g' + +do-build: + cd ${WRKSRC}/source/buildengine && ${GMAKE} + cd ${WRKSRC}/source && ${GMAKE} + +do-install: + ${INSTALL} -d ${TARGET_DIR} + ${INSTALL_PROGRAM} ${PROG_FILES} ${TARGET_DIR} + ${INSTALL_SCRIPT} ${WRKDIR}/fix.sh ${TARGET_DIR} + ${INSTALL_SCRIPT} ${WRKDIR}/wrapper.sh ${TARGET_DIR}/duke.sh + ${INSTALL} -d ${TARGET_DIR}/testdata + +.for file in ${DATA_FILES} + ${INSTALL_DATA} ${WRKSRC}/testdata/${file} ${TARGET_DIR}/testdata +.endfor + + ${LN} -s ${TARGET_DIR}/duke.sh ${LOCALBASE}/bin/duke3d + +post-install: +.if !defined(NOPORTDOCS) + ${INSTALL} -d ${DOCSDIR} + +.for file in ${DOC_FILES1} + ${INSTALL_MAN} ${WRKSRC}/source/buildengine/${file} ${DOCSDIR} +.endfor + + ${REINPLACE_CMD}-e 's|%%DUKEDIR%%|${PREFIX}/${PORTNAME}|g' ${FILESDIR}/README.bsd > \ + ${DOCSDIR}/README.bsd + +.endif + @${CAT} ${PKGMESSAGE} + +.include diff --git a/games/duke3d/distinfo b/games/duke3d/distinfo new file mode 100644 index 000000000000..a7037aee8247 --- /dev/null +++ b/games/duke3d/distinfo @@ -0,0 +1,2 @@ +MD5 (duke3d-20012306.tar.gz) = 943f283602acf4569d66fcef3135f11f +SIZE (duke3d-20012306.tar.gz) = 1787957 diff --git a/games/duke3d/files/README.bsd b/games/duke3d/files/README.bsd new file mode 100644 index 000000000000..fb8967d80aea --- /dev/null +++ b/games/duke3d/files/README.bsd @@ -0,0 +1,20 @@ +You need to copy the following files from the Duke Nukem 3D CD-ROM or from the Sharware +release to %%DUKEDIR%%: + +DUKE3D.GRP +DUKE3D.CFG +SETUP.EXE +SETMAIN.EXE + +Afterwards you have to run %%DUKEDIR%%/fix.sh + +If you want to edit your config run dosbox, mount %%DUKEDIR%% +and run SETUP.EXE. Be sure you have write permission. Otherwise your +changes will get lost. + +WARNING: Icculus Duke3D port is still in alpha stage and runs very slowly! + +Thx go out to + +mezz @ bsdforums.org for cleaning up the code and testing it on -CURRENT +clement for his problem reports diff --git a/games/duke3d/files/fix.sh b/games/duke3d/files/fix.sh new file mode 100644 index 000000000000..3638c9694267 --- /dev/null +++ b/games/duke3d/files/fix.sh @@ -0,0 +1,42 @@ +#!/bin/sh +cd %%DUKEDIR%% + +if [ ! -d %%DUKEDIR%% ] || [ ! -w %%DUKEDIR%% ] +then + echo You do not have permission to write to %%DUKEDIR%%. + exit +fi + +if [ ! -d testdata ] +then + echo testdata directory is missing + exit +fi + +if [ ! -f testdata/defs.con ] || [ ! -f testdata/game.con ] || [ ! -f testdata/user.con ] +then + echo At least one resource file in testdata is missing + exit +fi + +if [ -f DEFS.CON ] +then + echo Backing up original DEFS.CON to DEFS.BAK + cp DEFS.CON DEFS.BAK +fi + +if [ -f GAME.CON ] +then + echo Backing up original GAME.CON to GAME.BAK + cp GAME.CON GAME.BAK +fi + +if [ -f USER.CON ] +then + echo Backing up original USER.CON to USER.BAK + cp USER.CON USER.BAK +fi + +cp -f testdata/defs.con ./DEFS.CON +cp -f testdata/game.con ./GAME.CON +cp -f testdata/user.con ./USER.CON diff --git a/games/duke3d/files/patch-aa b/games/duke3d/files/patch-aa new file mode 100644 index 000000000000..7b90c698cd10 --- /dev/null +++ b/games/duke3d/files/patch-aa @@ -0,0 +1,24 @@ +--- source/buildengine/Makefile.orig Sat Mar 13 22:12:13 2004 ++++ source/buildengine/Makefile Sat Mar 13 22:46:31 2004 +@@ -100,7 +100,7 @@ + SDL_LDFLAGS := $(shell sdl-config --libs) + endif + +-CC = gcc ++#CC = gcc + + # Uncomment to use the Intel compiler (v6.0) + # Note: Version 6.0 Build 020312Z fails to compile engine.c +@@ -194,9 +194,9 @@ + + ENGINEDIR = . + ASMFLAGS = -f $(ASMOBJFMT) $(ASMDEFS) +-LINKER = gcc +-CFLAGS += $(USE_ASM) -funsigned-char -O2 -DPLATFORM_UNIX -g -Wall $(SDL_CFLAGS) -fno-omit-frame-pointer +-LDFLAGS += -g $(SDL_LDFLAGS) ++LINKER = $(CC) ++CFLAGS += %%CFLAGS%% $(USE_ASM) -funsigned-char -DPLATFORM_UNIX -Wall $(SDL_CFLAGS) -fno-omit-frame-pointer ++LDFLAGS += -L%%X11BASE%%/lib $(SDL_LDFLAGS) + + # Rules for turning source files into .o files + %.o: %.c diff --git a/games/duke3d/files/patch-ab b/games/duke3d/files/patch-ab new file mode 100644 index 000000000000..4f4426579c41 --- /dev/null +++ b/games/duke3d/files/patch-ab @@ -0,0 +1,20 @@ +*** source/buildengine/mmulti.c.orig Sat Jun 7 08:58:45 2003 +--- source/buildengine/mmulti.c Thu Sep 18 02:24:25 2003 +*************** +*** 916,929 **** + if (!set_socket_blockmode(0)) + return(0); + +- #if !PLATFORM_WIN32 && !PLATFORM_MACOSX +- { +- /* Linux-specific. */ +- int flags = 1; +- setsockopt(udpsocket, SOL_IP, IP_RECVERR, &flags, sizeof (flags)); +- } +- #endif +- + memset(&addr, '\0', sizeof (addr)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(ip); +--- 916,921 ---- + diff --git a/games/duke3d/files/patch-ac b/games/duke3d/files/patch-ac new file mode 100644 index 000000000000..076a0c3c4383 --- /dev/null +++ b/games/duke3d/files/patch-ac @@ -0,0 +1,30 @@ +--- source/Makefile.orig Sat Mar 13 22:51:27 2004 ++++ source/Makefile Sat Mar 13 22:53:11 2004 +@@ -86,15 +86,14 @@ + BUILDOBJS += buildengine/a.o + endif + +-CC = gcc +-CFLAGS = -c -g $(SDL_CFLAGS) -DUSE_SDL=1 -DPLATFORM_UNIX=1 -W -Wall -Wno-unused $(EXTRACFLAGS) -funsigned-char +-OPTIMIZE = -O2 ++#CC = gcc ++CFLAGS = -c %%CFLAGS%% $(SDL_CFLAGS) -DUSE_SDL=1 -DPLATFORM_UNIX=1 -W -Wall -Wno-unused $(EXTRACFLAGS) -funsigned-char + + # Uncomment this to compile with the Intel compiler (v6.0) + #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_LDFLAGS) -lSDL_mixer $(EXTRALDFLAGS) -L%%X11BASE%%/lib + + # !!! FIXME: Do we even need this? It doesn't fly on MacOS X. --ryan. + #LDLIBS += -Wl,-E +@@ -103,7 +102,7 @@ + + + %.o : %.c +- $(CC) $(CFLAGS) $(OPTIMIZE) -o $@ $< ++ $(CC) $(CFLAGS) -o $@ $< + + # Animation playback crashes due to optimization error on MacOS X. --ryan. + ifeq ($(strip $(macosx)),true) diff --git a/games/duke3d/files/patch-ad b/games/duke3d/files/patch-ad new file mode 100644 index 000000000000..7f4c7ec4a6f4 --- /dev/null +++ b/games/duke3d/files/patch-ad @@ -0,0 +1,15 @@ +--- source/audiolib/Makefile.orig Sat Mar 13 22:54:17 2004 ++++ source/audiolib/Makefile Sat Mar 13 23:06:25 2004 +@@ -1,8 +1,8 @@ +-CC=gcc +-AR=ar ++#CC=gcc ++#AR=ar + RANLIB=ranlib +-CFLAGS=-g -O2 +-LDLIBS= ++CFLAGS= %%CFLAGS%% ++LDLIBS= -L%%X11BASE%%/lib + + CFLAGS += $(shell sdl-config --cflags) + LDLIBS += $(shell sdl-config --libs) diff --git a/games/duke3d/files/patch-ae b/games/duke3d/files/patch-ae new file mode 100644 index 000000000000..e1247e6ecdc7 --- /dev/null +++ b/games/duke3d/files/patch-ae @@ -0,0 +1,12 @@ +--- source/buildengine/tests/Makefile.orig Sat Mar 13 18:29:03 2004 ++++ source/buildengine/tests/Makefile Sat Mar 13 18:29:36 2004 +@@ -1,7 +1,7 @@ + BINARIES=sartest kreciptest + OBJS=kreciptest.o krecip.o sartest.o sar.o +-CFLAGS=-g -Wall +-CC=gcc ++CFLAGS+= %%CFLAGS%% -Wall ++#CC=gcc + ASM=nasm + + all: kreciptest sartest diff --git a/games/duke3d/files/wrapper.sh b/games/duke3d/files/wrapper.sh new file mode 100644 index 000000000000..140e01c9d7b6 --- /dev/null +++ b/games/duke3d/files/wrapper.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Needed to make symlinks/shortcuts work. +# Wrap lsdldoom binary +cd %%DUKEDIR%% +./duke3d $* +exit $? diff --git a/games/duke3d/pkg-descr b/games/duke3d/pkg-descr new file mode 100644 index 000000000000..34498d39175b --- /dev/null +++ b/games/duke3d/pkg-descr @@ -0,0 +1,19 @@ +Duke3D for Linux + +This port was done by Dan Olson, Steven Fuller, and Ryan C. Gordon, +with contributions from David Koenig, Dave Watson, among others. + +The real nasty part (porting the Build Engine) was the work of: + + * Ryan C. Gordon + * Dan Olson + * Andrew Henderson + * Christian Zander + * Adrian Neill + * Matt Helsley + * Nicholas Vining + * Matt Saettler + * Steven Fuller + * A cast of thousands. + +WWW: http://www.icculus.org/duke3d/ diff --git a/games/duke3d/pkg-message b/games/duke3d/pkg-message new file mode 100644 index 000000000000..bffc99936ef5 --- /dev/null +++ b/games/duke3d/pkg-message @@ -0,0 +1,5 @@ +----------------------------------------------------------------- +Duke Nukem 3D is successfully installed. +Please copy your Duke 3D data to ${PREFIX}/duke3d directory and +read http://www.icculus.org/duke3d/ +----------------------------------------------------------------- diff --git a/games/duke3d/pkg-plist b/games/duke3d/pkg-plist new file mode 100644 index 000000000000..c760ccebce81 --- /dev/null +++ b/games/duke3d/pkg-plist @@ -0,0 +1,19 @@ +duke3d/duke3d +duke3d/duke.sh +duke3d/build +duke3d/fix.sh +duke3d/testdata/defs.con +duke3d/testdata/game.con +duke3d/testdata/user.con +bin/duke3d +%%PORTDOCS%%%%DOCSDIR%%/README.bsd +%%PORTDOCS%%%%DOCSDIR%%/README +%%PORTDOCS%%%%DOCSDIR%%/BUILDLIC.TXT +%%PORTDOCS%%%%DOCSDIR%%/CONTRIB +%%PORTDOCS%%%%DOCSDIR%%/TODO +%%PORTDOCS%%%%DOCSDIR%%/CHANGELOG +%%PORTDOCS%%%%DOCSDIR%%/readme.txt +%%PORTDOCS%%%%DOCSDIR%%/gnu.txt +@dirrm share/doc/duke3d +@dirrm duke3d/testdata +@unexec rmdir duke3d 2> /dev/null || true