feat(build):添加UPX压缩支持以减小可执行文件体积

📝 docs:更新README文档,添加Makefile使用说明和UPX压缩说明
🔧 chore:添加Makefile简化构建流程,支持自动UPX压缩
🔧 chore:添加cabal.project.local配置文件优化构建
⬆️ chore:升级项目版本至0.3.0.2
🔧 chore:优化GHC编译选项,启用优化和链接器优化
This commit is contained in:
2026-02-04 17:54:09 +08:00
parent 83d6d79bc4
commit e4b3cebf2b
6 changed files with 115 additions and 3 deletions

View File

@@ -57,6 +57,34 @@ jobs:
run: |
cabal update
cabal build --enable-executable-stripping --disable-debug-info -j2
# 安装 UPX
- name: Install UPX
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
wget https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-amd64_linux.tar.xz
tar -xf upx-5.1.0-amd64_linux.tar.xz
sudo mv upx-5.1.0-amd64_linux/upx /usr/local/bin/
rm -rf upx-5.1.0-amd64_linux*
elif [ "$RUNNER_OS" == "macOS" ]; then
wget https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-arm64_macos.tar.xz
tar -xf upx-5.1.0-arm64_macos.tar.xz
sudo mv upx-5.1.0-arm64_macos/upx /usr/local/bin/
rm -rf upx-5.1.0-arm64_macos*
elif [ "$RUNNER_OS" == "Windows" ]; then
curl -L -o upx.zip https://github.com/upx/upx/releases/download/v5.1.0/upx-5.1.0-win64.zip
unzip -o upx.zip
echo "$PWD/upx-5.1.0-win64" >> $GITHUB_PATH
rm upx.zip
fi
# 使用 UPX 压缩可执行文件
- name: Compress with UPX
shell: bash
run: |
EXE_PATH=$(cabal list-bin quickjump)
upx --best --lzma "$EXE_PATH"
# 提取可执行文件路径
- name: Find Executable