Skip to content

Commit

Permalink
fix(release): create static builds for linux amd64 (influxdata#18805)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsternberg authored Jul 1, 2020
1 parent 34ebc85 commit 540d5d3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ commands:
steps:
- run:
name: Install clang
command: sudo apt-get install -y --no-install-recommends clang
command: sudo apt-get install -y --no-install-recommends clang musl-tools
- run:
name: Install rust compiler
command: |
Expand Down Expand Up @@ -42,7 +42,8 @@ commands:
- run:
name: Install additional rust targets
command: |
rustup target add aarch64-unknown-linux-gnu \
rustup target add x86_64-unknown-linux-musl \
aarch64-unknown-linux-gnu \
arm-unknown-linux-gnueabihf \
armv7-unknown-linux-gnueabihf \
x86_64-apple-darwin
Expand Down
10 changes: 7 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ builds:
- amd64
- arm64
main: ./cmd/influx/
flags:
- -tags={{if and (eq .Os "linux") (eq .Arch "amd64")}}osusergo,netgo,static_build{{end}}
env:
- GO111MODULE=on
- CGO_ENABLED=1
- CC=xcc
- PKG_CONFIG=$GOPATH/bin/pkg-config
- MACOSX_DEPLOYMENT_TARGET=10.11
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if and (eq .Os "linux") (eq .Arch "amd64")}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}}
binary: influx
- id: influxd
goos:
Expand All @@ -25,14 +28,15 @@ builds:
- arm64
main: ./cmd/influxd/
flags:
- -tags=assets
- -tags=assets{{if and (eq .Os "linux") (eq .Arch "amd64")}},osusergo,netgo,static_build{{end}}
env:
- GO111MODULE=on
- CGO_ENABLED=1
- CC=xcc
- PKG_CONFIG=$GOPATH/bin/pkg-config
- MACOSX_DEPLOYMENT_TARGET=10.11
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if and (eq .Os "linux") (eq .Arch "amd64")}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}}
binary: influxd
hooks:
pre: make generate
Expand Down
2 changes: 1 addition & 1 deletion xcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GOOS=${GOOS:-$(go env GOOS)}
GOARCH=${GOARCH:-$(go env GOARCH)}

case "${GOOS}_${GOARCH}" in
linux_amd64) CC=clang ;;
linux_amd64) CC=musl-gcc ;;
linux_arm64) CC=aarch64-linux-gnu-gcc ;;
linux_arm) CC=arm-linux-gnueabihf-gcc ;;
darwin_amd64) CC=/opt/osxcross/target/bin/o64-clang ;;
Expand Down

0 comments on commit 540d5d3

Please sign in to comment.