r1243 - trunk

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Dec 30 22:47:36 EST 2007


Author: tjw
Date: 2007-12-30 22:47:36 -0500 (Sun, 30 Dec 2007)
New Revision: 1243

Modified:
   trunk/Makefile
   trunk/README
   trunk/make-macosx-ub.sh
Log:
* Improved Mac OS X build support.
* Dropped support for Mac OS X 10.2 to simplify things.  If anyone still
  needs this version supported let me know. 


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2007-12-30 21:37:39 UTC (rev 1242)
+++ trunk/Makefile	2007-12-31 03:47:36 UTC (rev 1243)
@@ -284,10 +284,6 @@
   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
   
@@ -296,33 +292,28 @@
     BASE_CFLAGS += -arch ppc -DSMP \
       -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc \
       -F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
-      -I"$(MACOSX_SDK_DIR)"/usr/lib/gcc/i686-apple-darwin9/4.0.1/include \
+      -I"$(MACOSX_SDK_DIR)"/"$(MACOSX_SDK_INC)" \
       -isystem "$(MACOSX_SDK_DIR)"/usr/include
     LDFLAGS += -arch ppc \
-      -L"$(MACOSX_SDK_DIR)"/usr/lib/gcc/darwin/4.0 \
+      -L"$(MACOSX_SDK_DIR)"/"$(MACOSX_SDK_LIB)" \
       -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
-
   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"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
-      -I"$(MACOSX_SDK_DIR)"/usr/lib/gcc/i686-apple-darwin9/4.0.1/include \
+      -I"$(MACOSX_SDK_DIR)"/"$(MACOSX_SDK_INC)" \
       -isystem "$(MACOSX_SDK_DIR)"/usr/include
     LDFLAGS = -arch i386 -mmacosx-version-min=10.4 \
-      -L"$(MACOSX_SDK_DIR)"/usr/lib/gcc/i686-apple-darwin9/4.0.1 \
+      -L"$(MACOSX_SDK_DIR)"/"$(MACOSX_SDK_LIB)" \
       -F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
       -Wl,-syslibroot,"$(MACOSX_SDK_DIR)"
     ARCH=i386
-#    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

Modified: trunk/README
===================================================================
--- trunk/README	2007-12-30 21:37:39 UTC (rev 1242)
+++ trunk/README	2007-12-31 03:47:36 UTC (rev 1243)
@@ -48,7 +48,9 @@
   2. Open an MSys terminal, and follow the instructions for compiling on *nix.
 
 For Mac OS X, building a Universal Binary
-  1. Install the MacOSX10.5.sdk
+  1. Install MacOSX SDK packages from XCode.  For maximum compatibility,
+     be sure to install MacOSX10.3.9.sdk and MacOSX10.4u.sdk.  
+     (MacOSX10.2.8.sdk no longer supported)
   2. Change to the directory containing this README file.
   3. Run './make-macosx-ub.sh'
   4. Copy the resulting ioquake3.app in /build/release-darwin-ub to your

Modified: trunk/make-macosx-ub.sh
===================================================================
--- trunk/make-macosx-ub.sh	2007-12-30 21:37:39 UTC (rev 1242)
+++ trunk/make-macosx-ub.sh	2007-12-31 03:47:36 UTC (rev 1243)
@@ -6,7 +6,6 @@
 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/'`;
@@ -39,27 +38,79 @@
 	echo "This script must be run from the ioquake3 build directory";
 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.
-
-for availsdks in /Developer/SDKs/*
+# we want to use the oldest available SDK for max compatiblity
+unset PPC_SDK_DIR
+unset X86_SDK_DIR
+unset PPC_SDK_INC
+unset X86_SDK_INC
+unset PPC_SDK_LIB
+unset X86_SDK_LIB
+unset PPC_SDK_OPENAL_DLOPEN
+for availsdks in $(find /Developer/SDKs -type d -maxdepth 1 -mindepth 1 -name "MacOSX*" -exec basename {} \; | sort -r)
 do
-	if [ -d $availsdks ]
-	then
-		SDKDIR="$availsdks"
-	fi
+	case "$availsdks" in
+	'MacOSX10.5u.sdk')
+		PPC_SDK_DIR=/Developer/SDKs/MacOSX10.5u.sdk
+		X86_SDK_DIR=/Developer/SDKs/MacOSX10.5u.sdk
+		PPC_SDK_INC=usr/lib/gcc/powerpc-apple-darwin9/4.0.1/include
+		X86_SDK_INC=usr/lib/gcc/i686-apple-darwin9/4.0.1/include
+		PPC_SDK_LIB=usr/lib/gcc/powerpc-apple-darwin9/4.0.1
+		X86_SDK_LIB=usr/lib/gcc/i686-apple-darwin9/4.0.1
+		PPC_SDK_OPENAL_DLOPEN=0
+	;;
+	'MacOSX10.4u.sdk')
+		PPC_SDK_DIR=/Developer/SDKs/MacOSX10.4u.sdk
+		X86_SDK_DIR=/Developer/SDKs/MacOSX10.4u.sdk
+		PPC_SDK_INC=usr/lib/gcc/powerpc-apple-darwin8/4.0.1/include
+		X86_SDK_INC=usr/lib/gcc/i686-apple-darwin8/4.0.1/include
+		PPC_SDK_LIB=usr/lib/gcc/powerpc-apple-darwin8/4.0.1
+		X86_SDK_LIB=usr/lib/gcc/i686-apple-darwin8/4.0.1
+		PPC_SDK_OPENAL_DLOPEN=0
+	;;
+	'MacOSX10.3.9.sdk')
+		PPC_SDK_DIR=/Developer/SDKs/MacOSX10.3.9.sdk
+		PPC_SDK_INC=usr/lib/gcc/powerpc-apple-darwin7/4.0.1/include
+		PPC_SDK_LIB=usr/lib/gcc/powerpc-apple-darwin7/4.0.1
+		PPC_SDK_OPENAL_DLOPEN=1
+	;;
+	'MacOSX10.2.8.sdk')
+		# no longer supported due to lack of dlfcn.h 
+		#PPC_SDK_DIR=/Developer/SDKs/MacOSX10.2.8.sdk
+		#PPC_SDK_INC=usr/include/gcc/darwin/3.3
+		#PPC_SDK_LIB=usr/lib/gcc/darwin/3.3
+		#PPC_SDK_OPENAL_DLOPEN=1
+	;;
+	*)
+		echo "WARNING: detected unknown MacOSX SDK ($availsdks)"
+	esac
 done
 
-if [ -z $SDKDIR ]
-then
-	echo "MacOSX SDK is missing. Please install a recent version of the MacOSX SDK."
+if [ -z $PPC_SDK_DIR ] || [ -z $X86_SDK_DIR ];  then
+	echo "Error detecting compatible Mac OS X SDK."
 	exit 1;
-else
-	echo "Using $SDKDIR for compilation"
 fi
 
-(BUILD_MACOSX_UB=ppc make && BUILD_MACOSX_UB=i386 make) || exit 1;
+if [ $PPC_SDK_DIR != "/Developer/SDKs/MacOSX10.3.9.sdk" ]; then
+	echo "WARNING: missing MacOS10.3.9.sdk.  Resulting binary may not be compatible with Mac OS X 10.3"
+	sleep 1
+fi
+if [ $X86_SDK_DIR != "/Developer/SDKs/MacOSX10.4u.sdk" ]; then
+	echo "WARNING: missing MacOS10.4u.sdk.  Resulting binary may not be compatible with Mac OS X 10.4"
+	sleep 1
+fi
 
+echo "Using $PPC_SDK_DIR for PowerPC"
+echo "Using $X86_SDK_DIR for Intel"
+
+(USE_OPENAL_DLOPEN=$PPC_SDK_OPENAL_DLOPEN \
+ MACOSX_SDK_DIR=$PPC_SDK_DIR \
+ MACOSX_SDK_INC=$PPC_SDK_INC \
+ MACOSX_SDK_LIB=$PPC_SDK_LIB BUILD_MACOSX_UB=ppc make \
+&&
+ MACOSX_SDK_DIR=$X86_SDK_DIR \
+ MACOSX_SDK_INC=$X86_SDK_INC \
+ MACOSX_SDK_LIB=$X86_SDK_LIB BUILD_MACOSX_UB=i386 make ) || exit 1 
+
 echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
 if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then
 	mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR || exit 1;




More information about the quake3-commits mailing list