mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #17418 from ArkaSaha30/configure_cgo
Make CGO_ENABLED configurable
This commit is contained in:
commit
a7d5a9e42c
@ -13,10 +13,12 @@ GOARCH=${GOARCH:-$(go env GOARCH)}
|
||||
|
||||
GO_BUILD_FLAGS=${GO_BUILD_FLAGS:-}
|
||||
|
||||
CGO_ENABLED="${CGO_ENABLED:-0}"
|
||||
|
||||
# Set GO_LDFLAGS="-s" for building without symbols for debugging.
|
||||
# shellcheck disable=SC2206
|
||||
GO_LDFLAGS=(${GO_LDFLAGS:-} "-X=${VERSION_SYMBOL}=${GIT_SHA}")
|
||||
GO_BUILD_ENV=("CGO_ENABLED=0" "GO_BUILD_FLAGS=${GO_BUILD_FLAGS}" "GOOS=${GOOS}" "GOARCH=${GOARCH}")
|
||||
GO_BUILD_ENV=("CGO_ENABLED=${CGO_ENABLED}" "GO_BUILD_FLAGS=${GO_BUILD_FLAGS}" "GOOS=${GOOS}" "GOARCH=${GOARCH}")
|
||||
|
||||
etcd_build() {
|
||||
out="bin"
|
||||
@ -80,7 +82,7 @@ tools_build() {
|
||||
echo "Building" "'${tool}'"...
|
||||
run rm -f "${out}/${tool}"
|
||||
# shellcheck disable=SC2086
|
||||
run env GO_BUILD_FLAGS="${GO_BUILD_FLAGS}" CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} \
|
||||
run env GO_BUILD_FLAGS="${GO_BUILD_FLAGS}" CGO_ENABLED=${CGO_ENABLED} go build ${GO_BUILD_FLAGS} \
|
||||
-trimpath \
|
||||
-installsuffix=cgo \
|
||||
"-ldflags=${GO_LDFLAGS[*]}" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user