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

40
Makefile Normal file
View File

@@ -0,0 +1,40 @@
.PHONY: all build compress install clean help
all: build compress
build:
cabal build --enable-executable-stripping --disable-debug-info
compress:
@echo "Compressing executable with UPX..."
@EXE_PATH=$$(cabal list-bin quickjump); \
if [ -f "$$EXE_PATH" ]; then \
if command -v upx >/dev/null 2>&1; then \
upx --best --lzma "$$EXE_PATH"; \
echo "Compression complete: $$EXE_PATH"; \
else \
echo "UPX not found. Installing via npx..."; \
npx -y @upx/upx@latest --best --lzma "$$EXE_PATH"; \
echo "Compression complete: $$EXE_PATH"; \
fi \
else \
echo "Error: Executable not found. Please run 'make build' first."; \
exit 1; \
fi
install:
cabal install
clean:
cabal clean
help:
@echo "QuickJump Makefile"
@echo ""
@echo "Available targets:"
@echo " all - Build and compress the executable (default)"
@echo " build - Build the executable with cabal"
@echo " compress - Compress the executable with UPX (uses npx if UPX not installed)"
@echo " install - Install the executable with cabal"
@echo " clean - Clean build artifacts"
@echo " help - Show this help message"