aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-08-02 04:01:36 +0000
committertjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-08-02 04:01:36 +0000
commit3b416e75cf3a6c81d4dd1d83418a3b42d739f72f (patch)
tree7654c52f2c471984a4c507ba0256e2057df086af
parente6a0afad175d5c1ec113ed652e39b30ba15180d2 (diff)
downloadioquake3-aero-3b416e75cf3a6c81d4dd1d83418a3b42d739f72f.tar.gz
ioquake3-aero-3b416e75cf3a6c81d4dd1d83418a3b42d739f72f.zip
bug 2723
* adds a shell script ./make-macosx-ub.sh that builds Mac OS X Universal Binary * fixes Mac OS X x86 VM crashes (-mstackrealign) * adds current working directory to the search path on Mac OS X to make working with .app bundles easier * various tweaks to make ioquake3 build against the 10.2 SDK * changed default OpenAL .dylib location to the path of the one included with the Framework bundled in 10.4 (for USE_OPENAL_DLOPEN) * updated to a Universal libSDL-1.2.0.dylib git-svn-id: svn://svn.icculus.org/quake3/trunk@830 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--Makefile133
-rw-r--r--code/client/snd_openal.c2
-rwxr-xr-xcode/libs/macosx/libSDL-1.2.0.dylibbin1506244 -> 4469500 bytes
-rw-r--r--code/qcommon/files.c4
-rw-r--r--code/unix/sdl_glimp.c7
-rw-r--r--code/unix/unix_net.c4
-rwxr-xr-xmake-macosx-ub.sh62
7 files changed, 165 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index e9f969f..a5a3d05 100644
--- a/Makefile
+++ b/Makefile
@@ -262,44 +262,107 @@ else # ifeq Linux
ifeq ($(PLATFORM),darwin)
CC=gcc
-
- # !!! FIXME: calling conventions are still broken! See Bugzilla #2519
VM_PPC=vm_ppc_new
+ HAVE_VM_COMPILED=true
+ BASE_CFLAGS=
+ CLIENT_LDFLAGS=
+ LDFLAGS=
+ OPTIMIZE=
+ ifeq ($(BUILD_MACOSX_UB),ppc)
+ CC=gcc-3.3
+ 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.
+ 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
+ ARCH=ppc
+
+ # OS X 10.2 sdk lacks dlopen() so ded would need libSDL anyway
+ 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),x86)
+ CC=gcc-4.0
+ BASE_CFLAGS += -arch i386 -DSMP \
+ -isysroot /Developer/SDKs/MacOSX10.4u.sdk \
+ -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
+ LDFLAGS = -mmacosx-version-min=10.4 \
+ -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1
+ ARCH=x86
+ 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
+ # therefore we shut up warning flags when running the universal build
+ # script as much as possible.
+ BASE_CFLAGS += -Wall -Wimplicit -Wstrict-prototypes
+ endif
+ endif
- BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
- BASE_CFLAGS += -DMACOS_X -fno-common -pipe
+ ifeq ($(ARCH),ppc)
+ OPTIMIZE += -faltivec
+ # Carbon is required on PPC only to make a call to MakeDataExecutable
+ # in the PPC vm (should be a better non-Carbon way).
+ LDFLAGS += -framework Carbon
+ endif
+ ifeq ($(ARCH),x86)
+ OPTIMIZE += -msse2
+ # x86 vm will crash without -mstackrealign since MMX instructions will be
+ # used no matter what and they corrupt the frame pointer in VM calls
+ BASE_CFLAGS += -mstackrealign
+ endif
+
+ 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=1
- ifeq ($(USE_OPENAL_DLOPEN),1)
+ ifneq ($(USE_OPENAL_DLOPEN),1)
+ CLIENT_LDFLAGS += -framework OpenAL
+ else
BASE_CFLAGS += -DUSE_OPENAL_DLOPEN=1
endif
endif
ifeq ($(USE_CODEC_VORBIS),1)
BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
+ CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
endif
ifeq ($(USE_SDL),1)
- BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 -I$(SDLHDIR)/include
+ BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 -D_THREAD_SAFE=1 \
+ -I$(SDLHDIR)/include
GL_CFLAGS =
+ # We copy sdlmain before ranlib'ing it so that subversion doesn't think
+ # the file has been modified by each build.
+ LIBSDLMAIN=$(B)/libSDLmain.a
+ LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
+ CLIENT_LDFLAGS += -framework Cocoa -framework OpenGL \
+ $(LIBSDIR)/macosx/libSDL-1.2.0.dylib
+ else
+ # !!! FIXME: frameworks: OpenGL, Carbon, etc...
+ #CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
endif
- OPTIMIZE = -O3 -ffast-math -falign-loops=16
-
- ifeq ($(ARCH),ppc)
- BASE_CFLAGS += -faltivec
- ifneq ($(VM_PPC),)
- HAVE_VM_COMPILED=true
- endif
- endif
-
- ifeq ($(ARCH),i386)
- # !!! FIXME: x86-specific flags here...
- endif
+ OPTIMIZE += -O3 -ffast-math -falign-loops=16
ifneq ($(HAVE_VM_COMPILED),true)
BASE_CFLAGS += -DNO_VM_COMPILED
@@ -315,34 +378,6 @@ ifeq ($(PLATFORM),darwin)
NOTSHLIBCFLAGS=-mdynamic-no-pic
- #THREAD_LDFLAGS=-lpthread
- #LDFLAGS=-ldl -lm
- LDFLAGS += -framework Carbon
-
- ifeq ($(USE_SDL),1)
- # We copy sdlmain before ranlib'ing it so that subversion doesn't think
- # the file has been modified by each build.
- LIBSDLMAIN=$(B)/libSDLmain.a
- LIBSDLMAINSRC=$(LIBSDIR)/macosx/libSDLmain.a
- CLIENT_LDFLAGS=-framework Cocoa -framework OpenGL $(LIBSDIR)/macosx/libSDL-1.2.0.dylib
- else
- # !!! FIXME: frameworks: OpenGL, Carbon, etc...
- #CLIENT_LDFLAGS=-L/usr/X11R6/$(LIB) -lX11 -lXext -lXxf86dga -lXxf86vm
- endif
-
- # -framework OpenAL requires 10.4 or later...for builds shipping to the
- # public, you'll want to use USE_OPENAL_DLOPEN and ship your own OpenAL
- # library (http://openal.org/ or http://icculus.org/al_osx/)
- ifeq ($(USE_OPENAL),1)
- ifneq ($(USE_OPENAL_DLOPEN),1)
- CLIENT_LDFLAGS += -framework OpenAL
- endif
- endif
-
- ifeq ($(USE_CODEC_VORBIS),1)
- CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
- endif
-
else # ifeq darwin
@@ -1261,6 +1296,12 @@ ifeq ($(ARCH),i386)
$(B)/ded/snapvectora.o \
$(B)/ded/matha.o
endif
+ifeq ($(ARCH),x86)
+ Q3DOBJ += \
+ $(B)/ded/ftola.o \
+ $(B)/ded/snapvectora.o \
+ $(B)/ded/matha.o
+endif
ifeq ($(HAVE_VM_COMPILED),true)
ifeq ($(ARCH),i386)
diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c
index d9e8393..1cbd714 100644
--- a/code/client/snd_openal.c
+++ b/code/client/snd_openal.c
@@ -1524,6 +1524,8 @@ static ALCcontext *alContext;
#ifdef _WIN32
#define ALDRIVER_DEFAULT "OpenAL32.dll"
+#elif defined(MACOS_X)
+#define ALDRIVER_DEFAULT "/System/Library/Frameworks/OpenAL.framework/OpenAL"
#else
#define ALDRIVER_DEFAULT "libopenal.so.0"
#endif
diff --git a/code/libs/macosx/libSDL-1.2.0.dylib b/code/libs/macosx/libSDL-1.2.0.dylib
index dce6184..3c51054 100755
--- a/code/libs/macosx/libSDL-1.2.0.dylib
+++ b/code/libs/macosx/libSDL-1.2.0.dylib
Binary files differ
diff --git a/code/qcommon/files.c b/code/qcommon/files.c
index af5518b..4227128 100644
--- a/code/qcommon/files.c
+++ b/code/qcommon/files.c
@@ -2829,6 +2829,10 @@ static void FS_Startup( const char *gameName ) {
if (fs_basepath->string[0]) {
FS_AddGameDirectory( fs_basepath->string, gameName );
}
+#ifdef MACOS_X
+ // allow .app bundles to be placed along side base dir
+ FS_AddGameDirectory( ".", gameName );
+#endif
// fs_homepath is somewhat particular to *nix systems, only add if relevant
// NOTE: same filtering below for mods and basegame
if (fs_basepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c
index 9634e9f..a24b4eb 100644
--- a/code/unix/sdl_glimp.c
+++ b/code/unix/sdl_glimp.c
@@ -67,7 +67,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#if USE_SDL_VIDEO
+#include "SDL.h"
+#include "SDL_loadso.h"
+#else
#include <dlfcn.h>
+#endif
#include "../renderer/tr_local.h"
#include "../client/client.h"
@@ -832,7 +837,7 @@ static void GLW_InitExtensions( void )
if ( strstr( glConfig.extensions_string, "GL_EXT_texture_filter_anisotropic" ) )
{
if ( r_ext_texture_filter_anisotropic->integer ) {
- qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy );
+ qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint *)&maxAnisotropy );
if ( maxAnisotropy <= 0 ) {
ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" );
maxAnisotropy = 0;
diff --git a/code/unix/unix_net.c b/code/unix/unix_net.c
index d84f985..73c0fd6 100644
--- a/code/unix/unix_net.c
+++ b/code/unix/unix_net.c
@@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/qcommon.h"
#include <unistd.h>
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+ // needed for socket_t on OSX 10.2
+ #define _BSD_SOCKLEN_T_
+#endif
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
diff --git a/make-macosx-ub.sh b/make-macosx-ub.sh
new file mode 100755
index 0000000..11e023d
--- /dev/null
+++ b/make-macosx-ub.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+DESTDIR=build/release-darwin-ub
+BASEDIR=baseq3
+MPACKDIR=missionpack
+
+BIN_OBJ="
+ build/release-darwin-ppc/ioquake3.ppc
+ build/release-darwin-x86/ioquake3.x86
+"
+BASE_OBJ="
+ build/release-darwin-ppc/$BASEDIR/cgameppc.dylib
+ build/release-darwin-x86/$BASEDIR/cgamex86.dylib
+ build/release-darwin-ppc/$BASEDIR/uippc.dylib
+ build/release-darwin-x86/$BASEDIR/uix86.dylib
+ build/release-darwin-ppc/$BASEDIR/qagameppc.dylib
+ build/release-darwin-x86/$BASEDIR/qagamex86.dylib
+"
+MPACK_OBJ="
+ build/release-darwin-ppc/$MPACKDIR/cgameppc.dylib
+ build/release-darwin-x86/$MPACKDIR/cgamex86.dylib
+ build/release-darwin-ppc/$MPACKDIR/uippc.dylib
+ build/release-darwin-x86/$MPACKDIR/uix86.dylib
+ build/release-darwin-ppc/$MPACKDIR/qagameppc.dylib
+ build/release-darwin-x86/$MPACKDIR/qagamex86.dylib
+"
+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
+
+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"
+ exit 1;
+fi
+
+(BUILD_MACOSX_UB=ppc make && BUILD_MACOSX_UB=x86 make) || exit 1;
+
+if [ ! -d $DESTDIR ]; then
+ mkdir $DESTDIR || exit 1;
+fi
+if [ ! -d $DESTDIR/$BASEDIR ]; then
+ mkdir $DESTDIR/$BASEDIR || exit 1;
+fi
+if [ ! -d $DESTDIR/$MPACKDIR ]; then
+ mkdir $DESTDIR/$MPACKDIR || exit 1;
+fi
+
+echo "Installing Universal Binaries in $DESTDIR"
+lipo -create -o $DESTDIR/ioquake3.ub $BIN_OBJ
+cp $BASE_OBJ $DESTDIR/$BASEDIR/
+cp $MPACK_OBJ $DESTDIR/$MPACKDIR/
+cp code/libs/macosx/*.dylib $DESTDIR/
+