build-scripts/iosbuild.sh
changeset 10904 4dbd025c4eb9
parent 6334 85b8778a05c2
child 13861 fe24019c4791
     1.1 --- a/build-scripts/iosbuild.sh	Mon Feb 20 10:55:33 2017 -0800
     1.2 +++ b/build-scripts/iosbuild.sh	Mon Feb 20 10:55:49 2017 -0800
     1.3 @@ -1,7 +1,6 @@
     1.4  #!/bin/sh
     1.5  #
     1.6  # Build a fat binary for iOS
     1.7 -# Based on fatbuild.sh and code from the Ignifuga Game Engine
     1.8  
     1.9  # Number of CPUs (for make -j)
    1.10  NCPU=`sysctl -n hw.ncpu`
    1.11 @@ -9,269 +8,181 @@
    1.12      NJOB=$NCPU
    1.13  fi
    1.14  
    1.15 -# SDK path
    1.16 -XCODE_PATH=`xcode-select --print-path`
    1.17 -if [ -z "$XCODE_PATH" ]; then
    1.18 -    echo "Could not find XCode location (use xcode-select -switch to set the correct path)"
    1.19 -    exit 1
    1.20 +SRC_DIR=$(cd `dirname $0`/..; pwd)
    1.21 +if [ "$PWD" = "$SRC_DIR" ]; then
    1.22 +    PREFIX=$SRC_DIR/ios-build
    1.23 +    mkdir $PREFIX
    1.24 +else
    1.25 +    PREFIX=$PWD
    1.26 +fi
    1.27 +
    1.28 +BUILD_I386_IOSSIM=YES
    1.29 +BUILD_X86_64_IOSSIM=YES
    1.30 +
    1.31 +BUILD_IOS_ARMV7=YES
    1.32 +BUILD_IOS_ARMV7S=YES
    1.33 +BUILD_IOS_ARM64=YES
    1.34 +
    1.35 +# 13.4.0 - Mavericks
    1.36 +# 14.0.0 - Yosemite
    1.37 +# 15.0.0 - El Capitan
    1.38 +DARWIN=darwin15.0.0
    1.39 +
    1.40 +XCODEDIR=`xcode-select --print-path`
    1.41 +IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
    1.42 +MIN_SDK_VERSION=6.0
    1.43 +
    1.44 +IPHONEOS_PLATFORM=`xcrun --sdk iphoneos --show-sdk-platform-path`
    1.45 +IPHONEOS_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path`
    1.46 +
    1.47 +IPHONESIMULATOR_PLATFORM=`xcrun --sdk iphonesimulator --show-sdk-platform-path`
    1.48 +IPHONESIMULATOR_SYSROOT=`xcrun --sdk iphonesimulator --show-sdk-path`
    1.49 +
    1.50 +# Uncomment if you want to see more information about each invocation
    1.51 +# of clang as the builds proceed.
    1.52 +# CLANG_VERBOSE="--verbose"
    1.53 +
    1.54 +CC=clang
    1.55 +CXX=clang
    1.56 +
    1.57 +SILENCED_WARNINGS="-Wno-unused-local-typedef -Wno-unused-function"
    1.58 +
    1.59 +CFLAGS="${CLANG_VERBOSE} ${SILENCED_WARNINGS} -DNDEBUG -g -O0 -pipe -fPIC -fobjc-arc"
    1.60 +
    1.61 +echo "PREFIX ..................... ${PREFIX}"
    1.62 +echo "BUILD_MACOSX_X86_64 ........ ${BUILD_MACOSX_X86_64}"
    1.63 +echo "BUILD_I386_IOSSIM .......... ${BUILD_I386_IOSSIM}"
    1.64 +echo "BUILD_X86_64_IOSSIM ........ ${BUILD_X86_64_IOSSIM}"
    1.65 +echo "BUILD_IOS_ARMV7 ............ ${BUILD_IOS_ARMV7}"
    1.66 +echo "BUILD_IOS_ARMV7S ........... ${BUILD_IOS_ARMV7S}"
    1.67 +echo "BUILD_IOS_ARM64 ............ ${BUILD_IOS_ARM64}"
    1.68 +echo "DARWIN ..................... ${DARWIN}"
    1.69 +echo "XCODEDIR ................... ${XCODEDIR}"
    1.70 +echo "IOS_SDK_VERSION ............ ${IOS_SDK_VERSION}"
    1.71 +echo "MIN_SDK_VERSION ............ ${MIN_SDK_VERSION}"
    1.72 +echo "IPHONEOS_PLATFORM .......... ${IPHONEOS_PLATFORM}"
    1.73 +echo "IPHONEOS_SYSROOT ........... ${IPHONEOS_SYSROOT}"
    1.74 +echo "IPHONESIMULATOR_PLATFORM ... ${IPHONESIMULATOR_PLATFORM}"
    1.75 +echo "IPHONESIMULATOR_SYSROOT .... ${IPHONESIMULATOR_SYSROOT}"
    1.76 +echo "CC ......................... ${CC}"
    1.77 +echo "CFLAGS ..................... ${CFLAGS}"
    1.78 +echo "CXX ........................ ${CXX}"
    1.79 +echo "CXXFLAGS ................... ${CXXFLAGS}"
    1.80 +echo "LDFLAGS .................... ${LDFLAGS}"
    1.81 +
    1.82 +###################################################################
    1.83 +# This section contains the build commands for each of the 
    1.84 +# architectures that will be included in the universal binaries.
    1.85 +###################################################################
    1.86 +
    1.87 +echo "$(tput setaf 2)"
    1.88 +echo "###########################"
    1.89 +echo "# i386 for iPhone Simulator"
    1.90 +echo "###########################"
    1.91 +echo "$(tput sgr0)"
    1.92 +
    1.93 +if [ "${BUILD_I386_IOSSIM}" == "YES" ]
    1.94 +then
    1.95 +    (
    1.96 +        cd ${PREFIX}
    1.97 +        make clean
    1.98 +        ../configure --build=x86_64-apple-${DARWIN} --host=i386-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/i386-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch i386 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2
    1.99 +	cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
   1.100 +        make -j10 || exit 3
   1.101 +        make install
   1.102 +    ) || exit $?
   1.103  fi
   1.104  
   1.105 -prepare_environment() {
   1.106 -    ARCH=$1
   1.107 -    
   1.108 -    if test x$SDK_VERSION = x; then
   1.109 -      export SDK_VERSION=`xcodebuild -showsdks | grep iphoneos | sed "s|.*iphoneos||"`
   1.110 -      if [ -z "$XCODE_PATH" ]; then
   1.111 -          echo "Could not find a valid iOS SDK"
   1.112 -          exit 1
   1.113 -      fi  
   1.114 -    fi
   1.115 -    
   1.116 -    case $ARCH in
   1.117 -        armv6)
   1.118 -            DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer"
   1.119 -            SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
   1.120 -            ;;
   1.121 -        armv7)
   1.122 -            DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer"
   1.123 -            SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
   1.124 -            ;;
   1.125 -        i386)
   1.126 -            DEV_PATH="$XCODE_PATH/Platforms/iPhoneSimulator.platform/Developer"
   1.127 -            SDK_PATH="$DEV_PATH/SDKs/iPhoneSimulator$SDK_VERSION.sdk"
   1.128 -            ;;
   1.129 -        *)
   1.130 -            echo "Unknown Architecture $ARCH"
   1.131 -            exit 1
   1.132 -            ;;
   1.133 -    esac
   1.134 -
   1.135 -    if [ ! -d "$SDK_PATH" ]; then
   1.136 -        echo "Could not find iOS SDK at $SDK_PATH"
   1.137 -        exit 1
   1.138 -    fi
   1.139 +echo "$(tput setaf 2)"
   1.140 +echo "#############################"
   1.141 +echo "# x86_64 for iPhone Simulator"
   1.142 +echo "#############################"
   1.143 +echo "$(tput sgr0)"
   1.144  
   1.145 -    if test x$MIN_OS_VERSION = x; then
   1.146 -        export MIN_OS_VERSION="3.0"
   1.147 -    fi
   1.148 -    
   1.149 -    # Environment flags
   1.150 -    CFLAGS="-g -O2 -pipe -no-cpp-precomp -isysroot $SDK_PATH \
   1.151 -            -miphoneos-version-min=$MIN_OS_VERSION -I$SDK_PATH/usr/include/"
   1.152 -    LDFLAGS="-L$SDK_PATH/usr/lib/ -isysroot $SDK_PATH \
   1.153 -             -miphoneos-version-min=$MIN_OS_VERSION -static-libgcc"
   1.154 -    export CXXFLAGS="$CFLAGS"
   1.155 -    export CXXCPP="$DEV_PATH/usr/bin/llvm-cpp-4.2"
   1.156 -    export CPP="$CXXCPP"
   1.157 -    export CXX="$DEV_PATH/usr/bin/llvm-g++-4.2"
   1.158 -    export CC="$DEV_PATH/usr/bin/llvm-gcc-4.2"
   1.159 -    export LD="$DEV_PATH/usr/bin/ld"
   1.160 -    export AR="$DEV_PATH/usr/bin/ar"
   1.161 -    export AS="$DEV_PATH/usr/bin/ls"
   1.162 -    export NM="$DEV_PATH/usr/bin/nm"
   1.163 -    export RANLIB="$DEV_PATH/usr/bin/ranlib"
   1.164 -    export STRIP="$DEV_PATH/usr/bin/strip"
   1.165 -    
   1.166 -    # We dynamically load X11, so using the system X11 headers is fine.
   1.167 -    CONFIG_FLAGS="--disable-shared --enable-static"
   1.168 -    
   1.169 -    case $ARCH in
   1.170 -        armv6)
   1.171 -            export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv6-apple-darwin"
   1.172 -            export CFLAGS="$CFLAGS -arch armv6"
   1.173 -            export LDFLAGS="$LDFLAGS -arch armv6"
   1.174 -            ;;
   1.175 -        armv7)
   1.176 -            export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv7-apple-darwin"
   1.177 -            export CFLAGS="$CFLAGS -arch armv7"
   1.178 -            export LDFLAGS="$LDFLAGS -arch armv7"
   1.179 -            ;;
   1.180 -        i386)
   1.181 -            export CONFIG_FLAGS="$CONFIG_FLAGS --host=i386-apple-darwin"
   1.182 -            export CFLAGS="$CFLAGS -arch i386"
   1.183 -            export LDFLAGS="$LDFLAGS -arch i386"
   1.184 -            ;;
   1.185 -        *)
   1.186 -            echo "Unknown Architecture $ARCH"
   1.187 -            exit 1
   1.188 -            ;;
   1.189 -    esac
   1.190 -}
   1.191 -
   1.192 -prepare_environment "armv6"
   1.193 -echo "Building with iOS SDK v$SDK_VERSION for iOS >= $MIN_OS_VERSION"
   1.194 -
   1.195 -#
   1.196 -# Find the configure script
   1.197 -#
   1.198 -srcdir=`dirname $0`/..
   1.199 -srcdir=`cd $srcdir && pwd`
   1.200 -auxdir=$srcdir/build-scripts
   1.201 -cd $srcdir
   1.202 -
   1.203 -#
   1.204 -# Figure out which phase to build:
   1.205 -# all,
   1.206 -# configure, configure-armv6, configure-armv7, configure-i386
   1.207 -# make, make-armv6, make-armv7, make-i386, merge
   1.208 -# clean
   1.209 -if test x"$1" = x; then
   1.210 -    phase=all
   1.211 -else
   1.212 -    phase="$1"
   1.213 +if [ "${BUILD_X86_64_IOSSIM}" == "YES" ]
   1.214 +then
   1.215 +    (
   1.216 +        cd ${PREFIX}
   1.217 +        make clean
   1.218 +        ../configure --build=x86_64-apple-${DARWIN} --host=x86_64-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/x86_64-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch x86_64 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2
   1.219 +	cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
   1.220 +        make -j$NJOB || exit 3
   1.221 +        make install
   1.222 +    ) || exit $?
   1.223  fi
   1.224 -case $phase in
   1.225 -    all)
   1.226 -        configure_armv6="yes"
   1.227 -        configure_armv7="yes"
   1.228 -        configure_i386="yes"
   1.229 -        make_armv6="yes"
   1.230 -        make_armv7="yes"
   1.231 -        make_i386="yes"
   1.232 -        merge="yes"
   1.233 -        ;;
   1.234 -    configure)
   1.235 -        configure_armv6="yes"
   1.236 -        configure_armv7="yes"
   1.237 -        configure_i386="yes"
   1.238 -        ;;
   1.239 -    configure-armv6)
   1.240 -        configure_armv6="yes"
   1.241 -        ;;
   1.242 -    configure-armv7)
   1.243 -        configure_armv7="yes"
   1.244 -        ;;
   1.245 -    configure-i386)
   1.246 -        configure_i386="yes"
   1.247 -        ;;
   1.248 -    make)
   1.249 -        make_armv6="yes"
   1.250 -        make_armv7="yes"
   1.251 -        make_i386="yes"
   1.252 -        merge="yes"
   1.253 -        ;;
   1.254 -    make-armv6)
   1.255 -        make_armv6="yes"
   1.256 -        ;;
   1.257 -    make-armv7)
   1.258 -        make_armv7="yes"
   1.259 -        ;;
   1.260 -    make-i386)
   1.261 -        make_i386="yes"
   1.262 -        ;;
   1.263 -    merge)
   1.264 -        merge="yes"
   1.265 -        ;;
   1.266 -    clean)
   1.267 -        clean_armv6="yes"
   1.268 -        clean_armv7="yes"
   1.269 -        clean_i386="yes"
   1.270 -        ;;
   1.271 -    clean-armv6)
   1.272 -        clean_armv6="yes"
   1.273 -        ;;
   1.274 -    clean-armv7)
   1.275 -        clean_armv7="yes"
   1.276 -        ;;
   1.277 -    clean-i386)
   1.278 -        clean_i386="yes"
   1.279 -        ;;
   1.280 -    *)
   1.281 -        echo "Usage: $0 [all|configure[-armv6|-armv7|-i386]|make[-armv6|-armv7|-i386]|merge|clean[-armv6|-armv7|-i386]]"
   1.282 -        exit 1
   1.283 -        ;;
   1.284 -esac
   1.285 +
   1.286 +echo "$(tput setaf 2)"
   1.287 +echo "##################"
   1.288 +echo "# armv7 for iPhone"
   1.289 +echo "##################"
   1.290 +echo "$(tput sgr0)"
   1.291  
   1.292 -#
   1.293 -# Create the build directories
   1.294 -#
   1.295 -for dir in build build/armv6 build/armv7 build/i386; do
   1.296 -    if test -d $dir; then
   1.297 -        :
   1.298 -    else
   1.299 -        mkdir $dir || exit 1
   1.300 -    fi
   1.301 -done
   1.302 -
   1.303 -#
   1.304 -# Build the armv6 binary
   1.305 -#
   1.306 -prepare_environment "armv6"
   1.307 -if test x$configure_armv6 = xyes; then
   1.308 -    (cd build/armv6 && \
   1.309 -     sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
   1.310 -     # configure is not yet fully ready for iOS, some manual patching is required
   1.311 -     cp include/* build/armv6/include
   1.312 -     cp include/SDL_config_iphoneos.h build/armv6/include/SDL_config.h || exit 2
   1.313 -     sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv6/Makefile || exit 2
   1.314 -     sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv6/Makefile || exit 2
   1.315 -fi
   1.316 -if test x$make_armv6 = xyes; then
   1.317 -    (cd build/armv6 && make -j$NJOB) || exit 3
   1.318 -fi
   1.319 -#
   1.320 -# Build the armv7 binary
   1.321 -#
   1.322 -prepare_environment "armv7"
   1.323 -if test x$configure_armv7 = xyes; then
   1.324 -    (cd build/armv7 && \
   1.325 -     sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
   1.326 -     # configure is not yet fully ready for iOS, some manual patching is required
   1.327 -     cp include/* build/armv7/include
   1.328 -     cp include/SDL_config_iphoneos.h build/armv7/include/SDL_config.h || exit 2
   1.329 -     sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv7/Makefile || exit 2
   1.330 -     sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv7/Makefile || exit 2
   1.331 -fi
   1.332 -if test x$make_armv7 = xyes; then
   1.333 -    (cd build/armv7 && make -j$NJOB) || exit 3
   1.334 -fi
   1.335 -#
   1.336 -# Build the i386 binary
   1.337 -#
   1.338 -prepare_environment "i386"
   1.339 -if test x$configure_i386 = xyes; then
   1.340 -    (cd build/i386 && \
   1.341 -     sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2
   1.342 -     # configure is not yet fully ready for iOS, some manual patching is required
   1.343 -     cp include/* build/i386/include
   1.344 -     cp include/SDL_config_iphoneos.h build/i386/include/SDL_config.h || exit 2
   1.345 -     sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/i386/Makefile || exit 2
   1.346 -     sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/i386/Makefile || exit 2
   1.347 -fi
   1.348 -if test x$make_i386 = xyes; then
   1.349 -    (cd build/i386 && make -j$NJOB) || exit 3
   1.350 +if [ "${BUILD_IOS_ARMV7}" == "YES" ]
   1.351 +then
   1.352 +    (
   1.353 +        cd ${PREFIX}
   1.354 +        make clean
   1.355 +        ../configure --build=x86_64-apple-${DARWIN} --host=armv7-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2
   1.356 +	cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
   1.357 +        make -j$NJOB || exit 3
   1.358 +        make install
   1.359 +    ) || exit $?
   1.360  fi
   1.361  
   1.362 -#
   1.363 -# Combine into fat binary
   1.364 -#
   1.365 -if test x$merge = xyes; then
   1.366 -    output=ios/lib
   1.367 -    sh $auxdir/mkinstalldirs build/$output
   1.368 -    cd build
   1.369 -    target=`find . -mindepth 4 -maxdepth 4 -type f -name '*.dylib' | head -1 | sed 's|.*/||'`
   1.370 -    (lipo -create -o $output/libSDL2.a armv6/build/.libs/libSDL2.a armv7/build/.libs/libSDL2.a i386/build/.libs/libSDL2.a &&
   1.371 -     lipo -create -o $output/libSDL2main.a armv6/build/libSDL2main.a armv7/build/libSDL2main.a i386/build/libSDL2main.a &&
   1.372 -     cp -r armv6/include ios
   1.373 -     echo "Build complete!" &&
   1.374 -     echo "Files can be found under the build/ios directory.") || exit 4
   1.375 -    cd ..
   1.376 +echo "$(tput setaf 2)"
   1.377 +echo "###################"
   1.378 +echo "# armv7s for iPhone"
   1.379 +echo "###################"
   1.380 +echo "$(tput sgr0)"
   1.381 +
   1.382 +if [ "${BUILD_IOS_ARMV7S}" == "YES" ]
   1.383 +then
   1.384 +    (
   1.385 +        cd ${PREFIX}
   1.386 +        make clean
   1.387 +        ../configure --build=x86_64-apple-${DARWIN} --host=armv7s-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7s-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7s -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2
   1.388 +	cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
   1.389 +        make -j$NJOB || exit 3
   1.390 +        make install
   1.391 +    ) || exit $?
   1.392  fi
   1.393  
   1.394 -#
   1.395 -# Clean up
   1.396 -#
   1.397 -do_clean()
   1.398 -{
   1.399 -    echo $*
   1.400 -    $* || exit 6
   1.401 -}
   1.402 -if test x$clean_armv6 = xyes; then
   1.403 -    do_clean rm -r build/armv6
   1.404 +echo "$(tput setaf 2)"
   1.405 +echo "##################"
   1.406 +echo "# arm64 for iPhone"
   1.407 +echo "##################"
   1.408 +echo "$(tput sgr0)"
   1.409 +
   1.410 +if [ "${BUILD_IOS_ARM64}" == "YES" ]
   1.411 +then
   1.412 +    (
   1.413 +        cd ${PREFIX}
   1.414 +        make clean
   1.415 +        ../configure --build=x86_64-apple-${DARWIN} --host=arm-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/arm64-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch arm64 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2
   1.416 +	cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h
   1.417 +        make -j$NJOB || exit 3
   1.418 +        make install
   1.419 +    ) || exit $?
   1.420  fi
   1.421 -if test x$clean_armv7 = xyes; then
   1.422 -    do_clean rm -r build/armv7
   1.423 -fi
   1.424 -if test x$clean_i386 = xyes; then
   1.425 -    do_clean rm -r build/i386
   1.426 -fi
   1.427 +
   1.428 +echo "$(tput setaf 2)"
   1.429 +echo "###################################################################"
   1.430 +echo "# Create Universal Libraries and Finalize the packaging"
   1.431 +echo "###################################################################"
   1.432 +echo "$(tput sgr0)"
   1.433 +
   1.434 +(
   1.435 +    cd ${PREFIX}/platform
   1.436 +    mkdir -p universal
   1.437 +    lipo x86_64-sim/lib/libSDL2.a i386-sim/lib/libSDL2.a arm64-ios/lib/libSDL2.a armv7s-ios/lib/libSDL2.a armv7-ios/lib/libSDL2.a -create -output universal/libSDL2.a
   1.438 +)
   1.439 +
   1.440 +(
   1.441 +    cd ${PREFIX}
   1.442 +    mkdir -p lib
   1.443 +    cp -r platform/universal/* lib
   1.444 +    #rm -rf platform
   1.445 +    lipo -info lib/libSDL2.a
   1.446 +)
   1.447 +
   1.448 +echo Done!