Created
February 11, 2013 10:02
-
-
Save dostanko/4753618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default build dir | |
UFW_BUILD_DIR="./build" | |
# Global vars | |
#if [ ! -z ${BUILD_DIR} ]; then | |
## Use the build dir specified by XCode | |
# UFW_BUILD_DIR="${BUILD_DIR}" | |
#fi | |
if [ -z ${SDK_NAME} ]; then | |
# Use the latest iphoneos SDK available | |
UFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o "iphoneos.*$") | |
while read -r line; do | |
UFW_SDK_VERSION="${line}" | |
done <<< "${UFW_GREP_RESULT}" | |
else | |
# Use the SDK specified by XCode | |
UFW_SDK_VERSION="${SDK_NAME}" | |
fi | |
UFW_SDK_VERSION=$(echo "${UFW_SDK_VERSION}" | grep -o "[0-9].*$") | |
UFW_EXE_FOLDER_PATH="${UFW_TARGET}.framework" | |
UFW_EXE_PATH="${UFW_EXE_FOLDER_PATH}/${UFW_TARGET}" | |
UFW_IPHONE_DIR="${UFW_BUILD_DIR}/Release-iphoneos" | |
UFW_SIMULATOR_DIR="${UFW_BUILD_DIR}/Release-iphonesimulator" | |
UFW_UNIVERSAL_DIR="${UFW_BUILD_DIR}/Release-universal" | |
# Build Framework | |
rm -rf "${UFW_UNIVERSAL_DIR}" | |
xcodebuild ARCHS="armv6 armv7" -target "${UFW_TARGET}" -configuration Release -sdk iphoneos${UFW_SDK_VERSION} GCC_PREPROCESSOR_DEFINITIONS="CDV_VERSION=${CDV_VER}" clean build | |
if [ "$?" != "0" ]; then echo >&2 "Error: xcodebuild failed"; exit 1; fi | |
xcodebuild ARCHS="i386" -target "${UFW_TARGET}" -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} GCC_PREPROCESSOR_DEFINITIONS="CDV_VERSION=${CDV_VER}" clean build | |
if [ "$?" != "0" ]; then echo >&2 "Error: xcodebuild failed"; exit 1; fi | |
if [ ! -f "${UFW_IPHONE_DIR}/${UFW_EXE_PATH}" ]; then | |
echo "Framework target \"${UFW_TARGET}\" had no source files to build from. Make sure your source files have the correct target membership" | |
exit 1 | |
fi | |
mkdir -p "${UFW_UNIVERSAL_DIR}" | |
if [ "$?" != "0" ]; then echo >&2 "Error: mkdir failed"; exit 1; fi | |
cp -a "${UFW_IPHONE_DIR}/${UFW_EXE_FOLDER_PATH}" "${UFW_UNIVERSAL_DIR}/${UFW_EXE_FOLDER_PATH}" | |
if [ "$?" != "0" ]; then echo >&2 "Error: cp failed"; exit 1; fi | |
lipo -create -output "${UFW_UNIVERSAL_DIR}/${UFW_EXE_PATH}" "${UFW_IPHONE_DIR}/${UFW_EXE_PATH}" "${UFW_SIMULATOR_DIR}/${UFW_EXE_PATH}" | |
if [ "$?" != "0" ]; then echo >&2 "Error: lipo failed"; exit 1; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment