Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brett-stover-hs/b25947a125ff7e38e7ca to your computer and use it in GitHub Desktop.
Save brett-stover-hs/b25947a125ff7e38e7ca to your computer and use it in GitHub Desktop.
removal script a
# Removal Script A
# 1
# Set bash script to exit immediately if any commands fail.
set -e
# 2
# Setup some constants for use later on.
FRAMEWORK_NAME="BrandingFramework"
# 3
# If there exists a backup version of the framework, restore it and remove backup
if [[ -d "${SRCROOT}/backup" ]]; then
rm -rf "${SRCROOT}/${FRAMEWORK_NAME}.framework"
cp -rf "${SRCROOT}/backup/${FRAMEWORK_NAME}.framework" "${SRCROOT}/${FRAMEWORK_NAME}.framework"
rm -rf "${SRCROOT}/backup"
fi
# 4
# Only perform the following steps when building for release on device
if [[ "${CONFIGURATION}" == "Release" && "${SDKROOT}" == *"iPhoneOS"* ]]; then
# 5
# Create backup copy of framework
mkdir "${SRCROOT}/backup"
cp -rf "${SRCROOT}/${FRAMEWORK_NAME}.framework" "${SRCROOT}/backup/${FRAMEWORK_NAME}.framework"
# 6
# Strip out the unneeded architectures
lipo "${SRCROOT}/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" -remove "i386" -output "${SRCROOT}/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}"
lipo "${SRCROOT}/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" -remove "x86_64" -output "${SRCROOT}/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment