build: add windows to cross-build (#21109)

pull/21128/head
Daniel Moran 2021-03-31 18:52:20 -04:00 committed by GitHub
parent 4237dda205
commit 61d1ee45b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 5 deletions

View File

@ -204,6 +204,7 @@ commands:
libxml2-dev \
llvm-dev \
lzma-dev \
mingw-w64 \
zlib1g-dev
- run:
name: Install cross-compilers
@ -242,10 +243,12 @@ commands:
rustup target add \
x86_64-unknown-linux-musl \
aarch64-unknown-linux-musl \
x86_64-apple-darwin
x86_64-apple-darwin \
x86_64-pc-windows-gnu
echo 'export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=/usr/local/musl/bin/musl-gcc' >> $BASH_ENV
echo 'export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/usr/local/musl-cross/bin/aarch64-unknown-linux-musl-gcc' >> $BASH_ENV
echo 'export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=/usr/local/osxcross/target/bin/x86_64-apple-darwin15-clang' >> $BASH_ENV
echo 'export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=/usr/bin/x86_64-w64-mingw32-gcc' >> $BASH_ENV
- run:
name: Install goreleaser
environment:

View File

@ -4,15 +4,19 @@ builds:
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ignore:
- goos: darwin
goarch: arm64
- goos: windows
goarch: arm64
main: ./cmd/influx/
flags:
- -tags={{if eq .Os "linux"}}osusergo,netgo,static_build{{if not (eq .Arch "amd64")}},noasm{{end}}{{end}}
- -buildmode={{if eq .Os "windows"}}exe{{else}}pie{{end}}
env:
- GO111MODULE=on
- CGO_ENABLED=1
@ -27,15 +31,19 @@ builds:
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ignore:
- goos: darwin
goarch: arm64
- goos: windows
goarch: arm64
main: ./cmd/influxd/
flags:
- -tags=assets{{if eq .Os "linux"}},osusergo,netgo,static_build{{if not (eq .Arch "amd64")}},noasm{{end}}{{end}}
- -buildmode={{if eq .Os "windows"}}exe{{else}}pie{{end}}
env:
- GO111MODULE=on
- CGO_ENABLED=1
@ -87,6 +95,9 @@ archives:
- id: influx_only
builds: ["influx"]
format: tar.gz
format_overrides:
- goos: windows
format: zip
wrap_in_directory: true
name_template: "influxdb2-client-nightly-{{ .Os }}-{{ .Arch }}"
files:
@ -94,6 +105,9 @@ archives:
- README.md
- id: influx_and_influxd
format: tar.gz
format_overrides:
- goos: windows
format: zip
wrap_in_directory: true
name_template: "influxdb2-nightly-{{ .Os }}-{{ .Arch }}"
files:

View File

@ -1,5 +1,9 @@
## unreleased
### Windows Support
This release includes our initial Windows preview build.
### Breaking Changes
#### /debug/vars removed

2
go.mod
View File

@ -50,7 +50,7 @@ require (
github.com/influxdata/flux v0.111.0
github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6
github.com/influxdata/pkg-config v0.2.6
github.com/influxdata/pkg-config v0.2.7
github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368
github.com/jessevdk/go-flags v1.4.0
github.com/jsternberg/zap-logfmt v1.2.0

2
go.sum
View File

@ -340,6 +340,8 @@ github.com/influxdata/nats-streaming-server v0.11.3-0.20201112040610-c277f756080
github.com/influxdata/nats-streaming-server v0.11.3-0.20201112040610-c277f7560803/go.mod h1:qgAMR6M9EokX+R5X7jUQfubwBdS1tBIl4yVJ3shhcWk=
github.com/influxdata/pkg-config v0.2.6 h1:GQFKw3m3OmmPMze9n75ZVVtNu4LJ2MJolHbxvg4AAvg=
github.com/influxdata/pkg-config v0.2.6/go.mod h1:EMS7Ll0S4qkzDk53XS3Z72/egBsPInt+BeRxb0WeSwk=
github.com/influxdata/pkg-config v0.2.7 h1:LPTCWmcPkyMryHHnf+STK/zVUjQ6OCvvOukSDlJLY9I=
github.com/influxdata/pkg-config v0.2.7/go.mod h1:EMS7Ll0S4qkzDk53XS3Z72/egBsPInt+BeRxb0WeSwk=
github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8=
github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b h1:i44CesU68ZBRvtCjBi3QSosCIKrjmMbYlQMFAwVLds4=
github.com/influxdata/tdigest v0.0.2-0.20210216194612-fc98d27c9e8b/go.mod h1:Z0kXnxzbTC2qrx4NaIzYkE1k66+6oEDQTvL95hQFh5Y=

View File

@ -9,9 +9,10 @@ GOOS=${GOOS:-$(go env GOOS)}
GOARCH=${GOARCH:-$(go env GOARCH)}
case "${GOOS}_${GOARCH}" in
linux_amd64) CC=musl-gcc ;;
linux_arm64) CC=aarch64-unknown-linux-musl-gcc ;;
darwin_amd64) CC=x86_64-apple-darwin15-clang ;;
linux_amd64) CC=musl-gcc ;;
linux_arm64) CC=aarch64-unknown-linux-musl-gcc ;;
darwin_amd64) CC=x86_64-apple-darwin15-clang ;;
windows_amd64) CC=x86_64-w64-mingw32-gcc ;;
*) die "No cross-compiler set for ${GOOS}_${GOARCH}" ;;
esac