Index: /trunk/dports/science/magic/Portfile
===================================================================
--- /trunk/dports/science/magic/Portfile	(revision 97858)
+++ /trunk/dports/science/magic/Portfile	(revision 97859)
@@ -34,5 +34,6 @@
                     sha256  c809d4b497acfa69da729d06e0b4ceaab9b4eada89c38f79056f82db943667ab
 
-patchfiles          patch-scripts-configure.in.diff
+patchfiles          patch-scripts-configure.in.diff \
+                    patch-__APPLE__.diff
 
 conflicts_build     gnome-keyring
Index: /trunk/dports/science/magic/files/patch-__APPLE__.diff
===================================================================
--- /trunk/dports/science/magic/files/patch-__APPLE__.diff	(revision 97859)
+++ /trunk/dports/science/magic/files/patch-__APPLE__.diff	(revision 97859)
@@ -0,0 +1,215 @@
+--- graphics/X11Helper.c.orig	2008-09-08 14:56:47.000000000 -0500
++++ graphics/X11Helper.c	2012-09-17 19:34:00.000000000 -0500
+@@ -142,7 +142,7 @@
+ 
+ 	keymod = (LockMask | ControlMask | ShiftMask)
+ 				& KeyPressedEvent->state;
+-#ifdef macosx
++#ifdef __APPLE__
+ 	if (KeyPressedEvent->state & (Mod1Mask | Mod2Mask | Mod3Mask
+ 				| Mod4Mask | Mod5Mask))
+ 	    keymod |= Mod1Mask;
+--- graphics/grTOGL1.c.orig	2008-09-08 14:56:47.000000000 -0500
++++ graphics/grTOGL1.c	2012-09-17 19:34:02.000000000 -0500
+@@ -517,7 +517,7 @@
+ 		keymod = (LockMask | ControlMask | ShiftMask)
+ 				& KeyPressedEvent->state;
+ 
+-#ifdef macosx
++#ifdef __APPLE__
+ 		/* Change by Philippe---Allows magic to deal with Mac OS-X
+ 		 * mapping Meta to Mod2 instead of Mod1
+ 		 */
+--- graphics/grTk1.c.orig	2008-09-08 14:56:47.000000000 -0500
++++ graphics/grTk1.c	2012-09-17 19:34:03.000000000 -0500
+@@ -75,7 +75,7 @@
+ extern bool GrTkInstalledCMap;
+ 
+ /* machine-dependent constants - see below */
+-#ifdef macosx
++#ifdef __APPLE__
+ #define X_COLORMAP_BASE		128
+ #define X_COLORMAP_RESERVED	4
+ #else
+@@ -806,7 +806,7 @@
+ 
+ 		keymod = (LockMask | ControlMask | ShiftMask)
+ 				& KeyPressedEvent->state;
+-#ifdef macosx
++#ifdef __APPLE__
+ 		if (KeyPressedEvent->state & (Mod1Mask | Mod2Mask |
+ 				Mod3Mask | Mod4Mask | Mod5Mask))
+ 		    keymod |= Mod1Mask;
+--- graphics/grX11su1.c.orig	2006-04-10 17:03:14.000000000 -0500
++++ graphics/grX11su1.c	2012-09-17 19:34:01.000000000 -0500
+@@ -65,7 +65,7 @@
+ 
+ /* machine-dependent constants - see below */
+ 
+-#ifdef macosx
++#ifdef __APPLE__
+ #define X_COLORMAP_BASE		128
+ #define X_COLORMAP_RESERVED	4
+ #else
+--- graphics/grX11thread.c.orig	2008-09-08 14:56:47.000000000 -0500
++++ graphics/grX11thread.c	2012-09-17 19:34:00.000000000 -0500
+@@ -78,7 +78,7 @@
+ 
+ 	keymod = (LockMask | ControlMask | ShiftMask)
+ 				& KeyPressedEvent->state;
+-#ifdef macosx
++#ifdef __APPLE__
+ 	if (KeyPressedEvent->state & (Mod1Mask | Mod2Mask | Mod3Mask
+ 				| Mod4Mask | Mod5Mask))
+ 	    keymod |= Mod1Mask;
+--- plot/plotInt.h.orig	2010-03-08 07:33:07.000000000 -0600
++++ plot/plotInt.h	2012-09-17 19:33:59.000000000 -0500
+@@ -28,7 +28,7 @@
+ #define VERSATEC		/* Add this for HP plotter support */
+ 
+ /* system V machines lack vfont.h, so include the defs below. */
+-#if  !defined(SYSV) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(CYGWIN) && !defined(macosx) && !defined(__DragonFly__)
++#if  !defined(SYSV) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(CYGWIN) && !defined(__APPLE__) && !defined(__DragonFly__)
+ #include <vfont.h>
+ #else
+ struct header {
+--- plow/PlowMain.c.orig	2006-04-10 17:03:13.000000000 -0500
++++ plow/PlowMain.c	2012-09-17 19:33:58.000000000 -0500
+@@ -46,7 +46,7 @@
+ #include "utils/main.h"
+ #include "select/select.h"
+ 
+-#if defined(SYSV) || defined(macosx)
++#if defined(SYSV) || defined(__APPLE__)
+ # define	NO_RUSAGE
+ #endif
+ 
+--- resis/ResRex.c.orig	2010-03-08 07:33:07.000000000 -0600
++++ resis/ResRex.c	2012-09-17 19:33:45.000000000 -0500
+@@ -12,7 +12,7 @@
+ /* It is hard to get the value of MAXFLOAT in a portable manner. */
+ #if defined(ibm032)
+ #define MAXFLOAT        ((float)3.40282346638528860e+38)
+-#elif !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(CYGWIN) && !defined(macosx) && !defined(__DragonFly__)
++#elif !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(CYGWIN) && !defined(__APPLE__) && !defined(__DragonFly__)
+ #include <values.h>
+ #endif
+ 
+--- scripts/configure.in.orig	2010-03-08 07:33:07.000000000 -0600
++++ scripts/configure.in	2012-09-17 19:33:38.000000000 -0500
+@@ -1137,7 +1137,6 @@
+     AC_DEFINE(WIN32)
+     ;;
+   *darwin*)
+-    AC_DEFINE(macosx)
+     if test "$CPP" = "cc -E" ; then
+        CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
+     fi
+--- sim/SimRsim.c.orig	2006-04-10 17:03:13.000000000 -0500
++++ sim/SimRsim.c	2012-09-17 19:33:23.000000000 -0500
+@@ -626,7 +626,7 @@
+     int 	charsRead = 0;
+     char 	*temp;
+     int		n, nfd;
+-#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(macosx)
++#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__)
+     fd_set readfds, writefds, exceptfds;
+ #else
+     int		nr, nex;
+@@ -642,7 +642,7 @@
+ 
+     /* read reply from Rsim */
+ 
+-#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(macosx)
++#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__)
+     FD_ZERO(&readfds);
+     FD_ZERO(&exceptfds);
+ #endif  /* SYSV */
+@@ -651,7 +651,7 @@
+ 
+ try_again:
+ 
+-#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(macosx)
++#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__)
+     FD_SET(pipeIn, &readfds);
+     FD_ZERO(&writefds);
+     FD_SET(pipeIn, &exceptfds);
+--- utils/getrect.c.orig	2010-03-08 07:33:08.000000000 -0600
++++ utils/getrect.c	2012-09-17 19:33:22.000000000 -0500
+@@ -65,7 +65,7 @@
+ #define	FILE_PTR(fin)	((char *) fin->_IO_read_ptr)
+ #define FILE_DEC_CNT(fin, n)	
+ #define	FILE_SET_PTR(fin, cp) ((fin)->_IO_read_ptr = (cp))
+-#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(CYGWIN) || defined(macosx)
++#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(CYGWIN) || defined(__APPLE__)
+ #define FILE_CNT(fin)   ((fin)->_r)
+ #define FILE_PTR(fin)   ((char *)(fin)->_p)
+ #define FILE_DEC_CNT(fin, n)  ((fin)->_r -= (n))
+--- utils/magic.h.orig	2010-03-08 07:33:08.000000000 -0600
++++ utils/magic.h	2012-09-17 19:33:21.000000000 -0500
+@@ -280,10 +280,10 @@
+ #ifdef CYGWIN
+ #include <errno.h>
+ #define sys_errlist _sys_errlist
+-#elif !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(macosx)
++#elif !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__) && !defined(__APPLE__)
+ extern int errno;
+ /* extern char *sys_errlist[]; */
+-#elif defined(macosx)
++#elif defined(__APPLE__)
+ extern int errno;
+ #endif
+ 
+@@ -293,7 +293,7 @@
+ 
+ #ifndef  __STDC__
+ #ifndef	SYSV
+-#if !defined(ALPHA) && !defined(macosx)
++#if !defined(ALPHA) && !defined(__APPLE__)
+     extern char* sprintf();
+ #endif
+ #endif
+--- utils/netlist.c.orig	2006-07-27 11:29:53.000000000 -0500
++++ utils/netlist.c	2012-09-17 19:33:21.000000000 -0500
+@@ -365,7 +365,7 @@
+     static char tempId[100];
+ #if defined(linux) || defined(CYGWIN)
+     extern int etext asm("etext");
+-#elif defined(macosx)
++#elif defined(__APPLE__)
+  int etext;
+ #else
+     extern int etext;
+--- utils/runstats.c.orig	2006-04-14 20:05:01.000000000 -0500
++++ utils/runstats.c	2012-09-17 19:33:20.000000000 -0500
+@@ -32,7 +32,7 @@
+ 
+ /* Library imports: */
+ 
+-#ifndef macosx
++#ifndef __APPLE__
+ extern char *sbrk();
+ extern end;
+ #else
+--- utils/signals.c.orig	2010-03-08 07:33:08.000000000 -0600
++++ utils/signals.c	2012-09-17 19:33:20.000000000 -0500
+@@ -76,7 +76,7 @@
+ extern bool DBWriteBackup();
+ 
+ /* macs support BSD4.2 signals, so turn off the SYSV flag for this module */
+-#ifdef macosx
++#ifdef __APPLE__
+ #undef SYSV
+ #endif
+ 
+--- utils/utils.h.orig	2006-07-28 18:12:49.000000000 -0500
++++ utils/utils.h	2012-09-17 19:33:19.000000000 -0500
+@@ -77,7 +77,7 @@
+ #define FORK_f(pid) do { pid = fork(); if (pid > 0) ForkChildAdd (pid); } while (0)
+ #define FORK_vf(pid) do { pid = vfork(); if (pid > 0) ForkChildAdd (pid); } while (0)
+ 
+-#if  defined(SYSV) || defined(CYGWIN) || defined(macosx)
++#if  defined(SYSV) || defined(CYGWIN) || defined(__APPLE__)
+ 
+ #define FORK(pid) FORK_f(pid)
+ 
