Commit d3375d8a authored by Sam Lantinga's avatar Sam Lantinga

Mac OS X fat build works! :)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401655
parent 3f4bc2bb
...@@ -3,24 +3,28 @@ ...@@ -3,24 +3,28 @@
# Build a fat binary on Mac OS X, thanks Ryan! # Build a fat binary on Mac OS X, thanks Ryan!
# PowerPC compiler flags (10.2 runtime compatibility) # PowerPC compiler flags (10.2 runtime compatibility)
CFLAGS_PPC="-arch ppc \ CC_PPC="gcc-3.3"
CFLAGS_PPC="-arch ppc"
CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
-nostdinc \
-F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
-I/Developer/SDKs/MacOSX10.2.8.sdk/Developer/Headers/FlatCarbon \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \ -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++ \
-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++/ppc-darwin \
-isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include" -isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include"
# PowerPC linker flags # PowerPC linker flags
LFLAGS_PPC="-arch ppc -mmacosx-version-min=10.2 \ LFLAGS_PPC="-arch ppc \
-L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \ -L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
-F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk" -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
# Intel compiler flags (10.4 runtime compatibility) # Intel compiler flags (10.4 runtime compatibility)
CFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \ CC_X86="gcc-4.0"
-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" CFLAGS_X86="-arch i386 -mmacosx-version-min=10.4"
CPPFLAGS_X86="-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"
# Intel linker flags # Intel linker flags
LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \ LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
...@@ -30,7 +34,9 @@ LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \ ...@@ -30,7 +34,9 @@ LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
# #
# Find the configure script # Find the configure script
# #
cd `dirname $0`/.. srcdir=`dirname $0`/..
auxdir=$srcdir/build-scripts
cd $srcdir
# #
# Figure out which phase to build: # Figure out which phase to build:
...@@ -76,7 +82,42 @@ case $phase in ...@@ -76,7 +82,42 @@ case $phase in
merge="yes" merge="yes"
;; ;;
install) install)
make_x86="yes" install_bin="yes"
install_hdrs="yes"
install_lib="yes"
install_data="yes"
install_man="yes"
;;
install-bin)
install_bin="yes"
;;
install-hdrs)
install_hdrs="yes"
;;
install-lib)
install_lib="yes"
;;
install-data)
install_data="yes"
;;
install-man)
install_man="yes"
;;
*)
echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge]"
exit 1
;;
esac
case `uname -p` in
powerpc)
native_path=ppc
;;
*86)
native_path=x86
;;
*)
echo "Couldn't figure out native architecture path"
exit 1
;; ;;
esac esac
...@@ -96,7 +137,7 @@ done ...@@ -96,7 +137,7 @@ done
# #
if test x$configure_ppc = xyes; then if test x$configure_ppc = xyes; then
(cd build/ppc && \ (cd build/ppc && \
sh ../../configure CFLAGS="$CFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2 sh ../../configure --build=`uname -p`-apple-darwin --host=powerpc-apple-darwin CC="$CC_PPC" CFLAGS="$CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2
fi fi
if test x$make_ppc = xyes; then if test x$make_ppc = xyes; then
(cd build/ppc && make) || exit 3 (cd build/ppc && make) || exit 3
...@@ -107,7 +148,7 @@ fi ...@@ -107,7 +148,7 @@ fi
# #
if test x$configure_x86 = xyes; then if test x$configure_x86 = xyes; then
(cd build/x86 && \ (cd build/x86 && \
sh ../../configure CFLAGS="$CFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2 sh ../../configure --build=`uname -p`-apple-darwin --host=i686-apple-darwin CC="$CC_X86" CFLAGS="$CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2
fi fi
if test x$make_x86 = xyes; then if test x$make_x86 = xyes; then
(cd build/x86 && make) || exit 3 (cd build/x86 && make) || exit 3
...@@ -116,22 +157,79 @@ fi ...@@ -116,22 +157,79 @@ fi
# #
# Combine into fat binary # Combine into fat binary
# #
target=`find x86 -type f -name '*.dylib' | sed 's|.*/||'`
if test x$merge = xyes; then if test x$merge = xyes; then
(cd build && \ output=.libs
lipo -create -o $target `find ppc x86 -type f -name "*.dylib"` && sh $auxdir/mkinstalldirs build/$output
ln -s $target libSDL-1.2.0.dylib cd build
ln -s $target libSDL.dylib target=`find . -mindepth 3 -type f -name '*.dylib' | head -1 | sed 's|.*/||'`
lipo -create -o SDLMain.o */build/SDLMain.o && (lipo -create -o $output/$target `find . -mindepth 3 -type f -name "*.dylib"` &&
ar cru libSDLmain.a SDLMain.o && ranlib libSDLmain.a && ln -sf $target $output/libSDL-1.2.0.dylib &&
ln -sf $target $output/libSDL.dylib &&
lipo -create -o $output/libSDL.a */build/.libs/libSDL.a &&
cp $native_path/build/.libs/libSDL.la $output &&
cp $native_path/build/.libs/libSDL.lai $output &&
cp $native_path/build/libSDL.la . &&
lipo -create -o libSDLmain.a */build/libSDLmain.a &&
echo "Build complete!" && echo "Build complete!" &&
echo "Files can be found in the build directory.") || exit 4 echo "Files can be found in the build directory.") || exit 4
cd ..
fi fi
# #
# Install # Install
# #
if test x$install = xyes; then do_install()
echo "Install not implemented" {
exit 1 echo $*
$* || exit 5
}
if test x$prefix = x; then
prefix=/usr/local
fi
if test x$exec_prefix = x; then
exec_prefix=$prefix
fi
if test x$bindir = x; then
bindir=$exec_prefix/bin
fi
if test x$libdir = x; then
libdir=$exec_prefix/lib
fi
if test x$includedir = x; then
includedir=$prefix/include
fi
if test x$datadir = x; then
datadir=$prefix/share
fi
if test x$mandir = x; then
mandir=$prefix/man
fi
if test x$install_bin = xyes; then
do_install sh $auxdir/mkinstalldirs $bindir
do_install /usr/bin/install -c -m 755 build/$native_path/sdl-config $bindir/sdl-config
fi
if test x$install_hdrs = xyes; then
do_install sh $auxdir/mkinstalldirs $includedir/SDL
for src in $srcdir/include/*.h; do \
file=`echo $src | sed -e 's|^.*/||'`; \
do_install /usr/bin/install -c -m 644 $src $includedir/SDL/$file; \
done
do_install /usr/bin/install -c -m 644 $srcdir/include/SDL_config_macosx.h $includedir/SDL/SDL_config.h
fi
if test x$install_lib = xyes; then
do_install sh $auxdir/mkinstalldirs $libdir
do_install sh build/$native_path/libtool --mode=install /usr/bin/install -c build/libSDL.la $libdir/libSDL.la
do_install /usr/bin/install -c -m 644 build/libSDLmain.a $libdir/libSDLmain.a
do_install ranlib $libdir/libSDLmain.a
fi
if test x$install_data = xyes; then
do_install sh $auxdir/mkinstalldirs $datadir/aclocal
do_install /usr/bin/install -c -m 644 $srcdir/sdl.m4 $datadir/aclocal/sdl.m4
fi
if test x$install_man = xyes; then
do_install sh $auxdir/mkinstalldirs $mandir/man3
for src in $srcdir/docs/man3/*.3; do \
file=`echo $src | sed -e 's|^.*/||'`; \
do_install /usr/bin/install -c -m 644 $src $mandir/man3/$file; \
done
fi fi
...@@ -65,7 +65,7 @@ case "$host" in ...@@ -65,7 +65,7 @@ case "$host" in
BASE_LDFLAGS="" BASE_LDFLAGS=""
;; ;;
esac esac
BUILD_CFLAGS="$CFLAGS" BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS" EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
BUILD_LDFLAGS="$LDFLAGS" BUILD_LDFLAGS="$LDFLAGS"
EXTRA_LDFLAGS="$BASE_LDFLAGS" EXTRA_LDFLAGS="$BASE_LDFLAGS"
...@@ -2336,6 +2336,15 @@ case "$host" in ...@@ -2336,6 +2336,15 @@ case "$host" in
CheckDiskAudio CheckDiskAudio
CheckDummyAudio CheckDummyAudio
CheckDLOPEN CheckDLOPEN
# Set up files for the shared object loading library
# (this needs to be done before the dynamic X11 check)
if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
AC_DEFINE(SDL_LOADSO_DLCOMPAT)
SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
have_loadso=yes
fi
CheckCOCOA CheckCOCOA
CheckCARBON CheckCARBON
CheckX11 CheckX11
...@@ -2374,12 +2383,6 @@ case "$host" in ...@@ -2374,12 +2383,6 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
have_timers=yes have_timers=yes
fi fi
# Set up files for the shared object loading library
if test x$enable_loadso = xyes -a x$have_dlopen != xyes; then
AC_DEFINE(SDL_LOADSO_DLCOMPAT)
SOURCES="$SOURCES $srcdir/src/loadso/macosx/*.c"
have_loadso=yes
fi
# The Mac OS X platform requires special setup. # The Mac OS X platform requires special setup.
SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m" SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
......
...@@ -109,7 +109,7 @@ static int SDL_OSX_dladdr(const void * dl_restrict, SDL_OSX_Dl_info * dl_restric ...@@ -109,7 +109,7 @@ static int SDL_OSX_dladdr(const void * dl_restrict, SDL_OSX_Dl_info * dl_restric
#endif /* ! _POSIX_SOURCE */ #endif /* ! _POSIX_SOURCE */
static int SDL_OSX_dlclose(void * handle); static int SDL_OSX_dlclose(void * handle);
static char * SDL_OSX_dlerror(void); static const char * SDL_OSX_dlerror(void);
static void * SDL_OSX_dlopen(const char *path, int mode); static void * SDL_OSX_dlopen(const char *path, int mode);
static void * SDL_OSX_dlsym(void * dl_restrict handle, const char * dl_restrict symbol); static void * SDL_OSX_dlsym(void * dl_restrict handle, const char * dl_restrict symbol);
...@@ -249,7 +249,7 @@ static void dlerrorfree(void *data); ...@@ -249,7 +249,7 @@ static void dlerrorfree(void *data);
static void resetdlerror(void); static void resetdlerror(void);
static const struct mach_header *my_find_image(const char *name); static const struct mach_header *my_find_image(const char *name);
static const struct mach_header *image_for_address(const void *address); static const struct mach_header *image_for_address(const void *address);
static inline const char *dyld_error_str(void); static inline char *dyld_error_str(void);
#if FINK_BUILD #if FINK_BUILD
/* Two Global Functions */ /* Two Global Functions */
...@@ -623,7 +623,7 @@ static NSSymbol *search_linked_libs(const struct mach_header * mh, const char *s ...@@ -623,7 +623,7 @@ static NSSymbol *search_linked_libs(const struct mach_header * mh, const char *s
} }
/* Up to the caller to SDL_free() returned string */ /* Up to the caller to SDL_free() returned string */
static inline const char *dyld_error_str() static inline char *dyld_error_str()
{ {
NSLinkEditErrors dylder; NSLinkEditErrors dylder;
int dylderno; int dylderno;
...@@ -647,7 +647,7 @@ static void *dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetErr ...@@ -647,7 +647,7 @@ static void *dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetErr
void *caller = NULL; void *caller = NULL;
#endif #endif
const struct mach_header *caller_mh = 0; const struct mach_header *caller_mh = 0;
char* savedErrorStr = NULL; char *savedErrorStr = NULL;
resetdlerror(); resetdlerror();
#ifndef RTLD_SELF #ifndef RTLD_SELF
#define RTLD_SELF ((void *) -3) #define RTLD_SELF ((void *) -3)
...@@ -1168,7 +1168,7 @@ static int SDL_OSX_dlclose(void *handle) ...@@ -1168,7 +1168,7 @@ static int SDL_OSX_dlclose(void *handle)
return 1; return 1;
} }
static char *SDL_OSX_dlerror(void) static const char *SDL_OSX_dlerror(void)
{ {
struct dlthread *tss; struct dlthread *tss;
const char * err_str = NULL; const char * err_str = NULL;
...@@ -1378,7 +1378,7 @@ static dlfunc_t SDL_OSX_dlfunc(void * dl_restrict handle, const char * dl_restri ...@@ -1378,7 +1378,7 @@ static dlfunc_t SDL_OSX_dlfunc(void * dl_restrict handle, const char * dl_restri
void *SDL_LoadObject(const char *sofile) void *SDL_LoadObject(const char *sofile)
{ {
void *handle = SDL_OSX_dlopen(sofile, RTLD_NOW); void *handle = SDL_OSX_dlopen(sofile, RTLD_NOW);
const char *loaderror = (char *)SDL_OSX_dlerror(); const char *loaderror = SDL_OSX_dlerror();
if ( handle == NULL ) { if ( handle == NULL ) {
SDL_SetError("Failed loading %s: %s", sofile, loaderror); SDL_SetError("Failed loading %s: %s", sofile, loaderror);
} }
...@@ -1389,7 +1389,7 @@ void *SDL_LoadFunction(void *handle, const char *name) ...@@ -1389,7 +1389,7 @@ void *SDL_LoadFunction(void *handle, const char *name)
{ {
void *symbol = SDL_OSX_dlsym(handle, name); void *symbol = SDL_OSX_dlsym(handle, name);
if ( symbol == NULL ) { if ( symbol == NULL ) {
SDL_SetError("Failed loading %s: %s", name, (const char *)SDL_OSX_dlerror()); SDL_SetError("Failed loading %s: %s", name, SDL_OSX_dlerror());
} }
return(symbol); return(symbol);
} }
......
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h> #include <QuickTime/QuickTime.h>
#include <IOKit/IOKitLib.h> /* For powersave handling */ #include <OpenGL/CGLTypes.h> /* For CGLContextObj */
#include <IOKit/IOKitLib.h> /* For powersave handling */
#include <pthread.h> #include <pthread.h>
#include "SDL_thread.h" #include "SDL_thread.h"
......
...@@ -47,31 +47,31 @@ static void QZ_UnlockYUV (_THIS, SDL_Overlay *overlay) { ...@@ -47,31 +47,31 @@ static void QZ_UnlockYUV (_THIS, SDL_Overlay *overlay) {
; ;
} }
static int QZ_DisplayYUV (_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect) { static int QZ_DisplayYUV (_THIS, SDL_Overlay *overlay, SDL_Rect *src, SDL_Rect *dst) {
OSErr err; OSErr err;
CodecFlags flags; CodecFlags flags;
if (dstrect->x != 0 || dstrect->y != 0) { if (dst->x != 0 || dst->y != 0) {
SDL_SetError ("Need a dstrect at (0,0)"); SDL_SetError ("Need a dst at (0,0)");
return -1; return -1;
} }
if (dstrect->w != yuv_width || dstrect->h != yuv_height) { if (dst->w != yuv_width || dst->h != yuv_height) {
Fixed scale_x, scale_y; Fixed scale_x, scale_y;
scale_x = FixDiv ( Long2Fix (dstrect->w), Long2Fix (overlay->w) ); scale_x = FixDiv ( Long2Fix (dst->w), Long2Fix (overlay->w) );
scale_y = FixDiv ( Long2Fix (dstrect->h), Long2Fix (overlay->h) ); scale_y = FixDiv ( Long2Fix (dst->h), Long2Fix (overlay->h) );
SetIdentityMatrix (yuv_matrix); SetIdentityMatrix (yuv_matrix);
ScaleMatrix (yuv_matrix, scale_x, scale_y, Long2Fix (0), Long2Fix (0)); ScaleMatrix (yuv_matrix, scale_x, scale_y, Long2Fix (0), Long2Fix (0));
SetDSequenceMatrix (yuv_seq, yuv_matrix); SetDSequenceMatrix (yuv_seq, yuv_matrix);
yuv_width = dstrect->w; yuv_width = dst->w;
yuv_height = dstrect->h; yuv_height = dst->h;
} }
if( ( err = DecompressSequenceFrameS( if( ( err = DecompressSequenceFrameS(
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
#include <dlfcn.h>
#include "SDL_name.h" #include "SDL_name.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment