perf: 构建工具调整

This commit is contained in:
TsMask
2025-03-18 10:08:59 +08:00
parent a27e1d243c
commit d6e42ce4f5
215 changed files with 184 additions and 6015 deletions

45
pkg.sh
View File

@@ -1,35 +1,66 @@
#!/bin/bash
# 前端目录
WebDir=../web
BuildWeb=""
# 当前目录
RootDir=${pwd}
# 默认版本值
VERSION="1.0.0"
VERSION="2.2503.2"
# usage
usage() {
echo "Usage: bash $0 [OPTION]"
echo
echo "Build Software Package OPTION:"
echo " -v Specify the version"
echo " -web Build Web ($WebDir)"
echo " -h Display this help message"
echo
exit 1
}
# 读取命令行参数
# Read command line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-v) VERSION="$2"; shift 2 ;; # 处理 -v 后面的版本
-v) VERSION="$2"; shift 2 ;;
-web) BuildWeb="build"; shift ;;
*) usage ;;
esac
done
# ===================
echo
# 构建可执行文件
# Determine if -web is passed in
if [ -n "$BuildWeb" ]; then
cd $WebDir
npm install --registry https://registry.npmmirror.com
npm run build
rm -rf /build/linux/usr/local/etc/omc/web
cp -rf dist /build/linux/usr/local/etc/omc/web
echo "web build dist copy to /build/linux/usr/local/etc/omc/web"
fi
cd $RootDir
# ===================
echo
cd ./sshsvc
make
cp -rf sshsvc ./build/linux/usr/local/bin/sshsvc
echo "go build sshsvc copy to /build/linux/usr/local/bin"
# ===================
echo
MOD_CONFIG="be.ems/src/framework/config"
go build -o omc -v -ldflags "-s -w -X '$MOD_CONFIG.Version=$VERSION' -X '$MOD_CONFIG.BuildTime=$(date)' -X '$MOD_CONFIG.GoVer=$(go version)'"
cp -rf omc ./build/linux/usr/local/bin/omc
echo "go build omc copy to /build/linux/usr/local/bin"
# ===================
echo
# 进行构建包管理
echo
bash ./build/build.sh -v $VERSION