Skip to content

Commit

Permalink
Updated build scripts for tvOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardjrossiii committed Sep 14, 2015
1 parent a327efa commit 748b6c9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/build_framework.sh
Expand Up @@ -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

# -----------------------------------------------------------------------------

Expand All @@ -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}."
Expand All @@ -94,20 +99,29 @@ 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
#
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 \
"$BOLTS_BUILD/${BUILDCONFIGURATION}-iphoneos/Bolts.framework" \
"$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 \
Expand All @@ -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
#
Expand Down
2 changes: 2 additions & 0 deletions scripts/common.sh
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 748b6c9

Please sign in to comment.