# Sets the target folders and the final framework product.
FMK_NAME = HovnVoipEngine
FMK_VERSION = 1.0
# Install dir will be the final output to the framework.
# The following line create it in the root folder of the current project.
INSTALL_DIR =$ {SRCROOT}/Products/$ {FMK_NAME}. framework
# Working dir will be deleted after the framework creation.
WRK_DIR = build
DEVICE_DIR =$ {WRK_DIR}/Release-iphoneos/$ {FMK_NAME}. framework
SIMULATOR_DIR =$ {WRK_DIR}/Release-iphonesimulator/$ {FMK_NAME}. framework
# Building both ubuntures.
Xcodebuild-configuration "Release"-target "$ {FMK_NAME}"-sdk iphoneos
Xcodebuild-configuration "Release"-target "$ {FMK_NAME}"-sdk iphonesimulator
# Cleaning the oldest.
If [-d "$ {INSTALL_DIR}"]
Then
Rm-rf "$ {INSTALL_DIR }"
Fi
# Creates and renews the final product folder.
Mkdir-p "$ {INSTALL_DIR }"
Mkdir-p "$ {INSTALL_DIR}/Versions"
Mkdir-p "$ {INSTALL_DIR}/Versions/$ {FMK_VERSION }"
Mkdir-p "$ {INSTALL_DIR}/Versions/$ {FMK_VERSION}/Resources"
Mkdir-p "$ {INSTALL_DIR}/Versions/$ {FMK_VERSION}/Headers"
# Creates the internal links.
# It MUST uses relative path, otherwise will not work when the folder is copied/moved.
Ln-s "$ {FMK_VERSION}" "$ {INSTALL_DIR}/Versions/Current"
Ln-s "Versions/Current/Headers" "$ {INSTALL_DIR}/Headers"
Ln-s "Versions/Current/Resources" "$ {INSTALL_DIR}/Resources"
Ln-s "Versions/Current/$ {FMK_NAME}" "$ {INSTALL_DIR}/$ {FMK_NAME }"
# Copies the headers and resources files to the final product folder.
Cp-R "$ {DEVICE_DIR}/Headers/" "$ {INSTALL_DIR}/Versions/$ {FMK_VERSION}/Headers /"
Cp-R "$ {DEVICE_DIR}/" "$ {INSTALL_DIR}/Versions/$ {FMK_VERSION}/Resources /"
# Removes the binary and header from the resources folder.
Rm-r "$ {INSTALL_DIR}/Versions/$ {FMK_VERSION}/Resources/Headers" "$ {INSTALL_DIR}/Versions/$ {FMK_VERSION}/Resources/$ {FMK_NAME }"
# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.
Lipo-create "$ {DEVICE_DIR}/$ {FMK_NAME}" "$ {SIMULATOR_DIR}/$ {FMK_NAME}"-output "$ {INSTALL_DIR}/Versions/$ {FMK_VERSION }/ $ {FMK_NAME }"
Rm-r "$ {WRK_DIR }"