mirror of
https://github.com/zhaojh329/rttys.git
synced 2026-02-27 09:53:21 +08:00
978d87ebc1
Use `modernc.org/sqlite` implemented in pure go, so we can building with `CGO_ENABLED=0`. Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
30 lines
529 B
Bash
Executable File
30 lines
529 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 CGO_ENABLED=0 go build -ldflags="-s -w -X $VersionPath.gitCommit=$GitCommit -X $VersionPath.buildTime=$BuildTime" -o $dir/$bin
|
|
}
|
|
|
|
generate $1 $2
|