# START script for debugLib,releaselib device and simulator
LIB_TARGET_NAME="project-name"
if [ "${ACTION}" = "clean" ]
then
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphoneos clean
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphonesimulator clean
fi
if [ "${ACTION}" = "build" ]
then
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphoneos
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphonesimulator
ARM_FILES="${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${LIB_TARGET_NAME}.a"
ARM_FILES1="${BUILD_DIR}/Debug-iphoneos/lib${LIB_TARGET_NAME}.a"
I386_FILES="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${LIB_TARGET_NAME}.a"
UNIVERSAL_OUTPUTFOLDER=${PROJECT_DIR}/build/${CONFIGURATION}-ProjectName
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
echo "Creating library..."
if [ "${CONFIGURATION}" = "Release" ]
then
lipo -create "$ARM_FILES" -output "${UNIVERSAL_OUTPUTFOLDER}/lib${LIB_TARGET_NAME}${CONFIGURATION}.a"
else
lipo -create "$ARM_FILES1" "$I386_FILES" -output "${UNIVERSAL_OUTPUTFOLDER}/lib${LIB_TARGET_NAME}${CONFIGURATION}.a"
fi
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}/"
rm -rf "${PROJECT_DIR}/build/${CONFIGURATION}-iphoneos"
rm -rf "${PROJECT_DIR}/build/lib${LIB_TARGET_NAME}.build"
rm -rf "${PROJECT_DIR}/build/${CONFIGURATION}-iphonesimulator"
fi
# END script for debugLib,releaselib device and simulator