From 88c2078b626b029811021a6e5463a102105d429c Mon Sep 17 00:00:00 2001 From: Richard Ross Date: Mon, 14 Sep 2015 16:00:38 -0700 Subject: [PATCH] Updated build scripts for tvOS. --- scripts/build_framework.sh | 25 +++++++++++++++++++++++++ scripts/common.sh | 2 ++ 2 files changed, 27 insertions(+) diff --git a/scripts/build_framework.sh b/scripts/build_framework.sh index 20dfbe289..033ce4db1 100755 --- a/scripts/build_framework.sh +++ b/scripts/build_framework.sh @@ -58,6 +58,7 @@ test -x "$LIPO" || die 'Could not find lipo in $PATH' BOLTS_IOS_BINARY=$BOLTS_BUILD/${BUILDCONFIGURATION}-universal/Bolts.framework/Bolts BOLTS_OSX_BINARY=$BOLTS_BUILD/${BUILDCONFIGURATION}/Bolts.framework +BOLTS_TVOS_BINARY=$BOLTS_BUILD/${BUILDCONFIGURATION}-appletv-universal/Bolts.framework/Bolts # ----------------------------------------------------------------------------- @@ -78,6 +79,10 @@ test -d "$BOLTS_OSX_BUILD" \ || mkdir -p "$BOLTS_OSX_BUILD" \ || die "Could not create directory $BOLTS_OSX_BUILD" +test -d "$BOLTS_TVOS_BUILD" \ + || mkdir -p "$BOLTS_TVOS_BUILD" \ + || die "Could not create directory $BOLTS_TVOS_BUILD" + cd "$BOLTS_SRC" function xcode_build_target() { echo "Compiling for platform: ${1}." @@ -94,6 +99,8 @@ function xcode_build_target() { xcode_build_target "iphonesimulator" "${BUILDCONFIGURATION}" xcode_build_target "iphoneos" "${BUILDCONFIGURATION}" xcode_build_target "macosx" "${BUILDCONFIGURATION}" "Mac" +xcode_build_target "appletvsimulator" "${BUILDCONFIGURATION}" "TV" +xcode_build_target "appletvos" "${BUILDCONFIGURATION}" "TV" # ----------------------------------------------------------------------------- # Merge lib files for different platforms into universal binary @@ -101,6 +108,7 @@ xcode_build_target "macosx" "${BUILDCONFIGURATION}" "Mac" progress_message "Building Bolts univeral library using lipo." mkdir -p "$(dirname "$BOLTS_IOS_BINARY")" +mkdir -p "$(dirname "$BOLTS_TVOS_BINARY")" # Copy/Paste iOS Framework to get structure/resources/etc cp -av \ @@ -108,6 +116,12 @@ cp -av \ "$BOLTS_BUILD/${BUILDCONFIGURATION}-universal" rm "$BOLTS_BUILD/${BUILDCONFIGURATION}-universal/Bolts.framework/Bolts" +# Copy/Paste AppleTV framework to get structure/resources/etc +cp -av \ + "$BOLTS_BUILD/${BUILDCONFIGURATION}-appletvos/Bolts.framework" \ + "$BOLTS_BUILD/${BUILDCONFIGURATION}-appletv-universal" +rm "$BOLTS_BUILD/${BUILDCONFIGURATION}-appletv-universal/Bolts.framework/Bolts" + # Combine iOS/Simulator binaries into a single universal binary. $LIPO \ -create \ @@ -116,12 +130,23 @@ $LIPO \ -output "$BOLTS_IOS_BINARY" \ || die "lipo failed - could not create universal static library" +# Combine AppleTV/Simulator binaries into a single universal binary. +$LIPO \ + -create \ + "$BOLTS_BUILD/${BUILDCONFIGURATION}-appletvsimulator/Bolts.framework/Bolts" \ + "$BOLTS_BUILD/${BUILDCONFIGURATION}-appletvos/Bolts.framework/Bolts" \ + -output "$BOLTS_TVOS_BINARY" \ + || die "lipo failed - could not create universal static library" + # Copy/Paste created iOS Framework to final location cp -av "$(dirname "$BOLTS_IOS_BINARY")" $BOLTS_IOS_FRAMEWORK # Copy/Paste OSX framework, as this is already built for us cp -av "$BOLTS_OSX_BINARY" $BOLTS_OSX_FRAMEWORK +# Copy/Paste TVOS Framework +cp -av "$(dirname "$BOLTS_TVOS_BINARY")" $BOLTS_TVOS_FRAMEWORK + # ----------------------------------------------------------------------------- # Run unit tests # diff --git a/scripts/common.sh b/scripts/common.sh index 370a7b10a..70a876195 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -48,6 +48,7 @@ if [ -z "$BOLTS_SCRIPT" ]; then BOLTS_BUILD=$BOLTS_ROOT/build BOLTS_IOS_BUILD=$BOLTS_ROOT/build/ios BOLTS_OSX_BUILD=$BOLTS_ROOT/build/osx + BOLTS_TVOS_BUILD=$BOLTS_ROOT/build/tvos BOLTS_BUILD_LOG=$BOLTS_BUILD/build.log # The name of the Bolts framework @@ -56,6 +57,7 @@ if [ -z "$BOLTS_SCRIPT" ]; then # The path to the built Bolts .framework file BOLTS_IOS_FRAMEWORK=$BOLTS_IOS_BUILD/$BOLTS_FRAMEWORK_NAME BOLTS_OSX_FRAMEWORK=$BOLTS_OSX_BUILD/$BOLTS_FRAMEWORK_NAME + BOLTS_TVOS_FRAMEWORK=$BOLTS_TVOS_BUILD/$BOLTS_FRAMEWORK_NAME # The name of the docset BOLTS_DOCSET_NAME=Bolts.docset