1#!/bin/bash
2
3BASE=$(cd $(dirname $0); pwd -P)
4
5BUILD_DIR=$BASE/target/objectal
6rm -rf $BUILD_DIR
7mkdir -p $BUILD_DIR
8
9curl https://codeload.github.com/libgdx/ObjectAL-for-iPhone/legacy.tar.gz/master -o $BUILD_DIR/objectal.tar.gz
10
11tar xvfz $BUILD_DIR/objectal.tar.gz -C $BUILD_DIR --strip-components 1
12
13XCODEPROJ=$BUILD_DIR/ObjectAL/ObjectAL.xcodeproj
14
15xcodebuild -project $XCODEPROJ -arch armv7  -sdk iphoneos         CONFIGURATION_BUILD_DIR=$BUILD_DIR/armv7  OTHER_CFLAGS="-fembed-bitcode -miphoneos-version-min=6.0"
16xcodebuild -project $XCODEPROJ -arch arm64  -sdk iphoneos         CONFIGURATION_BUILD_DIR=$BUILD_DIR/arm64  OTHER_CFLAGS="-fembed-bitcode -miphoneos-version-min=6.0"
17xcodebuild -project $XCODEPROJ -arch i386   -sdk iphonesimulator  CONFIGURATION_BUILD_DIR=$BUILD_DIR/i386   OTHER_CFLAGS="-miphoneos-version-min=6.0"
18xcodebuild -project $XCODEPROJ -arch x86_64 -sdk iphonesimulator  CONFIGURATION_BUILD_DIR=$BUILD_DIR/x86_64 OTHER_CFLAGS="-miphoneos-version-min=6.0"
19xcodebuild -project $XCODEPROJ -arch arm64  -sdk appletvos        CONFIGURATION_BUILD_DIR=$BUILD_DIR/tvos-arm64 OTHER_CFLAGS="-fembed-bitcode -mtvos-version-min=9.0"
20xcodebuild -project $XCODEPROJ -arch x86_64 -sdk appletvsimulator CONFIGURATION_BUILD_DIR=$BUILD_DIR/tvos-x86_64 OTHER_CFLAGS="-mtvos-version-min=9.0"
21
22lipo $BUILD_DIR/armv7/libObjectAL.a \
23     $BUILD_DIR/arm64/libObjectAL.a \
24     $BUILD_DIR/i386/libObjectAL.a \
25     $BUILD_DIR/x86_64/libObjectAL.a \
26     -create \
27     -output $BUILD_DIR/libObjectAL.a
28
29cp $BUILD_DIR/libObjectAL.a $BASE/../../gdx/libs/ios32/
30
31lipo $BUILD_DIR/tvos-arm64/libObjectAL.a \
32     $BUILD_DIR/tvos-x86_64/libObjectAL.a \
33     -create \
34     -output $BUILD_DIR/libObjectAL.a.tvos
35
36cp $BUILD_DIR/libObjectAL.a.tvos $BASE/../../gdx/libs/ios32/
37