1 APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
2
3find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
4do
5FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
6FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
7echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
8echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")
9
10FRAMEWORK_TMP_PATH="$FRAMEWORK_EXECUTABLE_PATH-tmp"
11
12case "${TARGET_BUILD_DIR}" in
13*"iphonesimulator")
14 echo "No need to remove archs"
15 ;;
16*)
17 if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "i386") ; then
18 lipo -output "$FRAMEWORK_TMP_PATH" -remove "i386" "$FRAMEWORK_EXECUTABLE_PATH"
19 echo "i386 architecture removed"
20 rm "$FRAMEWORK_EXECUTABLE_PATH"
21 mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
22 fi
23 if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "x86_64") ; then
24 lipo -output "$FRAMEWORK_TMP_PATH" -remove "x86_64" "$FRAMEWORK_EXECUTABLE_PATH"
25 echo "x86_64 architecture removed"
26 rm "$FRAMEWORK_EXECUTABLE_PATH"
27 mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
28 fi
29 ;;
30esac
31
32echo "Completed for executable $FRAMEWORK_EXECUTABLE_PATH"
33echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")
34
35done
36