aboutsummaryrefslogtreecommitdiff
path: root/games/doomlegacy
diff options
context:
space:
mode:
authorAlejandro Pulver <alepulver@FreeBSD.org>2007-06-07 00:00:31 +0000
committerAlejandro Pulver <alepulver@FreeBSD.org>2007-06-07 00:00:31 +0000
commit1c4abee2f9e839fb1435ce32babaebe85a9a96b7 (patch)
treefe45810a3a4ddfa80de3832d36bf7960b11b5583 /games/doomlegacy
parent321d12c1852aa6b56080ed3f1899527c68593560 (diff)
downloadports-1c4abee2f9e839fb1435ce32babaebe85a9a96b7.tar.gz
ports-1c4abee2f9e839fb1435ce32babaebe85a9a96b7.zip
Notes
Diffstat (limited to 'games/doomlegacy')
-rw-r--r--games/doomlegacy/Makefile54
-rw-r--r--games/doomlegacy/files/legacy.in4
-rw-r--r--games/doomlegacy/files/patch-byteptr.h208
3 files changed, 233 insertions, 33 deletions
diff --git a/games/doomlegacy/Makefile b/games/doomlegacy/Makefile
index dbbfc859d345..c7b594d827a1 100644
--- a/games/doomlegacy/Makefile
+++ b/games/doomlegacy/Makefile
@@ -6,14 +6,14 @@
PORTNAME= doomlegacy
PORTVERSION= 142
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= games
MASTER_SITES= SF
DISTNAME= legacy_${PORTVERSION}_src
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} ${WADFILE}
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= alepulver@FreeBSD.org
COMMENT= DooM Legacy: popular DooM clone!
EXTRACT_DEPENDS=unzip:${PORTSDIR}/archivers/unzip
@@ -21,21 +21,29 @@ EXTRACT_DEPENDS=unzip:${PORTSDIR}/archivers/unzip
USE_GL= yes
USE_GMAKE= yes
USE_SDL= mixer sdl
-USE_XLIB= yes
+MAKEFILE= makefile
+MAKE_ENV= FREEBSD=1 FBSD_SDL=1 PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
+ PTHREAD_LIBS="${PTHREAD_LIBS}"
+WRKSRC= ${WRKDIR}/doomlegacy_${PORTVERSION}_src
OPTIONS= X86_ASM "Enable use of x86 assembly code" on
-WRKSRC= ${WRKDIR}/doomlegacy_${PORTVERSION}_src
-MAKEFILE= makefile
-MAKE_ENV+= FREEBSD=1 FBSD_SDL=1 PTHREAD_LIBS="${PTHREAD_LIBS}" \
- PTHREAD_CFLAGS="${PTHREAD_CFLAGS}"
-
+DATADIR= ${PREFIX}/lib/${PORTNAME}
SUB_FILES= legacy
+
WADFILE= legacy_dat.zip
-DATADIR= ${PREFIX}/lib/${PORTNAME}
+
+.include "${.CURDIR}/../doom-data/Makefile.include"
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_X86_ASM) && ${ARCH} == "i386"
+BUILD_DEPENDS+= nasm:${PORTSDIR}/devel/nasm
+MAKE_ARGS+= USEASM=1
+.endif
post-extract:
- ${UNZIP_CMD} -q ${DISTDIR}/${WADFILE} -d ${WRKDIR}/bin
+ @${UNZIP_CMD} -q ${DISTDIR}/${WADFILE} -d ${WRKDIR}/bin
post-patch:
@${REINPLACE_CMD} -e \
@@ -46,39 +54,23 @@ post-patch:
${WRKSRC}/${MAKEFILE}
pre-build:
- cd ${WRKSRC}/linux_x/sndserv && ${GMAKE} clean
+ @cd ${WRKSRC}/linux_x/sndserv && ${GMAKE} clean
post-build:
- @${LN} -s ${WRKSRC}/linux_x/sndserv/linux/llsndserv ${WRKDIR}/bin
+ @${LN} -sf ${WRKSRC}/linux_x/sndserv/linux/llsndserv ${WRKDIR}/bin
do-install:
${MKDIR} ${DATADIR}
- ${INSTALL_PROGRAM} ${WRKDIR}/bin/llsndserv ${WRKDIR}/bin/r_opengl.so \
- ${DATADIR}
+ cd ${WRKDIR}/bin && ${INSTALL_PROGRAM} llsndserv r_opengl.so ${DATADIR}
${INSTALL} -c -s -o root -g kmem -m 2555 ${WRKDIR}/bin/lsdldoom \
${DATADIR}
${INSTALL_DATA} ${WRKDIR}/bin/legacy.dat ${DATADIR}
${INSTALL_SCRIPT} ${WRKDIR}/legacy ${PREFIX}/bin/${PORTNAME}
-
-post-install:
.ifndef(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
-. for f in *.html *.txt *.cfg README_SDL copying
+. for f in *.html *.txt *.cfg README_SDL copying
${INSTALL_DATA} ${WRKSRC}/_doc/${f} ${DOCSDIR}
-. endfor
-.endif
-
-.include "${.CURDIR}/../doom-data/Makefile.include"
-
-.include <bsd.port.pre.mk>
-
-.if ${OSVERSION} >= 700042
-BROKEN= Broken with gcc 4.2
-.endif
-
-.if defined(WITH_X86_ASM) && ${ARCH} == "i386"
-BUILD_DEPENDS+= nasm:${PORTSDIR}/devel/nasm
-MAKE_ARGS+= USEASM=1
+. endfor
.endif
.include <bsd.port.post.mk>
diff --git a/games/doomlegacy/files/legacy.in b/games/doomlegacy/files/legacy.in
index 731a6fde9a20..4c487da558da 100644
--- a/games/doomlegacy/files/legacy.in
+++ b/games/doomlegacy/files/legacy.in
@@ -12,8 +12,8 @@ then
else
echo "Creating ~/.doomlegacy directory."
cd %%DATADIR%% || exit 1
- find * -type d -exec mkdir -p ~/.doomlegacy/{} \;
- find * -type f -exec ln -sf %%DATADIR%%/{} ~/.doomlegacy/{} \;
+ mkdir -p ~/.doomlegacy
+ ln -s %%DATADIR%%/* ~/.doomlegacy
fi
cd ~/.doomlegacy || exit 1
diff --git a/games/doomlegacy/files/patch-byteptr.h b/games/doomlegacy/files/patch-byteptr.h
new file mode 100644
index 000000000000..62667ab77c63
--- /dev/null
+++ b/games/doomlegacy/files/patch-byteptr.h
@@ -0,0 +1,208 @@
+--- byteptr.h.orig Sun Apr 18 18:02:24 2004
++++ byteptr.h Wed Jun 6 20:09:36 2007
+@@ -32,109 +32,123 @@
+ //
+ //-----------------------------------------------------------------------------
+
+-#ifndef __BIG_ENDIAN__
+-//
+-// Little-endian machines
+-//
+-#define writeshort(p,b) *(short*) (p) = b
+-#define writelong(p,b) *(long *) (p) = b
+-#define WRITEBYTE(p,b) *((byte *)p)++ = b
+-#define WRITECHAR(p,b) *((char *)p)++ = b
+-#define WRITESHORT(p,b) *((short *)p)++ = b
+-#define WRITEUSHORT(p,b) *((USHORT *)p)++ = b
+-#define WRITELONG(p,b) *((long *)p)++ = b
+-#define WRITEULONG(p,b) *((ULONG *)p)++ = b
+-#define WRITEFIXED(p,b) *((fixed_t*)p)++ = b
+-#define WRITEANGLE(p,b) *((angle_t*)p)++ = b
+-#define WRITESTRING(p,b) { int tmp_i=0; do { WRITECHAR(p,b[tmp_i]); } while(b[tmp_i++]); }
+-#define WRITESTRINGN(p,b,n) { int tmp_i=0; do { WRITECHAR(p,b[tmp_i]); if(!b[tmp_i]) break;tmp_i++; } while(tmp_i<n); }
+-#define WRITEMEM(p,s,n) memcpy(p, s, n);p+=n
++#include <assert.h>
++#include <stdint.h>
+
+-#define readshort(p) *((short *)p)
+-#define readlong(p) *((long *)p)
+-#define READBYTE(p) *((byte *)p)++
+-#define READCHAR(p) *((char *)p)++
+-#define READSHORT(p) *((short *)p)++
+-#define READUSHORT(p) *((USHORT *)p)++
+-#define READLONG(p) *((long *)p)++
+-#define READULONG(p) *((ULONG *)p)++
+-#define READFIXED(p) *((fixed_t*)p)++
+-#define READANGLE(p) *((angle_t*)p)++
+-#define READSTRING(p,s) { int tmp_i=0; do { s[tmp_i]=READBYTE(p); } while(s[tmp_i++]); }
+-#define SKIPSTRING(p) while(READBYTE(p))
+-#define READMEM(p,s,n) memcpy(s, p, n);p+=n
+-#else
+-//
+-// definitions for big-endian machines with alignment constraints.
+-//
+-// Write a value to a little-endian, unaligned destination.
+-//
+-static inline void writeshort(void * ptr, int val)
++#ifdef __BIG_ENDIAN__
++#define ptrtole(ptr, size) endian_swap(ptr, size)
++#else
++#define ptrtole(ptr, size)
++#endif
++
++static inline void *endian_swap(void *ptr, size_t size)
+ {
+- char * cp = ptr;
+- cp[0] = val ; val >>= 8;
+- cp[1] = val ;
++ unsigned char *myptr = ptr;
++ int i, x;
++
++ for (i = 1; i <= size / 2; i++) {
++ x = myptr[i-1];
++ myptr[i-1] = myptr[size-i];
++ myptr[size-i] = x;
++ }
++
++ return (ptr);
+ }
+
+-static inline void writelong(void * ptr, int val)
++static inline void *incptr(void **ptr, size_t size)
+ {
+- char * cp = ptr;
+- cp[0] = val ; val >>= 8;
+- cp[1] = val ; val >>= 8;
+- cp[2] = val ; val >>= 8;
+- cp[3] = val ;
++ unsigned char **myptr = ptr;
++ void *oldptr = *ptr;
++ int i;
++
++ for (i = 0; i < size; i++)
++ (*myptr)++;
++
++ return (oldptr);
+ }
+
+-#define WRITEBYTE(p,b) *((byte *)p)++ = (b)
+-#define WRITECHAR(p,b) *((char *)p)++ = (b)
+-#define WRITESHORT(p,b) writeshort(((short *)p)++, (b))
+-#define WRITEUSHORT(p,b) writeshort(((u_short*)p)++, (b))
+-#define WRITELONG(p,b) writelong (((long *)p)++, (b))
+-#define WRITEULONG(p,b) writelong (((u_long *)p)++, (b))
+-#define WRITEFIXED(p,b) writelong (((fixed_t*)p)++, (b))
+-#define WRITEANGLE(p,b) writelong (((angle_t*)p)++, (long) (b))
+-#define WRITESTRING(p,b) { int tmp_i=0; do { WRITECHAR(p,b[tmp_i]); } while(b[tmp_i++]); }
+-#define WRITESTRINGN(p,b,n) { int tmp_i=0; do { WRITECHAR(p,b[tmp_i]); if(!b[tmp_i]) break;tmp_i++; } while(tmp_i<n); }
+-#define WRITEMEM(p,s,n) memcpy(p, s, n);p+=n
++static inline intmax_t readptr(void **ptr, size_t size)
++{
++ intmax_t res = 0;
+
+-// Read a signed quantity from little-endian, unaligned data.
+-//
+-static inline short readshort(void * ptr)
++ // Check if it won't work
++ assert(size > 0 && size <= sizeof(intmax_t));
++
++ memcpy(&res, incptr(ptr, size), size);
++ ptrtole(&res, size);
++
++ return (res);
++}
++
++static inline intmax_t writeptr(void **dst, intmax_t src, size_t size)
+ {
+- char *cp = ptr;
+- u_char *ucp = ptr;
+- return (cp[1] << 8) | ucp[0] ;
++ intmax_t res = 0;
++
++ // Check if it won't work
++ assert(size > 0 && size <= sizeof(intmax_t));
++
++ memcpy(*dst, &src, size);
++ ptrtole(*dst, size);
++ memcpy(&res, *dst, size);
++ incptr(dst, size);
++
++ return (res);
+ }
+
+-static inline u_short readushort(void * ptr)
++static inline short readshort(void *ptr)
+ {
+- u_char *ucp = ptr;
+- return (ucp[1] << 8) | ucp[0] ;
++ short res = *(short *)ptr;
++
++ ptrtole(&res, sizeof(short));
++
++ return (res);
+ }
+
+-static inline long readlong(void * ptr)
++static inline long readlong(void *ptr)
+ {
+- char *cp = ptr;
+- u_char *ucp = ptr;
+- return (cp[3] << 24) | (ucp[2] << 16) | (ucp[1] << 8) | ucp[0] ;
++ long res = *(long *)ptr;
++
++ ptrtole(&res, sizeof(long));
++
++ return (res);
+ }
+
+-static inline u_long readulong(void * ptr)
++static inline void writeshort(void *ptr, int val)
+ {
+- u_char *ucp = ptr;
+- return (ucp[3] << 24) | (ucp[2] << 16) | (ucp[1] << 8) | ucp[0] ;
++ short *myptr = ptr;
++
++ *myptr = val;
++ ptrtole(myptr, sizeof(*myptr));
+ }
+
++static inline void writelong(void *ptr, int val)
++{
++ long *myptr = ptr;
+
+-#define READBYTE(p) *((byte *)p)++
+-#define READCHAR(p) *((char *)p)++
+-#define READSHORT(p) readshort ( ((short*) p)++)
+-#define READUSHORT(p) readushort(((USHORT*) p)++)
+-#define READLONG(p) readlong ( ((long*) p)++)
+-#define READULONG(p) readulong ( ((ULONG*) p)++)
+-#define READFIXED(p) readlong ( ((long*) p)++)
+-#define READANGLE(p) readulong ( ((ULONG*) p)++)
++ *myptr = val;
++ ptrtole(myptr, sizeof(*myptr));
++}
++
++#define WRITEBYTE(p,b) writeptr(&p, b, sizeof(byte))
++#define WRITECHAR(p,b) writeptr(&p, b, sizeof(char))
++#define WRITESHORT(p,b) writeptr(&p, b, sizeof(short))
++#define WRITEUSHORT(p,b) writeptr(&p, b, sizeof(USHORT))
++#define WRITELONG(p,b) writeptr(&p, b, sizeof(long))
++#define WRITEULONG(p,b) writeptr(&p, b, sizeof(ULONG))
++#define WRITEFIXED(p,b) writeptr(&p, b, sizeof(fixed_t))
++#define WRITEANGLE(p,b) writeptr(&p, b, sizeof(angle_t))
++#define WRITESTRING(p,b) { int tmp_i=0; do { WRITECHAR(p,b[tmp_i]); } while(b[tmp_i++]); }
++#define WRITESTRINGN(p,b,n) { int tmp_i=0; do { WRITECHAR(p,b[tmp_i]); if(!b[tmp_i]) break;tmp_i++; } while(tmp_i<n); }
++#define WRITEMEM(p,s,n) memcpy(p, s, n);p+=n
++
++#define READBYTE(p) readptr(&p, sizeof(byte))
++#define READCHAR(p) readptr(&p, sizeof(char))
++#define READSHORT(p) readptr(&p, sizeof(short))
++#define READUSHORT(p) readptr(&p, sizeof(USHORT))
++#define READLONG(p) readptr(&p, sizeof(long))
++#define READULONG(p) readptr(&p, sizeof(ULONG))
++#define READFIXED(p) readptr(&p, sizeof(fixed_t))
++#define READANGLE(p) readptr(&p, sizeof(angle_t))
+ #define READSTRING(p,s) { int tmp_i=0; do { s[tmp_i]=READBYTE(p); } while(s[tmp_i++]); }
+ #define SKIPSTRING(p) while(READBYTE(p))
+ #define READMEM(p,s,n) memcpy(s, p, n);p+=n
+-#endif //__BIG_ENDIAN__