mirror of https://github.com/q191201771/lal.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.6 KiB
Bash
54 lines
1.6 KiB
Bash
5 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
#set -x
|
||
|
|
||
|
ROOT_DIR=`pwd`
|
||
|
OUT_DIR=release
|
||
|
|
||
|
rm -rf ${ROOT_DIR}/${OUT_DIR}
|
||
|
mkdir -p ${ROOT_DIR}/${OUT_DIR}/linux/bin
|
||
|
mkdir -p ${ROOT_DIR}/${OUT_DIR}/linux/conf
|
||
|
mkdir -p ${ROOT_DIR}/${OUT_DIR}/macos/bin
|
||
|
mkdir -p ${ROOT_DIR}/${OUT_DIR}/macos/conf
|
||
|
mkdir -p ${ROOT_DIR}/${OUT_DIR}/windows/bin
|
||
|
mkdir -p ${ROOT_DIR}/${OUT_DIR}/windows/conf
|
||
|
|
||
|
cp conf/lals.conf.json ${ROOT_DIR}/${OUT_DIR}/linux/conf
|
||
|
cp conf/lals.conf.json ${ROOT_DIR}/${OUT_DIR}/macos/conf
|
||
|
cp conf/lals.conf.json ${ROOT_DIR}/${OUT_DIR}/windows/conf
|
||
|
|
||
|
GitCommitLog=`git log --pretty=oneline -n 1`
|
||
|
# 将 log 原始字符串中的单引号替换成双引号
|
||
|
GitCommitLog=${GitCommitLog//\'/\"}
|
||
|
|
||
|
GitStatus=`git status -s`
|
||
|
BuildTime=`date +'%Y.%m.%d.%H%M%S'`
|
||
|
BuildGoVersion=`go version`
|
||
|
|
||
|
LDFlags=" \
|
||
|
-X 'github.com/q191201771/naza/pkg/bininfo.GitCommitLog=${GitCommitLog}' \
|
||
|
-X 'github.com/q191201771/naza/pkg/bininfo.GitStatus=${GitStatus}' \
|
||
|
-X 'github.com/q191201771/naza/pkg/bininfo.BuildTime=${BuildTime}' \
|
||
|
-X 'github.com/q191201771/naza/pkg/bininfo.BuildGoVersion=${BuildGoVersion}' \
|
||
|
"
|
||
|
|
||
|
export CGO_ENABLED=0
|
||
|
export GOARCH=amd64
|
||
|
|
||
|
echo "build linux..."
|
||
|
export GOOS=linux
|
||
|
cd ${ROOT_DIR}/app/lals && go build -ldflags "$LDFlags" -o ${ROOT_DIR}/${OUT_DIR}/linux/bin/lals
|
||
|
|
||
|
echo "build macos..."
|
||
|
export GOOS=darwin
|
||
|
cd ${ROOT_DIR}/app/lals && go build -ldflags "$LDFlags" -o ${ROOT_DIR}/${OUT_DIR}/macos/bin/lals
|
||
|
|
||
|
echo "build windows..."
|
||
|
export GOOS=windows
|
||
|
cd ${ROOT_DIR}/app/lals && go build -ldflags "$LDFlags" -o ${ROOT_DIR}/${OUT_DIR}/windows/bin/lals
|
||
|
|
||
|
cd ${ROOT_DIR}/${OUT_DIR}
|
||
|
zip -r linux.zip linux
|
||
|
zip -r macos.zip macos
|
||
|
zip -r windows.zip windows
|