gcc-fat.sh
author Sam Lantinga <slouken@libsdl.org>
Mon, 12 Nov 2018 16:54:24 -0800
changeset 925 5945988b4a41
parent 623 5a86e7d5107f
permissions -rwxr-xr-x
Fixed bug 4371 - tvOS Simulator devices not listed

Caleb Cornett

In the Xcode-iOS project, when selecting the libSDL_mixer-tvOS target, no tvOS simulators appear in the available device dropdown.

This is easily fixed with the attached patch.
     1 #!/bin/sh
     2 #
     3 # Build Universal binaries on Mac OS X, thanks Ryan!
     4 #
     5 # Usage: ./configure CC="sh gcc-fat.sh" && make && rm -rf x86 x64
     6 
     7 DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
     8 
     9 # Intel 32-bit compiler flags (10.6 runtime compatibility)
    10 GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \
    11 -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
    12 -I/usr/local/include"
    13 
    14 GCC_LINK_X86="-mmacosx-version-min=10.6"
    15 
    16 # Intel 64-bit compiler flags (10.6 runtime compatibility)
    17 GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
    18 -DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
    19 -I/usr/local/include"
    20 
    21 GCC_LINK_X64="-mmacosx-version-min=10.6"
    22 
    23 # Output both PowerPC and Intel object files
    24 args="$*"
    25 compile=yes
    26 link=yes
    27 while test x$1 != x; do
    28     case $1 in
    29         --version) exec gcc $1;;
    30         -v) exec gcc $1;;
    31         -V) exec gcc $1;;
    32         -print-prog-name=*) exec gcc $1;;
    33         -print-search-dirs) exec gcc $1;;
    34         -E) GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
    35             GCC_COMPILE_X64="$GCC_COMPILE_X64 -E"
    36             compile=no; link=no;;
    37         -c) link=no;;
    38         -o) output=$2;;
    39         *.c|*.cc|*.cpp|*.S) source=$1;;
    40     esac
    41     shift
    42 done
    43 if test x$link = xyes; then
    44     GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
    45     GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_LINK_X64"
    46 fi
    47 if test x"$output" = x; then
    48     if test x$link = xyes; then
    49         output=a.out
    50     elif test x$compile = xyes; then
    51         output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
    52     fi
    53 fi
    54 
    55 # Compile X86 32-bit
    56 if test x"$output" != x; then
    57     dir=x86/`dirname $output`
    58     if test -d $dir; then
    59         :
    60     else
    61         mkdir -p $dir
    62     fi
    63 fi
    64 set -- $args
    65 while test x$1 != x; do
    66     if test -f "x86/$1" && test "$1" != "$output"; then
    67         x86_args="$x86_args x86/$1"
    68     else
    69         x86_args="$x86_args $1"
    70     fi
    71     shift
    72 done
    73 $GCC_COMPILE_X86 $x86_args || exit $?
    74 if test x"$output" != x; then
    75     cp $output x86/$output
    76 fi
    77 
    78 # Compile X86 32-bit
    79 if test x"$output" != x; then
    80     dir=x64/`dirname $output`
    81     if test -d $dir; then
    82         :
    83     else
    84         mkdir -p $dir
    85     fi
    86 fi
    87 set -- $args
    88 while test x$1 != x; do
    89     if test -f "x64/$1" && test "$1" != "$output"; then
    90         x64_args="$x64_args x64/$1"
    91     else
    92         x64_args="$x64_args $1"
    93     fi
    94     shift
    95 done
    96 $GCC_COMPILE_X64 $x64_args || exit $?
    97 if test x"$output" != x; then
    98     cp $output x64/$output
    99 fi
   100 
   101 if test x"$output" != x; then
   102     lipo -create -o $output x86/$output x64/$output
   103 fi