* 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.
This commit is contained in:
Tony J. White = 2007-12-31 03:47:36 +00:00
parent c1f8727f0f
commit 2d32d3dbff
3 changed files with 73 additions and 29 deletions

View file

@ -284,10 +284,6 @@ ifeq ($(PLATFORM),darwin)
LDFLAGS= LDFLAGS=
OPTIMIZE= OPTIMIZE=
ifndef MACOSX_SDK_DIR
MACOSX_SDK_DIR="/Developer/SDKs/MacOSX10.5.sdk"
endif
# building the QVMs on MacOSX is broken, atm. # building the QVMs on MacOSX is broken, atm.
BUILD_GAME_QVM=0 BUILD_GAME_QVM=0
@ -296,33 +292,28 @@ ifeq ($(PLATFORM),darwin)
BASE_CFLAGS += -arch ppc -DSMP \ BASE_CFLAGS += -arch ppc -DSMP \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc \ -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -nostdinc \
-F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \ -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 -isystem "$(MACOSX_SDK_DIR)"/usr/include
LDFLAGS += -arch ppc \ 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 \ -F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
-Wl,-syslibroot,"$(MACOSX_SDK_DIR)" -Wl,-syslibroot,"$(MACOSX_SDK_DIR)"
ARCH=ppc ARCH=ppc
# OS X 10.2 sdk lacks dlopen() so ded would need libSDL anyway
# BUILD_SERVER=0
else else
ifeq ($(BUILD_MACOSX_UB),i386) ifeq ($(BUILD_MACOSX_UB),i386)
CC=gcc-4.0 CC=gcc-4.0
BASE_CFLAGS += -arch i386 -DSMP \ BASE_CFLAGS += -arch i386 -DSMP \
-mmacosx-version-min=10.4 \ -mmacosx-version-min=10.4 \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -nostdinc \ -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -nostdinc \
-F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \ -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 -isystem "$(MACOSX_SDK_DIR)"/usr/include
LDFLAGS = -arch i386 -mmacosx-version-min=10.4 \ 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 \ -F"$(MACOSX_SDK_DIR)"/System/Library/Frameworks \
-Wl,-syslibroot,"$(MACOSX_SDK_DIR)" -Wl,-syslibroot,"$(MACOSX_SDK_DIR)"
ARCH=i386 ARCH=i386
# BUILD_SERVER=0
else else
# for whatever reason using the headers in the MacOSX SDKs tend to throw # 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 # errors even though they are identical to the system ones which don't

4
README
View file

@ -48,7 +48,9 @@ For Windows, using MinGW
2. Open an MSys terminal, and follow the instructions for compiling on *nix. 2. Open an MSys terminal, and follow the instructions for compiling on *nix.
For Mac OS X, building a Universal Binary 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. 2. Change to the directory containing this README file.
3. Run './make-macosx-ub.sh' 3. Run './make-macosx-ub.sh'
4. Copy the resulting ioquake3.app in /build/release-darwin-ub to your 4. Copy the resulting ioquake3.app in /build/release-darwin-ub to your

View file

@ -6,7 +6,6 @@ PKGINFO=APPLIOQ3
ICNS=misc/quake3.icns ICNS=misc/quake3.icns
DESTDIR=build/release-darwin-ub DESTDIR=build/release-darwin-ub
BASEDIR=baseq3 BASEDIR=baseq3
SDKDIR=""
MPACKDIR=missionpack MPACKDIR=missionpack
Q3_VERSION=`grep "\#define Q3_VERSION" code/qcommon/q_shared.h | \ Q3_VERSION=`grep "\#define Q3_VERSION" code/qcommon/q_shared.h | \
sed -e 's/.*".* \([^ ]*\)"/\1/'`; sed -e 's/.*".* \([^ ]*\)"/\1/'`;
@ -39,26 +38,78 @@ if [ ! -f Makefile ]; then
echo "This script must be run from the ioquake3 build directory"; echo "This script must be run from the ioquake3 build directory";
fi 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, # we want to use the oldest available SDK for max compatiblity
# thus the last valid one is the one we want. unset PPC_SDK_DIR
unset X86_SDK_DIR
for availsdks in /Developer/SDKs/* 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 do
if [ -d $availsdks ] case "$availsdks" in
then 'MacOSX10.5u.sdk')
SDKDIR="$availsdks" PPC_SDK_DIR=/Developer/SDKs/MacOSX10.5u.sdk
fi 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 done
if [ -z $SDKDIR ] if [ -z $PPC_SDK_DIR ] || [ -z $X86_SDK_DIR ]; then
then echo "Error detecting compatible Mac OS X SDK."
echo "MacOSX SDK is missing. Please install a recent version of the MacOSX SDK."
exit 1; exit 1;
else
echo "Using $SDKDIR for compilation"
fi 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" echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then