aboutsummaryrefslogtreecommitdiffstats
path: root/Make.Rules
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2021-09-11 16:13:56 -0700
committerAndrew G. Morgan <morgan@kernel.org>2021-09-11 16:13:56 -0700
commit1dd3fb43123ccf257491c85bb336407f39eaff9d (patch)
tree4f045bd02fa96978946c72eaa0b1e9017026d7ff /Make.Rules
parentfb9b1d69c47af4edd278ab8b08d1f9065afb5e35 (diff)
downloadlibcap-1dd3fb43123ccf257491c85bb336407f39eaff9d.tar.gz
Add in something the builder can override to augment the GO builds
I've been looking at reasons packagers are not building the Go binaries and found this with respect to RPMs: https://github.com/rpm-software-management/rpm/issues/367 There has been no easy way to inject the otherwise unneeded workaround: -ldflags=-linkmode=external for building (which, strangely, generates some sort of warning and gratuitously links glibc to an otherwise static build), but seems to work. Until RPM supports Go's native '.note.go.buildid', and RPM requires '.note.gnu.build-id' on binaries, I guess this can work around it: GO_BUILD_FLAGS='-ldflags=-linkmode=external' Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Diffstat (limited to 'Make.Rules')
-rw-r--r--Make.Rules3
1 files changed, 2 insertions, 1 deletions
diff --git a/Make.Rules b/Make.Rules
index cde6f16..1d34144 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -129,7 +129,7 @@ ifeq ($(GOLANG),yes)
GOROOT ?= $(shell $(GO) env GOROOT)
GOCGO ?= $(shell if [ "$(shell $(GO) env CGO_ENABLED)" = 1 ]; then echo yes ; else echo no ; fi)
GOOSARCH ?= $(shell $(GO) env GOHOSTOS)_$(shell $(GO) env GOHOSTARCH)
-CGO_REQUIRED=$(shell $(topdir)/go/cgo-required.sh $(GO))
+CGO_REQUIRED := $(shell $(topdir)/go/cgo-required.sh $(GO))
ifeq ($(CGO_REQUIRED),1)
# Strictly speaking go1.15 doesn't need this, but 1.16 is when the
# real golang support arrives for non-cgo support, so drop the last
@@ -138,6 +138,7 @@ CGO_LDFLAGS_ALLOW := CGO_LDFLAGS_ALLOW="-Wl,-?-wrap[=,][^-.@][^,]*"
endif
CGO_CFLAGS := -I$(topdir)/libcap/include
CGO_LDFLAGS := -L$(topdir)/libcap
+GO_BUILD_FLAGS :=
endif
endif