feat: clean up temporary file generated by build

清理构建产生的临时文件
优化strip脚本

Log:
This commit is contained in:
myml 2024-01-29 10:56:09 +08:00 committed by black-desk
parent 896d544d42
commit f6748ad4a2
1 changed files with 8 additions and 7 deletions

View File

@ -6,20 +6,20 @@
#binary strip script
if [ ! -f $(command -v eu-strip) ]; then
if [ ! -f "$(command -v eu-strip)" ]; then
echo "can not found eu-strip"
exit 1;
fi
#find binaries
find ${PREFIX} -type f '(' -perm -111 -o -name '*.so*' -o -name '*.cmxs' \
find "${PREFIX}" -type f '(' -perm -111 -o -name '*.so*' -o -name '*.cmxs' \
-o -name '*.node' ')' \
-not -path "${PREFIX}/debug/*" \
> binaries
for binary in `cat binaries`;do
while IFS= read -r binary; do
#skip stripped binary
if [ "`file $binary|grep "ELF"|grep "not stripped"`" == "" ]; then
if [ "$(file "$binary"|grep ELF|grep 'not stripped')" == "" ]; then
continue
fi
@ -31,7 +31,8 @@ destPath=${PREFIX}/debug/$subPath
extName=".debug"
debugFileName=$binaryName${extName}
mkdir -p $destPath
mkdir -p "$destPath"
echo "strip $binary to $destPath/$debugFileName"
eu-strip $binary -f $destPath/$debugFileName
done
eu-strip "$binary" -f "$destPath/$debugFileName"
done < binaries
rm binaries