aur.open-consul/consul-ldflags.patch

32 lines
1.5 KiB
Diff

diff -upr b/build-support/functions/20-build.sh c/build-support/functions/20-build.sh
--- b/build-support/functions/20-build.sh 2020-03-04 10:15:04.066148196 +0100
+++ c/build-support/functions/20-build.sh 2020-03-04 10:13:54.354670580 +0100
@@ -458,7 +458,7 @@ function build_consul_local {
if [ $os == "windows" ];then
binname="consul.exe"
fi
- debug_run env CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} go install -ldflags "${GOLDFLAGS}" -tags "${GOTAGS}" && cp "${MAIN_GOPATH}/bin/${GOBIN_EXTRA}${binname}" "${outdir}/${binname}"
+ debug_run env CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} go install -ldflags "-linkmode external -extldflags ${EXTLDFLAGS} -s -w ${GOLDFLAGS}" -tags "${GOTAGS}" && cp "${MAIN_GOPATH}/bin/${GOBIN_EXTRA}${binname}" "${outdir}/${binname}"
if test $? -ne 0
then
err "ERROR: Failed to build Consul for ${osarch}"
diff -upr b/GNUmakefile c/GNUmakefile
--- b/GNUmakefile 2020-03-04 10:14:46.245770467 +0100
+++ c/GNUmakefile 2020-03-04 10:15:32.286746368 +0100
@@ -17,6 +17,7 @@ MAIN_GOPATH=$(shell go env GOPATH | cut
ASSETFS_PATH?=agent/bindata_assetfs.go
GOLDFLAGS=
+EXTLDFLAGS := ${LDFLAGS}
PROTOFILES?=$(shell find . -name '*.proto' | grep -v 'vendor/')
PROTOGOFILES=$(PROTOFILES:.proto=.pb.go)
@@ -120,6 +121,7 @@ export GIT_DIRTY
export GIT_DESCRIBE
export GOTAGS
export GOLDFLAGS
+export EXTLDFLAGS
# Allow skipping docker build during integration tests in CI since we already
# have a built binary