Skip to content

Commit 2691e1d

Browse files
committed
fix: 修复Action中关于linux的编译
1 parent ae6dcff commit 2691e1d

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,20 @@ jobs:
328328
sudo apt-get update
329329
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
330330
sudo apt-get install -y libgl1-mesa-dev xorg-dev
331+
332+
# 为 ARM64 交叉编译安装必要的库
333+
if [ "${{ matrix.arch }}" == "arm64" ]; then
334+
sudo dpkg --add-architecture arm64
335+
sudo apt-get update
336+
sudo apt-get install -y \
337+
libgl1-mesa-dev:arm64 \
338+
libx11-dev:arm64 \
339+
libxrandr-dev:arm64 \
340+
libxxf86vm-dev:arm64 \
341+
libxi-dev:arm64 \
342+
libxcursor-dev:arm64 \
343+
libxinerama-dev:arm64
344+
fi
331345
332346
- name: Configure Git for Private Modules
333347
run: |
@@ -458,6 +472,23 @@ jobs:
458472
if [[ "$file" == *.tar.gz ]]; then
459473
# macOS app 需要解压后压缩二进制
460474
echo "正在处理 macOS app: $file"
475+
tar -xzf "$file"
476+
477+
# 查找并压缩 macOS 可执行文件
478+
if [ -d ecs-gui.app/Contents/MacOS ]; then
479+
for binary in ecs-gui.app/Contents/MacOS/*; do
480+
if [ -f "$binary" ] && [ -x "$binary" ]; then
481+
echo "正在压缩 macOS 二进制: $binary"
482+
upx --best --lzma "$binary" || echo "警告: $binary 压缩失败"
483+
fi
484+
done
485+
fi
486+
487+
# 重新打包
488+
rm "$file"
489+
tar -czf "$file" ecs-gui.app
490+
rm -rf ecs-gui.app
491+
echo "压缩后大小: $(du -h "$file")"
461492
elif [[ "$file" == *.tar.xz ]]; then
462493
# Linux app 需要解压后压缩二进制
463494
echo "正在处理 Linux app: $file"
@@ -477,23 +508,6 @@ jobs:
477508
tar -cJf "$file" -C ecs-gui-extracted .
478509
rm -rf ecs-gui-extracted
479510
echo "压缩后大小: $(du -h "$file")"
480-
tar -xzf "$file"
481-
482-
# 查找并压缩 macOS 可执行文件
483-
if [ -d ecs-gui.app/Contents/MacOS ]; then
484-
for binary in ecs-gui.app/Contents/MacOS/*; do
485-
if [ -f "$binary" ] && [ -x "$binary" ]; then
486-
echo "正在压缩 macOS 二进制: $binary"
487-
upx --best --lzma "$binary" || echo "警告: $binary 压缩失败"
488-
fi
489-
done
490-
fi
491-
492-
# 重新打包
493-
rm "$file"
494-
tar -czf "$file" ecs-gui.app
495-
rm -rf ecs-gui.app
496-
echo "压缩后大小: $(du -h "$file")"
497511
fi
498512
fi
499513
done

0 commit comments

Comments
 (0)