From be1bdf6e3f942a40eb83d3e9082d5227c1e6e01c Mon Sep 17 00:00:00 2001 From: Marek Vavrusa Date: Thu, 26 May 2016 22:34:44 -0700 Subject: [PATCH] build: unbroken Go build checks --- Makefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 935bd2e30..b742b74ea 100644 --- a/Makefile +++ b/Makefile @@ -30,11 +30,17 @@ $(eval $(call find_lib,libdnssec)) $(eval $(call find_lib,libsystemd)) $(eval $(call find_gopkg,geoip,github.com/abh/geoip)) -GO_VERSION := $(shell $(GO) version | sed -e 's/^go version go\([0-9]\)[.]\([0-9]\)[.]\([0-9]\) .*/\1\2/') -GO_PLATFORM := $(shell $(GO) version | sed -e 's,^go version go[0-9.]* linux/,,') - +# Find Go version and platform +GO_VERSION := $(shell $(GO) version 2>/dev/null) +ifeq ($(GO_VERSION),) + GO_VERSION := 0 +else + GO_PLATFORM := $(word 2,$(subst /, ,$(word 4,$(GO_VERSION)))) + GO_VERSION := $(subst .,,$(subst go,,$(word 3,$(GO_VERSION)))) +endif $(eval $(call find_ver,go,$(GO_VERSION),16)) +# Check if Go is able to build shared libraries ifeq ($(HAS_go),yes) ifneq ($(GO_PLATFORM),$(filter $(GO_PLATFORM),amd64 386 arm arm64)) HAS_go := no @@ -42,10 +48,11 @@ endif else $(eval $(call find_ver,go,$(GO_VERSION),15)) ifeq ($HAS_go,yes) -ifneq($(GO_PLATFORM),$(filter $(GO_PLATFORM),arm amd64)) +ifneq ($(GO_PLATFORM),$(filter $(GO_PLATFORM),arm amd64)) HAS_go := no endif endif +endif # Work around luajit on OS X ifeq ($(PLATFORM), Darwin) -- 2.47.2