r1238 - in trunk: . code/sdl

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Dec 14 11:54:14 EST 2007


Author: thilo
Date: 2007-12-14 11:54:13 -0500 (Fri, 14 Dec 2007)
New Revision: 1238

Modified:
   trunk/Makefile
   trunk/code/sdl/sdl_input.c
   trunk/make-macosx-ub.sh
Log:
Fix building on MacOSX.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2007-12-14 16:25:33 UTC (rev 1237)
+++ trunk/Makefile	2007-12-14 16:54:13 UTC (rev 1238)
@@ -283,45 +283,46 @@
   CLIENT_LDFLAGS=
   LDFLAGS=
   OPTIMIZE=
+  
+  ifndef MACOSX_SDK_DIR
+  	MACOSX_SDK_DIR="/Developer/SDKs/MacOSX10.5.sdk"
+  endif
+
+  # building the QVMs on MacOSX is broken, atm.
+  BUILD_GAME_QVM=0
+  
   ifeq ($(BUILD_MACOSX_UB),ppc)
-    CC=gcc-3.3
+    CC=gcc-4.0
     BASE_CFLAGS += -arch ppc -DSMP \
       -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc \
-      -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
-      -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
-      -isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include
-    # when using the 10.2 SDK we are not allowed the two-level namespace so
-    # in order to get the OpenAL dlopen() stuff to work without major
-    # modifications, the controversial -m linker flag must be used.  this
-    # throws a ton of multiply defined errors which cannot be suppressed.
+      -F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
+      -I"$(MACOSX_SDK_DIR)"/usr/lib/gcc/i686-apple-darwin9/4.0.1/include \
+      -isystem "$(MACOSX_SDK_DIR)"/usr/include
     LDFLAGS += -arch ppc \
-      -L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
-      -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
-      -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk,-m
+      -L"$(MACOSX_SDK_DIR)"/usr/lib/gcc/darwin/4.0 \
+      -F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
+      -Wl,-syslibroot,"$(MACOSX_SDK_DIR)"
     ARCH=ppc
 
     # OS X 10.2 sdk lacks dlopen() so ded would need libSDL anyway
-    BUILD_SERVER=0
+#    BUILD_SERVER=0
 
-    # because of a problem with linking on 10.2 this will generate multiply
-    # defined symbol errors.  The errors can be turned into warnings with
-    # the -m linker flag, but you can't shut up the warnings
-    USE_OPENAL_DLOPEN=1
   else
+
   ifeq ($(BUILD_MACOSX_UB),i386)
     CC=gcc-4.0
     BASE_CFLAGS += -arch i386 -DSMP \
       -mmacosx-version-min=10.4 \
       -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -nostdinc \
-      -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
-      -I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \
-      -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include
+      -F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
+      -I"$(MACOSX_SDK_DIR)"/usr/lib/gcc/i686-apple-darwin9/4.0.1/include \
+      -isystem "$(MACOSX_SDK_DIR)"/usr/include
     LDFLAGS = -arch i386 -mmacosx-version-min=10.4 \
-      -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1 \
-      -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
-      -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
+      -L"$(MACOSX_SDK_DIR)"/usr/lib/gcc/i686-apple-darwin9/4.0.1 \
+      -F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
+      -Wl,-syslibroot,"$(MACOSX_SDK_DIR)"
     ARCH=i386
-    BUILD_SERVER=0
+#    BUILD_SERVER=0
   else
     # for whatever reason using the headers in the MacOSX SDKs tend to throw
     # errors even though they are identical to the system ones which don't
@@ -343,9 +344,6 @@
 
   BASE_CFLAGS += -fno-strict-aliasing -DMACOS_X -fno-common -pipe
 
-  # Always include debug symbols...you can strip the binary later...
-  BASE_CFLAGS += -gfull
-
   ifeq ($(USE_OPENAL),1)
     BASE_CFLAGS += -DUSE_OPENAL
     ifneq ($(USE_OPENAL_DLOPEN),1)

Modified: trunk/code/sdl/sdl_input.c
===================================================================
--- trunk/code/sdl/sdl_input.c	2007-12-14 16:25:33 UTC (rev 1237)
+++ trunk/code/sdl/sdl_input.c	2007-12-14 16:54:13 UTC (rev 1238)
@@ -44,7 +44,7 @@
 #ifdef MACOS_X_ACCELERATION_HACK
 #include <IOKit/hidsystem/IOHIDLib.h>
 #include <IOKit/hidsystem/IOHIDParameter.h>
-#include <drivers/event_status_driver.h>
+#include <IOKit/hidsystem/event_status_driver.h>
 #endif
 
 //#define KBD_DBG

Modified: trunk/make-macosx-ub.sh
===================================================================
--- trunk/make-macosx-ub.sh	2007-12-14 16:25:33 UTC (rev 1237)
+++ trunk/make-macosx-ub.sh	2007-12-14 16:54:13 UTC (rev 1238)
@@ -1,10 +1,12 @@
 #!/bin/sh
 APPBUNDLE=ioquake3.app
 BINARY=ioquake3.ub
+DEDBIN=ioq3ded.ub
 PKGINFO=APPLIOQ3
 ICNS=misc/quake3.icns
 DESTDIR=build/release-darwin-ub
 BASEDIR=baseq3
+SDKDIR=""
 MPACKDIR=missionpack
 Q3_VERSION=`grep "\#define Q3_VERSION" code/qcommon/q_shared.h | \
 	sed -e 's/.*".* \([^ ]*\)"/\1/'`;
@@ -13,6 +15,10 @@
 	build/release-darwin-ppc/ioquake3.ppc
 	build/release-darwin-i386/ioquake3.i386
 "
+BIN_DEDOBJ="
+	build/release-darwin-ppc/ioq3ded.ppc
+	build/release-darwin-i386/ioq3ded.i386
+"
 BASE_OBJ="
 	build/release-darwin-ppc/$BASEDIR/cgameppc.dylib
 	build/release-darwin-i386/$BASEDIR/cgamei386.dylib
@@ -33,18 +39,23 @@
 	echo "This script must be run from the ioquake3 build directory";
 fi
 
-if [ ! -d /Developer/SDKs/MacOSX10.2.8.sdk ]; then
-	echo "
-/Developer/SDKs/MacOSX10.2.8.sdk/ is missing.
-The installer for this SDK is included with XCode 2.2 or newer"
-	exit 1;
-fi
+# this is kind of a hack to find out the latest SDK to use. I assume that newer SDKs appear later in this for loop,
+# thus the last valid one is the one we want.
 
-if [ ! -d /Developer/SDKs/MacOSX10.4u.sdk ]; then
-	echo "
-/Developer/SDKs/MacOSX10.4u.sdk/ is missing.   
-The installer for this SDK is included with XCode 2.2 or newer"
+for availsdks in /Developer/SDKs/*
+do
+	if [ -d $availsdks ]
+	then
+		SDKDIR="$availsdks"
+	fi
+done
+
+if [ -z $SDKDIR ]
+then
+	echo "MacOSX SDK is missing. Please install a recent version of the MacOSX SDK."
 	exit 1;
+else
+	echo "Using $SDKDIR for compilation"
 fi
 
 (BUILD_MACOSX_UB=ppc make && BUILD_MACOSX_UB=i386 make) || exit 1;
@@ -99,6 +110,7 @@
 	" > $DESTDIR/$APPBUNDLE/Contents/Info.plist
 
 lipo -create -o $DESTDIR/$APPBUNDLE/Contents/MacOS/$BINARY $BIN_OBJ
+lipo -create -o $DESTDIR/$APPBUNDLE/Contents/MacOS/$DEDBIN $BIN_DEDOBJ
 cp $BASE_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR/
 cp $MPACK_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR/
 cp code/libs/macosx/*.dylib $DESTDIR/$APPBUNDLE/Contents/MacOS/




More information about the quake3-commits mailing list