pikapika/scripts/thin-payload.sh

25 lines
685 B
Bash

# 精简Payload文件夹 (上传到AppStore会自动区分平台, 此代码仅用于构建非签名ipa)
foreachThin(){
for file in $1/*
do
if test -f $file
then
mime=$(file --mime-type -b $file)
if [ "$mime" == 'application/x-mach-binary' ] || [ "${file##*.}"x = "dylib"x ]
then
echo thin $file
xcrun -sdk iphoneos lipo "$file" -thin arm64 -output "$file"
xcrun -sdk iphoneos bitcode_strip "$file" -r -o "$file"
strip -S -x "$file" -o "$file"
fi
fi
if test -d $file
then
foreachThin $file
fi
done
}
foreachThin ./Payload