fix(release): create static builds for linux amd64 (#18805)
parent
34ebc852c0
commit
540d5d3113
|
@ -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
|
||||
|
|
|
@ -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
2
xcc.sh
|
@ -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 ;;
|
||||
|
|
Loading…
Reference in New Issue