]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
build: unbroken Go build checks
authorMarek Vavrusa <marek@vavrusa.com>
Fri, 27 May 2016 05:34:44 +0000 (22:34 -0700)
committerMarek Vavrusa <marek@vavrusa.com>
Fri, 27 May 2016 05:34:44 +0000 (22:34 -0700)
Makefile

index 935bd2e301f99745732bed4d47f548b818ece301..b742b74ea2b8576fe426f645b023aeae4ce42602 100644 (file)
--- 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)