annotate 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
rev   line source
1797
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 #!/bin/sh
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 #
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 # Build Universal binaries on Mac OS X, thanks Ryan!
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 #
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 # Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf ppc x86
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 # PowerPC compiler flags (10.2 runtime compatibility)
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 GCC_COMPILE_PPC="gcc-3.3 -arch ppc \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 -nostdinc \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 -isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 GCC_LINK_PPC="\
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 -L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 # Intel compiler flags (10.4 runtime compatibility)
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 GCC_COMPILE_X86="gcc-4.0 -arch i386 -mmacosx-version-min=10.4 \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 -nostdinc \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 -I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 GCC_LINK_X86="\
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 # Output both PowerPC and Intel object files
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 args="$*"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 compile=yes
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 link=yes
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 while test x$1 != x; do
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 case $1 in
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 --version) exec gcc $1;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 -v) exec gcc $1;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 -V) exec gcc $1;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 -print-prog-name=*) exec gcc $1;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 -print-search-dirs) exec gcc $1;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 -E) GCC_COMPILE_PPC="$GCC_COMPILE_PPC -E"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 compile=no; link=no;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 -c) link=no;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 -o) output=$2;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 *.c|*.cc|*.cpp|*.S) source=$1;;
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 esac
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 shift
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 done
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 if test x$link = xyes; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 GCC_COMPILE_PPC="$GCC_COMPILE_PPC $GCC_LINK_PPC"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 if test x"$output" = x; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 if test x$link = xyes; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 output=a.out
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 elif test x$compile = xyes; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 if test x"$output" != x; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 dir=ppc/`dirname $output`
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 if test -d $dir; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 :
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 else
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 mkdir -p $dir
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 set -- $args
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 while test x$1 != x; do
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 if test -f "ppc/$1" && test "$1" != "$output"; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 ppc_args="$ppc_args ppc/$1"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 else
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 ppc_args="$ppc_args $1"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 shift
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 done
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 $GCC_COMPILE_PPC $ppc_args || exit $?
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 if test x"$output" != x; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 cp $output ppc/$output
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 if test x"$output" != x; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 dir=x86/`dirname $output`
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 if test -d $dir; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 :
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 else
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 mkdir -p $dir
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 set -- $args
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 while test x$1 != x; do
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 if test -f "x86/$1" && test "$1" != "$output"; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 x86_args="$x86_args x86/$1"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 else
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 x86_args="$x86_args $1"
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 shift
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 done
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 $GCC_COMPILE_X86 $x86_args || exit $?
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 if test x"$output" != x; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 cp $output x86/$output
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 fi
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 if test x"$output" != x; then
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 lipo -create -o $output ppc/$output x86/$output
783b9409baa0 Fat test programs! :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 fi