PKGBUILDs/community/consul/consul-ldflags.patch
2019-06-29 20:32:55 +00:00

31 lines
1.4 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 2019-05-08 20:34:08.000000000 +0200
+++ c/build-support/functions/20-build.sh 2019-05-09 10:39:50.420779679 +0200
@@ -453,7 +453,7 @@ function build_consul_local {
if [ $os == "windows" ];then
binname="consul.exe"
fi
- CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} go install -ldflags "${GOLDFLAGS}" -tags "${GOTAGS}" && cp "${MAIN_GOPATH}/bin/${GOBIN_EXTRA}${binname}" "${outdir}/${binname}"
+ 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 2019-05-09 10:38:41.960775825 +0200
+++ c/GNUmakefile 2019-05-09 10:39:15.477444378 +0200
@@ -22,6 +22,7 @@ GOPATH=$(shell go env GOPATH)
ASSETFS_PATH?=agent/bindata_assetfs.go
GOLDFLAGS=
+EXTLDFLAGS := ${LDFLAGS}
ifeq ($(FORCE_REBUILD),1)
NOCACHE=--no-cache
@@ -90,6 +91,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