加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.sh 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
huhy 提交于 2024-07-12 01:15 . 增加freeBSD的支持
#!/bin/bash
# 默认禁用 UPX 压缩
use_upx=0
# 设置默认构建选项为 release
build_option="release"
# 默认不删除构建目录
clean_up=0
# 获取命令行参数
while [[ "$#" -gt 0 ]]; do
case "$1" in
--enable-upx)
use_upx=1
shift
;;
--show-platforms)
echo "Available platforms:"
echo " - darwin-amd64"
echo " - darwin-arm64"
echo " - windows-amd64"
echo " - windows-arm64"
echo " - linux-amd64"
echo " - linux-arm64"
echo " - freebsd-amd64"
echo " - freebsd-arm64"
exit 0
;;
--development)
build_option="dev"
shift
;;
--release)
build_option="release"
shift
;;
--clean-up)
clean_up=1
shift
;;
*)
echo "Invalid option: $1"
echo "Usage: $0 [--enable-upx] [--show-platforms] [--development | --release] [--clean-up]"
exit 1
;;
esac
done
# 根据指定的构建选项执行相应操作
case $build_option in
dev)
echo "Building (Development)..."
make dev use_upx=$use_upx clean_up=$clean_up
;;
release)
echo "Building and Releasing..."
make release use_upx=$use_upx clean_up=$clean_up
;;
*)
echo "No build option specified or invalid option. Exiting."
echo "Use --development for dev build or --release for release build."
exit 1
;;
esac
echo "Build script finished."
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化