build-scripts/iosbuild.sh
author Ryan C. Gordon <icculus@icculus.org>
Fri, 12 Aug 2016 19:59:00 -0400
changeset 10266 c09f06c4e8c8
parent 6334 85b8778a05c2
permissions -rwxr-xr-x
emscripten: send fake mouse events for touches, like other targets do. (This really should be handled at the higher level and not in the individual targets, but this fixes the immediate bug.)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6333
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     2
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     3
# Build a fat binary for iOS
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     4
# Based on fatbuild.sh and code from the Ignifuga Game Engine
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     5
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     6
# Number of CPUs (for make -j)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     7
NCPU=`sysctl -n hw.ncpu`
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     8
if test x$NJOB = x; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
     9
    NJOB=$NCPU
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    10
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    11
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    12
# SDK path
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    13
XCODE_PATH=`xcode-select --print-path`
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    14
if [ -z "$XCODE_PATH" ]; then
6334
85b8778a05c2 small improvements in the iosbuild.sh script
Gabriel Jacobo <gabomdq@gmail.com>
parents: 6333
diff changeset
    15
    echo "Could not find XCode location (use xcode-select -switch to set the correct path)"
6333
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    16
    exit 1
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    17
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    18
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    19
prepare_environment() {
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    20
    ARCH=$1
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    21
    
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    22
    if test x$SDK_VERSION = x; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    23
      export SDK_VERSION=`xcodebuild -showsdks | grep iphoneos | sed "s|.*iphoneos||"`
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    24
      if [ -z "$XCODE_PATH" ]; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    25
          echo "Could not find a valid iOS SDK"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    26
          exit 1
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    27
      fi  
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    28
    fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    29
    
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    30
    case $ARCH in
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    31
        armv6)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    32
            DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    33
            SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    34
            ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    35
        armv7)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    36
            DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    37
            SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    38
            ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    39
        i386)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    40
            DEV_PATH="$XCODE_PATH/Platforms/iPhoneSimulator.platform/Developer"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    41
            SDK_PATH="$DEV_PATH/SDKs/iPhoneSimulator$SDK_VERSION.sdk"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    42
            ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    43
        *)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    44
            echo "Unknown Architecture $ARCH"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    45
            exit 1
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    46
            ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    47
    esac
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    48
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    49
    if [ ! -d "$SDK_PATH" ]; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    50
        echo "Could not find iOS SDK at $SDK_PATH"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    51
        exit 1
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    52
    fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    53
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    54
    if test x$MIN_OS_VERSION = x; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    55
        export MIN_OS_VERSION="3.0"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    56
    fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    57
    
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    58
    # Environment flags
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    59
    CFLAGS="-g -O2 -pipe -no-cpp-precomp -isysroot $SDK_PATH \
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    60
            -miphoneos-version-min=$MIN_OS_VERSION -I$SDK_PATH/usr/include/"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    61
    LDFLAGS="-L$SDK_PATH/usr/lib/ -isysroot $SDK_PATH \
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    62
             -miphoneos-version-min=$MIN_OS_VERSION -static-libgcc"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    63
    export CXXFLAGS="$CFLAGS"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    64
    export CXXCPP="$DEV_PATH/usr/bin/llvm-cpp-4.2"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    65
    export CPP="$CXXCPP"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    66
    export CXX="$DEV_PATH/usr/bin/llvm-g++-4.2"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    67
    export CC="$DEV_PATH/usr/bin/llvm-gcc-4.2"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    68
    export LD="$DEV_PATH/usr/bin/ld"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    69
    export AR="$DEV_PATH/usr/bin/ar"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    70
    export AS="$DEV_PATH/usr/bin/ls"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    71
    export NM="$DEV_PATH/usr/bin/nm"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    72
    export RANLIB="$DEV_PATH/usr/bin/ranlib"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    73
    export STRIP="$DEV_PATH/usr/bin/strip"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    74
    
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    75
    # We dynamically load X11, so using the system X11 headers is fine.
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    76
    CONFIG_FLAGS="--disable-shared --enable-static"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    77
    
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    78
    case $ARCH in
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    79
        armv6)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    80
            export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv6-apple-darwin"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    81
            export CFLAGS="$CFLAGS -arch armv6"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    82
            export LDFLAGS="$LDFLAGS -arch armv6"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    83
            ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    84
        armv7)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    85
            export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv7-apple-darwin"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    86
            export CFLAGS="$CFLAGS -arch armv7"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    87
            export LDFLAGS="$LDFLAGS -arch armv7"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    88
            ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    89
        i386)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    90
            export CONFIG_FLAGS="$CONFIG_FLAGS --host=i386-apple-darwin"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    91
            export CFLAGS="$CFLAGS -arch i386"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    92
            export LDFLAGS="$LDFLAGS -arch i386"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    93
            ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    94
        *)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    95
            echo "Unknown Architecture $ARCH"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    96
            exit 1
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    97
            ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    98
    esac
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
    99
}
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   100
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   101
prepare_environment "armv6"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   102
echo "Building with iOS SDK v$SDK_VERSION for iOS >= $MIN_OS_VERSION"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   103
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   104
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   105
# Find the configure script
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   106
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   107
srcdir=`dirname $0`/..
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   108
srcdir=`cd $srcdir && pwd`
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   109
auxdir=$srcdir/build-scripts
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   110
cd $srcdir
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   111
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   112
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   113
# Figure out which phase to build:
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   114
# all,
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   115
# configure, configure-armv6, configure-armv7, configure-i386
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   116
# make, make-armv6, make-armv7, make-i386, merge
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   117
# clean
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   118
if test x"$1" = x; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   119
    phase=all
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   120
else
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   121
    phase="$1"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   122
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   123
case $phase in
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   124
    all)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   125
        configure_armv6="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   126
        configure_armv7="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   127
        configure_i386="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   128
        make_armv6="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   129
        make_armv7="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   130
        make_i386="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   131
        merge="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   132
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   133
    configure)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   134
        configure_armv6="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   135
        configure_armv7="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   136
        configure_i386="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   137
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   138
    configure-armv6)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   139
        configure_armv6="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   140
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   141
    configure-armv7)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   142
        configure_armv7="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   143
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   144
    configure-i386)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   145
        configure_i386="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   146
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   147
    make)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   148
        make_armv6="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   149
        make_armv7="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   150
        make_i386="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   151
        merge="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   152
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   153
    make-armv6)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   154
        make_armv6="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   155
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   156
    make-armv7)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   157
        make_armv7="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   158
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   159
    make-i386)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   160
        make_i386="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   161
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   162
    merge)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   163
        merge="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   164
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   165
    clean)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   166
        clean_armv6="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   167
        clean_armv7="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   168
        clean_i386="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   169
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   170
    clean-armv6)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   171
        clean_armv6="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   172
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   173
    clean-armv7)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   174
        clean_armv7="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   175
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   176
    clean-i386)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   177
        clean_i386="yes"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   178
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   179
    *)
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   180
        echo "Usage: $0 [all|configure[-armv6|-armv7|-i386]|make[-armv6|-armv7|-i386]|merge|clean[-armv6|-armv7|-i386]]"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   181
        exit 1
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   182
        ;;
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   183
esac
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   184
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   185
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   186
# Create the build directories
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   187
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   188
for dir in build build/armv6 build/armv7 build/i386; do
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   189
    if test -d $dir; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   190
        :
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   191
    else
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   192
        mkdir $dir || exit 1
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   193
    fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   194
done
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   195
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   196
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   197
# Build the armv6 binary
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   198
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   199
prepare_environment "armv6"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   200
if test x$configure_armv6 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   201
    (cd build/armv6 && \
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   202
     sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   203
     # configure is not yet fully ready for iOS, some manual patching is required
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   204
     cp include/* build/armv6/include
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   205
     cp include/SDL_config_iphoneos.h build/armv6/include/SDL_config.h || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   206
     sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv6/Makefile || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   207
     sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv6/Makefile || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   208
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   209
if test x$make_armv6 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   210
    (cd build/armv6 && make -j$NJOB) || exit 3
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   211
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   212
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   213
# Build the armv7 binary
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   214
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   215
prepare_environment "armv7"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   216
if test x$configure_armv7 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   217
    (cd build/armv7 && \
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   218
     sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   219
     # configure is not yet fully ready for iOS, some manual patching is required
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   220
     cp include/* build/armv7/include
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   221
     cp include/SDL_config_iphoneos.h build/armv7/include/SDL_config.h || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   222
     sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv7/Makefile || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   223
     sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv7/Makefile || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   224
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   225
if test x$make_armv7 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   226
    (cd build/armv7 && make -j$NJOB) || exit 3
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   227
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   228
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   229
# Build the i386 binary
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   230
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   231
prepare_environment "i386"
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   232
if test x$configure_i386 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   233
    (cd build/i386 && \
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   234
     sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   235
     # configure is not yet fully ready for iOS, some manual patching is required
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   236
     cp include/* build/i386/include
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   237
     cp include/SDL_config_iphoneos.h build/i386/include/SDL_config.h || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   238
     sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/i386/Makefile || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   239
     sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/i386/Makefile || exit 2
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   240
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   241
if test x$make_i386 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   242
    (cd build/i386 && make -j$NJOB) || exit 3
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   243
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   244
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   245
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   246
# Combine into fat binary
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   247
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   248
if test x$merge = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   249
    output=ios/lib
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   250
    sh $auxdir/mkinstalldirs build/$output
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   251
    cd build
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   252
    target=`find . -mindepth 4 -maxdepth 4 -type f -name '*.dylib' | head -1 | sed 's|.*/||'`
6334
85b8778a05c2 small improvements in the iosbuild.sh script
Gabriel Jacobo <gabomdq@gmail.com>
parents: 6333
diff changeset
   253
    (lipo -create -o $output/libSDL2.a armv6/build/.libs/libSDL2.a armv7/build/.libs/libSDL2.a i386/build/.libs/libSDL2.a &&
85b8778a05c2 small improvements in the iosbuild.sh script
Gabriel Jacobo <gabomdq@gmail.com>
parents: 6333
diff changeset
   254
     lipo -create -o $output/libSDL2main.a armv6/build/libSDL2main.a armv7/build/libSDL2main.a i386/build/libSDL2main.a &&
6333
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   255
     cp -r armv6/include ios
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   256
     echo "Build complete!" &&
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   257
     echo "Files can be found under the build/ios directory.") || exit 4
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   258
    cd ..
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   259
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   260
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   261
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   262
# Clean up
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   263
#
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   264
do_clean()
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   265
{
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   266
    echo $*
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   267
    $* || exit 6
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   268
}
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   269
if test x$clean_armv6 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   270
    do_clean rm -r build/armv6
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   271
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   272
if test x$clean_armv7 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   273
    do_clean rm -r build/armv7
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   274
fi
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   275
if test x$clean_i386 = xyes; then
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   276
    do_clean rm -r build/i386
8d541aa4e1da Adds a simple command line utility (iosbuild.sh) to create iOS binaries for armv6, armv7 and i386
Gabriel Jacobo <gabomdq@gmail.com>
parents:
diff changeset
   277
fi