Index: games/alienarena/Portfile
===================================================================
--- games/alienarena/Portfile	(revision 0)
+++ games/alienarena/Portfile	(revision 0)
@@ -0,0 +1,78 @@
+PortSystem              1.0
+
+name                    alienarena
+version                 7.45-20100726
+set version_number      [lindex [split ${version} -] 0]
+set version_date        [lindex [split ${version} -] 1]
+categories              games
+platforms               darwin
+maintainers             ryandesign
+license                 GPL-2+
+
+master_sites            http://icculus.org/alienarena/Files/
+worksrcdir              ${name}[join [split ${version_number} .] _]
+distname                ${worksrcdir}-Linux${version_date}
+use_zip                 yes
+
+checksums               sha1    9c982d097d885af0cbd06bfbe6c4185936c43c4d \
+                        rmd160  d20e167c66dec8ec072ecbf5833a4a4b46458a17
+
+depends_lib             port:curl \
+                        port:jpeg \
+                        port:libvorbis \
+                        port:mesa \
+                        port:xorg-libX11 \
+                        port:xorg-libXext \
+                        port:xorg-libXxf86dga \
+                        port:xorg-libXxf86vm
+
+build.dir               ${worksrcpath}/source
+
+post-extract {
+    # Remove pre-compiled Linux binaries.
+    delete ${worksrcpath}/crded ${worksrcpath}/crx ${worksrcpath}/data1/game.so
+    
+    # DOS to UNIX line endings so we can patch properly.
+    reinplace "s|\r||g" ${build.dir}/game/q_shared.h
+}
+
+patchfiles              patch-source-game-q_shared.h.diff \
+                        patch-source-unix-q_shunix.c.diff
+
+use_configure           no
+
+platform darwin {
+    patchfiles-append   patch-source-Makefile.diff \
+                        patch-source-client-qal.h.diff \
+                        patch-source-client-snd_openal.c.diff
+    configure.cflags-append -D__unix__
+}
+
+variant universal {}
+if {[variant_isset universal]} {
+    set archflags ${configure.universal_cflags}
+} else {
+    set archflags ${configure.cc_archflags}
+}
+
+build.env               CC="${configure.cc}" \
+                        CFLAGS="${configure.cflags} ${archflags}" \
+                        LDFLAGS="${configure.ldflags} ${archflags}" \
+                        PREFIX="${prefix}" \
+                        LOCALBASE="${prefix}" \
+                        X11BASE="${prefix}" \
+                        WITH_DATADIR=yes \
+                        WITH_LIBDIR=yes
+
+destroot.dir            ${build.dir}/release
+
+destroot {
+    xinstall -W ${destroot.dir} crx ${destroot}${prefix}/bin
+    xinstall -W ${destroot.dir} crded ${destroot}${prefix}/sbin
+    
+    xinstall -d ${destroot}${prefix}/lib/${name}
+    xinstall -W ${destroot.dir} -m 644 game.dylib ${destroot}${prefix}/lib/${name}
+    
+    xinstall -d ${destroot}${prefix}/share/${name}
+    copy ${worksrcpath}/data1 ${worksrcpath}/arena ${destroot}${prefix}/share/${name}
+}
Index: games/alienarena/files/patch-source-Makefile.diff
===================================================================
--- games/alienarena/files/patch-source-Makefile.diff	(revision 0)
+++ games/alienarena/files/patch-source-Makefile.diff	(revision 0)
@@ -0,0 +1,28 @@
+--- source/Makefile	(revision 1999)
++++ source/Makefile	(working copy)
+@@ -46,11 +46,7 @@
+ NULL_DIR=		$(MOUNT_DIR)/null
+ ARENA_DIR=		$(GAME_DIR)
+ 
+-ifeq ($(ARCH),x86_64)
+-	_LIB := lib64
+-else
+-	_LIB := lib
+-endif
++_LIB := lib
+ 
+ BASE_CFLAGS=$(CFLAGS) -Dstricmp=strcasecmp -D_stricmp=strcasecmp -I$(X11BASE)/include -fno-strict-aliasing -fmerge-constants -DHAVE_CURL -lpthread
+ 
+@@ -108,9 +104,9 @@
+ 
+ GLXLDFLAGS=-L$(X11BASE)/$(_LIB) -L$(LOCALBASE)/$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm -lm -ljpeg -lGL -lGLU
+ 
+-SHLIBEXT=so
+-SHLIBCFLAGS=-fPIC
+-SHLIBLDFLAGS=-shared
++SHLIBEXT=dylib
++SHLIBCFLAGS=
++SHLIBLDFLAGS=-dynamiclib
+ 
+ OPPENALCFLAGS+=$(shell pkg-config --cflags openal)
+ 
Index: games/alienarena/files/patch-source-client-qal.h.diff
===================================================================
--- games/alienarena/files/patch-source-client-qal.h.diff	(revision 0)
+++ games/alienarena/files/patch-source-client-qal.h.diff	(revision 0)
@@ -0,0 +1,13 @@
+--- source/client/qal.h	(revision 1999)
++++ source/client/qal.h	(working copy)
+@@ -24,8 +24,8 @@
+ #include <al.h>
+ #include <alc.h>
+ #else
+-#include <AL/al.h>
+-#include <AL/alc.h>
++#include <OpenAL/al.h>
++#include <OpenAL/alc.h>
+ #endif
+ 
+ /*
Index: games/alienarena/files/patch-source-client-snd_openal.c.diff
===================================================================
--- games/alienarena/files/patch-source-client-snd_openal.c.diff	(revision 0)
+++ games/alienarena/files/patch-source-client-snd_openal.c.diff	(revision 0)
@@ -0,0 +1,11 @@
+--- source/client/snd_openal.c	(revision 1999)
++++ source/client/snd_openal.c	(working copy)
+@@ -30,7 +30,7 @@
+  */
+ 
+ #include <stdio.h>
+-#include <malloc.h>
++#include <malloc/malloc.h>
+ #include <string.h>
+ 
+ #include "client.h"
Index: games/alienarena/files/patch-source-unix-q_shunix.c.diff
===================================================================
--- games/alienarena/files/patch-source-unix-q_shunix.c.diff	(revision 0)
+++ games/alienarena/files/patch-source-unix-q_shunix.c.diff	(revision 0)
@@ -0,0 +1,18 @@
+--- source/unix/q_shunix.c	(revision 1999)
++++ source/unix/q_shunix.c	(working copy)
+@@ -35,7 +35,15 @@
+ #ifndef __linux__
+ /* For round_page() macro. */
+ #include <machine/param.h>
++#ifndef round_page
++size_t round_page (size_t size)
++{
++    int pagesize = sysconf(_SC_PAGESIZE);
++    // This is wrong (too large) when size == 0, oh well
++    return (1 + (size - 1) / pagesize) * pagesize;
++}
+ #endif
++#endif
+ 
+ //===============================================================================
+ 
Index: games/alienarena/files/patch-source-game-q_shared.h.diff
===================================================================
--- games/alienarena/files/patch-source-game-q_shared.h.diff	(revision 0)
+++ games/alienarena/files/patch-source-game-q_shared.h.diff	(revision 0)
@@ -0,0 +1,15 @@
+--- source/game/q_shared.h	(revision 1999)
++++ source/game/q_shared.h	(working copy)
+@@ -60,7 +60,11 @@
+ #endif
+ 
+ typedef unsigned char 		byte;
+-typedef enum {false, true}	qboolean;
++#ifndef true
++# define false 0
++# define true 1
++#endif
++typedef byte qboolean;
+ 
+ 
+ #ifndef NULL
