fix(release): create static builds for linux amd64 (#18805)

pull/18832/head
Jonathan A. Sternberg 2020-07-01 12:45:54 -05:00 committed by GitHub
parent 34ebc852c0
commit 540d5d3113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View File

@ -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: |
@ -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

View File

@ -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:
@ -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

2
xcc.sh
View File

@ -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 ;;