chore(go-task): support freebsd、windows build

support freebsd、windows build

Signed-off-by: kovacs <mritd@linux.com>
This commit is contained in:
kovacs 2022-12-09 14:20:48 +08:00
parent cceba2ab79
commit 067f3b5c6c
2 changed files with 106 additions and 4 deletions

3
.gitignore vendored
View file

@ -184,5 +184,6 @@ hy_linux
.vscode
/build/
/dist/
config*.json
config*.json

View file

@ -5,19 +5,25 @@ tasks:
cmds:
- rm -rf dist
- mkdir -p dist
hash:
dir: ./dist
cmds:
- sha256sum hysteria-* > hashes.txt
build-hysteria:
label: build-{{.TASK}}
vars:
BUILD_VERSION:
sh: git describe --tags
BUILD_COMMIT:
sh: git rev-parse HEAD
BUILD_DATE:
sh: date "+%Y%m%d%H%M%S"
sh: date -u '+%F %T'
dir: ./app/cmd/
cmds:
- |
GOOS={{.GOOS}} GOARCH={{.GOARCH}} GOARM={{.GOARM}} GOMIPS={{.GOMIPS}} \
GOOS={{.GOOS}} GOARCH={{.GOARCH}} GOARM={{.GOARM}} GOAMD64={{.GOAMD64}} GOMIPS={{.GOMIPS}} \
go build -trimpath -o ../../dist/hysteria-{{.TASK}} -ldflags \
"-w -s -X main.appCommit={{.BUILD_COMMIT}} -X main.appDate={{.BUILD_DATE}}"
"-w -s -X 'main.appVersion={{.BUILD_VERSION}}' -X 'main.appCommit={{.BUILD_COMMIT}}' -X 'main.appDate={{.BUILD_DATE}}'"
linux-386:
cmds:
- task: build-hysteria
@ -129,6 +135,15 @@ tasks:
GOOS: darwin,
GOARCH: amd64
}
darwin-amd64-v3:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: darwin,
GOARCH: amd64,
GOAMD64: v3
}
darwin-arm64:
cmds:
- task: build-hysteria
@ -137,6 +152,80 @@ tasks:
GOOS: darwin,
GOARCH: arm64
}
freebsd-386:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: 386
}
freebsd-amd64:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: amd64
}
freebsd-amd64-v3:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: amd64,
GOAMD64: v3
}
freebsd-arm:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: arm
}
freebsd-arm64:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}",
GOOS: freebsd,
GOARCH: arm64
}
windows-386:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}.exe",
GOOS: windows,
GOARCH: 386
}
windows-amd64:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}.exe",
GOOS: freebsd,
GOARCH: amd64
}
windows-amd64-v3:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}.exe",
GOOS: freebsd,
GOARCH: amd64,
GOAMD64: v3
}
windows-arm64:
cmds:
- task: build-hysteria
vars: {
TASK: "{{.TASK}}.exe",
GOOS: freebsd,
GOARCH: arm64
}
default:
cmds:
- task: clean
@ -153,4 +242,16 @@ tasks:
- task: linux-mips64
- task: linux-mips64le
- task: darwin-amd64
- task: darwin-amd64-v3
- task: darwin-arm64
- task: freebsd-386
- task: freebsd-amd64
- task: freebsd-amd64-v3
- task: freebsd-arm
- task: freebsd-arm64
- task: windows-386
- task: windows-amd64
- task: windows-amd64-v3
- task: windows-arm64
- task: hash