1.1 --- a/gcc-fat.sh Sat Sep 19 14:31:34 2009 +0000
1.2 +++ b/gcc-fat.sh Sun Sep 20 03:57:46 2009 +0000
1.3 @@ -2,33 +2,56 @@
1.4 #
1.5 # Build Universal binaries on Mac OS X, thanks Ryan!
1.6 #
1.7 -# Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf ppc x86
1.8 +# Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf ppc ppc64 x86 x64
1.9
1.10 -# PowerPC compiler flags (10.2 runtime compatibility)
1.11 -GCC_COMPILE_PPC="gcc-3.3 -arch ppc \
1.12 --DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
1.13 +# PowerPC 32-bit compiler flags (10.4 runtime compatibility)
1.14 +GCC_COMPILE_PPC32="gcc-4.0 -arch ppc -mmacosx-version-min=10.4 \
1.15 +-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
1.16 -nostdinc \
1.17 --F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
1.18 --I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
1.19 --isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include"
1.20 +-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
1.21 +-I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/include \
1.22 +-isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"
1.23 +
1.24 +GCC_LINK_PPC32="\
1.25 +-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1 \
1.26 +-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
1.27
1.28 -GCC_LINK_PPC="\
1.29 --L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
1.30 --F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
1.31 --Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
1.32 +# PowerPC 64-bit compiler flags (10.5 runtime compatibility)
1.33 +GCC_COMPILE_PPC64="gcc-4.0 -arch ppc64 -mmacosx-version-min=10.5 \
1.34 +-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
1.35 +-nostdinc \
1.36 +-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
1.37 +-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/include \
1.38 +-isystem /Developer/SDKs/MacOSX10.5.sdk/usr/include"
1.39
1.40 -# Intel compiler flags (10.4 runtime compatibility)
1.41 +GCC_LINK_PPC64="\
1.42 +-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/ppc64 \
1.43 +-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"
1.44 +
1.45 +# Intel 32-bit compiler flags (10.4 runtime compatibility)
1.46 GCC_COMPILE_X86="gcc-4.0 -arch i386 -mmacosx-version-min=10.4 \
1.47 -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
1.48 -nostdinc \
1.49 -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
1.50 --I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \
1.51 +-I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/include \
1.52 -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"
1.53
1.54 GCC_LINK_X86="\
1.55 --L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1 \
1.56 +-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1 \
1.57 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
1.58
1.59 +# Intel 64-bit compiler flags (10.5 runtime compatibility)
1.60 +GCC_COMPILE_X64="gcc-4.0 -arch x86_64 -mmacosx-version-min=10.5 \
1.61 +-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
1.62 +-nostdinc \
1.63 +-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
1.64 +-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/include \
1.65 +-isystem /Developer/SDKs/MacOSX10.5.sdk/usr/include"
1.66 +
1.67 +GCC_LINK_X64="\
1.68 +-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/x86_64 \
1.69 +-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"
1.70 +
1.71 # Output both PowerPC and Intel object files
1.72 args="$*"
1.73 compile=yes
1.74 @@ -41,7 +64,9 @@
1.75 -print-prog-name=*) exec gcc $1;;
1.76 -print-search-dirs) exec gcc $1;;
1.77 -E) GCC_COMPILE_PPC="$GCC_COMPILE_PPC -E"
1.78 + GCC_COMPILE_PPC64="$GCC_COMPILE_PPC64 -E"
1.79 GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
1.80 + GCC_COMPILE_X64="$GCC_COMPILE_X64 -E"
1.81 compile=no; link=no;;
1.82 -c) link=no;;
1.83 -o) output=$2;;
1.84 @@ -50,8 +75,10 @@
1.85 shift
1.86 done
1.87 if test x$link = xyes; then
1.88 - GCC_COMPILE_PPC="$GCC_COMPILE_PPC $GCC_LINK_PPC"
1.89 + GCC_COMPILE_PPC32="$GCC_COMPILE_PPC32 $GCC_LINK_PPC32"
1.90 + GCC_COMPILE_PPC64="$GCC_COMPILE_PPC64 $GCC_LINK_PPC64"
1.91 GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
1.92 + GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_LINK_X64"
1.93 fi
1.94 if test x"$output" = x; then
1.95 if test x$link = xyes; then
1.96 @@ -61,6 +88,7 @@
1.97 fi
1.98 fi
1.99
1.100 +# Compile PPC 32-bit
1.101 if test x"$output" != x; then
1.102 dir=ppc/`dirname $output`
1.103 if test -d $dir; then
1.104 @@ -78,11 +106,35 @@
1.105 fi
1.106 shift
1.107 done
1.108 -$GCC_COMPILE_PPC $ppc_args || exit $?
1.109 +$GCC_COMPILE_PPC32 $ppc_args || exit $?
1.110 if test x"$output" != x; then
1.111 cp $output ppc/$output
1.112 fi
1.113
1.114 +# Compile PPC 64-bit
1.115 +if test x"$output" != x; then
1.116 + dir=ppc64/`dirname $output`
1.117 + if test -d $dir; then
1.118 + :
1.119 + else
1.120 + mkdir -p $dir
1.121 + fi
1.122 +fi
1.123 +set -- $args
1.124 +while test x$1 != x; do
1.125 + if test -f "ppc64/$1" && test "$1" != "$output"; then
1.126 + ppc64_args="$ppc64_args ppc64/$1"
1.127 + else
1.128 + ppc64_args="$ppc64_args $1"
1.129 + fi
1.130 + shift
1.131 +done
1.132 +$GCC_COMPILE_PPC64 $ppc64_args || exit $?
1.133 +if test x"$output" != x; then
1.134 + cp $output ppc64/$output
1.135 +fi
1.136 +
1.137 +# Compile X86 32-bit
1.138 if test x"$output" != x; then
1.139 dir=x86/`dirname $output`
1.140 if test -d $dir; then
1.141 @@ -105,6 +157,29 @@
1.142 cp $output x86/$output
1.143 fi
1.144
1.145 +# Compile X86 32-bit
1.146 if test x"$output" != x; then
1.147 - lipo -create -o $output ppc/$output x86/$output
1.148 + dir=x64/`dirname $output`
1.149 + if test -d $dir; then
1.150 + :
1.151 + else
1.152 + mkdir -p $dir
1.153 + fi
1.154 fi
1.155 +set -- $args
1.156 +while test x$1 != x; do
1.157 + if test -f "x64/$1" && test "$1" != "$output"; then
1.158 + x64_args="$x64_args x64/$1"
1.159 + else
1.160 + x64_args="$x64_args $1"
1.161 + fi
1.162 + shift
1.163 +done
1.164 +$GCC_COMPILE_X64 $x64_args || exit $?
1.165 +if test x"$output" != x; then
1.166 + cp $output x64/$output
1.167 +fi
1.168 +
1.169 +if test x"$output" != x; then
1.170 + lipo -create -o $output ppc/$output ppc64/$output x86/$output x64/$output
1.171 +fi