mirror of
https://github.com/zhaojh329/rttys.git
synced 2026-02-27 09:53:21 +08:00
30 lines
515 B
Bash
Executable File
30 lines
515 B
Bash
Executable File
#!/bin/sh
|
|
|
|
VersionPath="rttys/version"
|
|
GitCommit=$(git log --pretty=format:"%h" -1)
|
|
BuildTime=$(date +%FT%T%z)
|
|
|
|
[ $# -lt 2 ] && {
|
|
echo "Usage: $0 linux amd64"
|
|
exit 1
|
|
}
|
|
|
|
generate() {
|
|
local os="$1"
|
|
local arch="$2"
|
|
local dir="rttys-$os-$arch"
|
|
local bin="rttys"
|
|
|
|
rm -rf $dir
|
|
mkdir $dir
|
|
cp rttys.conf $dir
|
|
|
|
[ "$os" = "windows" ] && {
|
|
bin="rttys.exe"
|
|
}
|
|
|
|
GOOS=$os GOARCH=$arch go build -ldflags="-s -w -X $VersionPath.gitCommit=$GitCommit -X $VersionPath.buildTime=$BuildTime" -o $dir/$bin
|
|
}
|
|
|
|
generate $1 $2
|