Backport gcc-fat.sh and g++-fat.sh to the 1.2 branch to help buildbot.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/build-scripts/g++-fat.sh Mon Jun 23 11:29:53 2014 -0400
1.3 @@ -0,0 +1,101 @@
1.4 +#!/bin/sh
1.5 +#
1.6 +# Build Universal binaries on Mac OS X, thanks Ryan!
1.7 +#
1.8 +# Usage: ./configure CXX="sh g++-fat.sh" && make && rm -rf x86 x64
1.9 +
1.10 +DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
1.11 +
1.12 +# Intel 32-bit compiler flags (10.6 runtime compatibility)
1.13 +GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.5 \
1.14 +-I/usr/local/include"
1.15 +
1.16 +GCC_LINK_X86="-mmacosx-version-min=10.5"
1.17 +
1.18 +# Intel 64-bit compiler flags (10.6 runtime compatibility)
1.19 +GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
1.20 +-I/usr/local/include"
1.21 +
1.22 +GCC_LINK_X64="-mmacosx-version-min=10.6"
1.23 +
1.24 +# Output both PowerPC and Intel object files
1.25 +args="$*"
1.26 +compile=yes
1.27 +link=yes
1.28 +while test x$1 != x; do
1.29 + case $1 in
1.30 + --version) exec g++ $1;;
1.31 + -v) exec g++ $1;;
1.32 + -V) exec g++ $1;;
1.33 + -print-prog-name=*) exec g++ $1;;
1.34 + -print-search-dirs) exec g++ $1;;
1.35 + -E) GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
1.36 + GCC_COMPILE_X64="$GCC_COMPILE_X64 -E"
1.37 + compile=no; link=no;;
1.38 + -c) link=no;;
1.39 + -o) output=$2;;
1.40 + *.c|*.cc|*.cpp|*.S) source=$1;;
1.41 + esac
1.42 + shift
1.43 +done
1.44 +if test x$link = xyes; then
1.45 + GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
1.46 + GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_LINK_X64"
1.47 +fi
1.48 +if test x"$output" = x; then
1.49 + if test x$link = xyes; then
1.50 + output=a.out
1.51 + elif test x$compile = xyes; then
1.52 + output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
1.53 + fi
1.54 +fi
1.55 +
1.56 +# Compile X86 32-bit
1.57 +if test x"$output" != x; then
1.58 + dir=x86/`dirname $output`
1.59 + if test -d $dir; then
1.60 + :
1.61 + else
1.62 + mkdir -p $dir
1.63 + fi
1.64 +fi
1.65 +set -- $args
1.66 +while test x$1 != x; do
1.67 + if test -f "x86/$1" && test "$1" != "$output"; then
1.68 + x86_args="$x86_args x86/$1"
1.69 + else
1.70 + x86_args="$x86_args $1"
1.71 + fi
1.72 + shift
1.73 +done
1.74 +$GCC_COMPILE_X86 $x86_args || exit $?
1.75 +if test x"$output" != x; then
1.76 + cp $output x86/$output
1.77 +fi
1.78 +
1.79 +# Compile X86 32-bit
1.80 +if test x"$output" != x; then
1.81 + dir=x64/`dirname $output`
1.82 + if test -d $dir; then
1.83 + :
1.84 + else
1.85 + mkdir -p $dir
1.86 + fi
1.87 +fi
1.88 +set -- $args
1.89 +while test x$1 != x; do
1.90 + if test -f "x64/$1" && test "$1" != "$output"; then
1.91 + x64_args="$x64_args x64/$1"
1.92 + else
1.93 + x64_args="$x64_args $1"
1.94 + fi
1.95 + shift
1.96 +done
1.97 +$GCC_COMPILE_X64 $x64_args || exit $?
1.98 +if test x"$output" != x; then
1.99 + cp $output x64/$output
1.100 +fi
1.101 +
1.102 +if test x"$output" != x; then
1.103 + lipo -create -o $output x86/$output x64/$output
1.104 +fi
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/build-scripts/gcc-fat.sh Mon Jun 23 11:29:53 2014 -0400
2.3 @@ -0,0 +1,102 @@
2.4 +#!/bin/sh
2.5 +#
2.6 +# Build Universal binaries on Mac OS X, thanks Ryan!
2.7 +#
2.8 +# Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf x86 x64
2.9 +
2.10 +DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
2.11 +
2.12 +# Intel 32-bit compiler flags (10.5 runtime compatibility)
2.13 +GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.5 \
2.14 +-I/usr/local/include"
2.15 +
2.16 +GCC_LINK_X86="-mmacosx-version-min=10.5"
2.17 +
2.18 +# Intel 64-bit compiler flags (10.6 runtime compatibility)
2.19 +GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
2.20 +-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
2.21 +-I/usr/local/include"
2.22 +
2.23 +GCC_LINK_X64="-mmacosx-version-min=10.6"
2.24 +
2.25 +# Output both PowerPC and Intel object files
2.26 +args="$*"
2.27 +compile=yes
2.28 +link=yes
2.29 +while test x$1 != x; do
2.30 + case $1 in
2.31 + --version) exec gcc $1;;
2.32 + -v) exec gcc $1;;
2.33 + -V) exec gcc $1;;
2.34 + -print-prog-name=*) exec gcc $1;;
2.35 + -print-search-dirs) exec gcc $1;;
2.36 + -E) GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
2.37 + GCC_COMPILE_X64="$GCC_COMPILE_X64 -E"
2.38 + compile=no; link=no;;
2.39 + -c) link=no;;
2.40 + -o) output=$2;;
2.41 + *.c|*.cc|*.cpp|*.S) source=$1;;
2.42 + esac
2.43 + shift
2.44 +done
2.45 +if test x$link = xyes; then
2.46 + GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
2.47 + GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_LINK_X64"
2.48 +fi
2.49 +if test x"$output" = x; then
2.50 + if test x$link = xyes; then
2.51 + output=a.out
2.52 + elif test x$compile = xyes; then
2.53 + output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
2.54 + fi
2.55 +fi
2.56 +
2.57 +# Compile X86 32-bit
2.58 +if test x"$output" != x; then
2.59 + dir=x86/`dirname $output`
2.60 + if test -d $dir; then
2.61 + :
2.62 + else
2.63 + mkdir -p $dir
2.64 + fi
2.65 +fi
2.66 +set -- $args
2.67 +while test x$1 != x; do
2.68 + if test -f "x86/$1" && test "$1" != "$output"; then
2.69 + x86_args="$x86_args x86/$1"
2.70 + else
2.71 + x86_args="$x86_args $1"
2.72 + fi
2.73 + shift
2.74 +done
2.75 +$GCC_COMPILE_X86 $x86_args || exit $?
2.76 +if test x"$output" != x; then
2.77 + cp $output x86/$output
2.78 +fi
2.79 +
2.80 +# Compile X86 32-bit
2.81 +if test x"$output" != x; then
2.82 + dir=x64/`dirname $output`
2.83 + if test -d $dir; then
2.84 + :
2.85 + else
2.86 + mkdir -p $dir
2.87 + fi
2.88 +fi
2.89 +set -- $args
2.90 +while test x$1 != x; do
2.91 + if test -f "x64/$1" && test "$1" != "$output"; then
2.92 + x64_args="$x64_args x64/$1"
2.93 + else
2.94 + x64_args="$x64_args $1"
2.95 + fi
2.96 + shift
2.97 +done
2.98 +$GCC_COMPILE_X64 $x64_args || exit $?
2.99 +if test x"$output" != x; then
2.100 + cp $output x64/$output
2.101 +fi
2.102 +
2.103 +if test x"$output" != x; then
2.104 + lipo -create -o $output x86/$output x64/$output
2.105 +fi