trim.sh 638 B

123456789101112131415161718192021222324
  1. #! /usr/bin/env bash
  2. FRAMEWORK=$1
  3. echo "Trimming $FRAMEWORK..."
  4. FRAMEWORK_EXECUTABLE_PATH="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/$FRAMEWORK.framework/$FRAMEWORK"
  5. EXTRACTED_ARCHS=()
  6. for ARCH in $ARCHS
  7. do
  8. echo "Extracting $ARCH..."
  9. lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
  10. EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
  11. done
  12. echo "Merging binaries..."
  13. lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
  14. rm "${EXTRACTED_ARCHS[@]}"
  15. rm "$FRAMEWORK_EXECUTABLE_PATH"
  16. mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
  17. echo "Done."