diff --git a/Makefile b/Makefile index 230d874d..5efa3f62 100644 --- a/Makefile +++ b/Makefile @@ -283,45 +283,46 @@ ifeq ($(PLATFORM),darwin) 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 @@ ifeq ($(PLATFORM),darwin) 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) diff --git a/code/sdl/sdl_input.c b/code/sdl/sdl_input.c index 0663c7fe..d285ccbf 100644 --- a/code/sdl/sdl_input.c +++ b/code/sdl/sdl_input.c @@ -44,7 +44,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifdef MACOS_X_ACCELERATION_HACK #include #include -#include +#include #endif //#define KBD_DBG diff --git a/make-macosx-ub.sh b/make-macosx-ub.sh index 6f524f2f..6758e1e0 100755 --- a/make-macosx-ub.sh +++ b/make-macosx-ub.sh @@ -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 @@ BIN_OBJ=" 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 @@ if [ ! -f Makefile ]; then 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 @@ echo " " > $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/