Mercurial > sdl-ios-xcode
view test/gcc-fat.sh @ 4426:1bceff8f008f
Fixed bug #943
Ozkan Sezer 2010-02-06 12:31:06 PST
Hi:
Here are some small fixes for compiling SDL against mingw-w64.
(see http://mingw-w64.sourceforge.net/ . Despite the name, it
supports both win32 and win64.)
src/audio/windx5/directx.h and src/video/windx5/directx.h (both
SDL-1.2 and SDL-1.3.) I get compilation errors about some union
not having a member named u1 and alike, because of other system
headers being included before this one and them already defining
DUMMYUNIONNAME and stuff. This header probably assumes that those
stuff are defined in windef.h, but mingw-w64 headers define them
in _mingw.h. Easily fixed by moving NONAMELESSUNION definition to
the top of the file.
src/thread/win32/SDL_systhread.c (both SDL-1.2 and SDL-1.3.) :
The __GNUC__ case for pfnSDL_CurrentBeginThread is 32-bit centric
because _beginthreadex returns uintptr_t, not unsigned long which
is 32 bits in win64. Changing the return type to uintptr_t fixes
it.
video/SDL_blit.h (and configure.in) (SDL-1.3-only) : MinGW-w64
uses msvcrt version of _aligned_malloc and _aligned_free and
they are defined in intrin.h (similar to VC). Adding proper
ifdefs fixes it. (Notes about macros to check: __MINGW32__ is
defined for both mingw.org and for mingw-w64 for both win32 and
win64, __MINGW64__ is only defined for _WIN64, so __MINGW64__
can't be used to detect mingw-w64: including _mingw.h and then
checking for __MINGW64_VERSION_MAJOR does the trick.)
SDL_win32video.h (SDL-1.3-only) : Tweaked the VINWER definition
and location in order to avoid multiple redefinition warnings.
Hope these are useful. Thanks.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 10 Mar 2010 15:02:58 +0000 |
parents | 783b9409baa0 |
children | 6cb18cf1777e |
line wrap: on
line source
#!/bin/sh # # Build Universal binaries on Mac OS X, thanks Ryan! # # Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf ppc x86 # PowerPC compiler flags (10.2 runtime compatibility) GCC_COMPILE_PPC="gcc-3.3 -arch ppc \ -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" GCC_LINK_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" # Intel compiler flags (10.4 runtime compatibility) GCC_COMPILE_X86="gcc-4.0 -arch i386 -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" GCC_LINK_X86="\ -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \ -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" # Output both PowerPC and Intel object files args="$*" compile=yes link=yes while test x$1 != x; do case $1 in --version) exec gcc $1;; -v) exec gcc $1;; -V) exec gcc $1;; -print-prog-name=*) exec gcc $1;; -print-search-dirs) exec gcc $1;; -E) GCC_COMPILE_PPC="$GCC_COMPILE_PPC -E" GCC_COMPILE_X86="$GCC_COMPILE_X86 -E" compile=no; link=no;; -c) link=no;; -o) output=$2;; *.c|*.cc|*.cpp|*.S) source=$1;; esac shift done if test x$link = xyes; then GCC_COMPILE_PPC="$GCC_COMPILE_PPC $GCC_LINK_PPC" GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86" fi if test x"$output" = x; then if test x$link = xyes; then output=a.out elif test x$compile = xyes; then output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o fi fi if test x"$output" != x; then dir=ppc/`dirname $output` if test -d $dir; then : else mkdir -p $dir fi fi set -- $args while test x$1 != x; do if test -f "ppc/$1" && test "$1" != "$output"; then ppc_args="$ppc_args ppc/$1" else ppc_args="$ppc_args $1" fi shift done $GCC_COMPILE_PPC $ppc_args || exit $? if test x"$output" != x; then cp $output ppc/$output fi if test x"$output" != x; then dir=x86/`dirname $output` if test -d $dir; then : else mkdir -p $dir fi fi set -- $args while test x$1 != x; do if test -f "x86/$1" && test "$1" != "$output"; then x86_args="$x86_args x86/$1" else x86_args="$x86_args $1" fi shift done $GCC_COMPILE_X86 $x86_args || exit $? if test x"$output" != x; then cp $output x86/$output fi if test x"$output" != x; then lipo -create -o $output ppc/$output x86/$output fi