Created
October 10, 2020 11:14
-
-
Save dianqk/de8d3d054447cfc84a9e9865ddb182ee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
XCODE_DEVELOPER_PATH="/Applications/Xcode.app/Contents/Developer" | |
thin() | |
{ | |
file=$1 | |
archs=`file $file` | |
if [[ $archs == *"x86_64"* ]]; then | |
if [[ $archs == *"arm64"* ]]; then | |
echo "thin $file" | |
lipo $file -thin x86_64 -output $file | |
fi | |
fi | |
} | |
thin_folder() | |
{ | |
folder=$1 | |
echo "thin_folder $folder" | |
for entry in $folder/* | |
do | |
thin $entry | |
done | |
} | |
thin_usr() | |
{ | |
thin_folder $XCODE_DEVELOPER_PATH/usr/bin | |
thin_folder $XCODE_DEVELOPER_PATH/usr/lib | |
} | |
thin_toochains() | |
{ | |
XcodeDefault_xctoolchain=$XCODE_DEVELOPER_PATH/Toolchains/XcodeDefault.xctoolchain | |
thin_folder $XcodeDefault_xctoolchain/usr/bin | |
thin_folder $XcodeDefault_xctoolchain/usr/metal/ios/bin | |
thin_folder $XcodeDefault_xctoolchain/usr/metal/macos/bin | |
thin_folder $XcodeDefault_xctoolchain/usr/lib | |
thin_folder $XcodeDefault_xctoolchain/usr/lib/sourcekitd.framework/Versions/Current/ | |
} | |
rm_platform() | |
{ | |
rm -rf $XCODE_DEVELOPER_PATH/Platforms/AppleTVSimulator.platform | |
rm -rf $XCODE_DEVELOPER_PATH/Platforms/AppleTVOS.platform | |
rm -rf $XCODE_DEVELOPER_PATH/Platforms/WatchSimulator.platform | |
rm -rf $XCODE_DEVELOPER_PATH/Platforms/WatchOS.platform | |
} | |
thin_ios_platform() | |
{ | |
RuntimeRoot=$XCODE_DEVELOPER_PATH/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot | |
for entry in $RuntimeRoot/System/Library/PrivateFrameworks/*.framework | |
do | |
thin_folder $entry | |
done | |
for entry in $RuntimeRoot/System/Library/Frameworks/*.framework | |
do | |
thin_folder $entry | |
done | |
} | |
thin_usr | |
thin_toochains | |
rm_platform | |
thin_ios_platform |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
青总🐂🍺!