From: Marek Vavrusa Date: Fri, 27 May 2016 05:34:44 +0000 (-0700) Subject: build: unbroken Go build checks X-Git-Tag: v1.0.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be1bdf6e3f942a40eb83d3e9082d5227c1e6e01c;p=thirdparty%2Fknot-resolver.git build: unbroken Go build checks --- 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)