PKGBUILDs/community/consul/consul-ldflags.patch

30 lines
1.4 KiB
Diff
Raw Normal View History

2019-03-01 13:52:37 +00:00
--- a/GNUmakefile 2018-11-14 23:37:47.000000000 +0100
+++ b/GNUmakefile 2019-01-08 15:44:48.494251517 +0100
@@ -29,6 +29,7 @@ GIT_DIRTY?=$(shell test -n "`git status
GIT_DESCRIBE?=$(shell git describe --tags --always)
GIT_IMPORT=github.com/hashicorp/consul/version
GOLDFLAGS=-X $(GIT_IMPORT).GitCommit=$(GIT_COMMIT)$(GIT_DIRTY) -X $(GIT_IMPORT).GitDescribe=$(GIT_DESCRIBE)
+EXTLDFLAGS := ${LDFLAGS}
ifeq ($(FORCE_REBUILD),1)
NOCACHE=--no-cache
@@ -98,6 +99,7 @@ export GIT_DIRTY
export GIT_DESCRIBE
export GOTAGS
export GOLDFLAGS
+export EXTLDFLAGS
DEV_PUSH?=0
--- a/build-support/functions/20-build.sh 2018-11-14 23:37:47.000000000 +0100
+++ b/build-support/functions/20-build.sh 2019-01-08 15:03:55.598451424 +0100
@@ -468,7 +468,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}"