Add GOPATH check to Makefile (#995)

This commit is contained in:
Ivan Daniluk 2018-06-14 13:28:09 +02:00 committed by GitHub
parent e81ef9e9d5
commit 5f0768472f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -9,6 +9,22 @@ ifndef GOPATH
For more information about the GOPATH environment variable, see https://golang.org/doc/code.html#GOPATH) For more information about the GOPATH environment variable, see https://golang.org/doc/code.html#GOPATH)
endif endif
EXPECTED_PATH=$(shell go env GOPATH)/src/github.com/status-im/status-go
ifneq ($(CURDIR),$(EXPECTED_PATH))
define NOT_IN_GOPATH_ERROR
Current dir is $(CURDIR), which seems to be different from your GOPATH.
Please, build status-go from GOPATH for proper build.
GOPATH = $(shell go env GOPATH)
Current dir = $(CURDIR)
Expected dir = $(EXPECTED_PATH))
See https://golang.org/doc/code.html#GOPATH for more info
endef
$(error $(NOT_IN_GOPATH_ERROR))
endif
CGO_CFLAGS=-I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin CGO_CFLAGS=-I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin
GOBIN=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin GOBIN=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))build/bin
GIT_COMMIT := $(shell git rev-parse --short HEAD) GIT_COMMIT := $(shell git rev-parse --short HEAD)
@ -80,6 +96,12 @@ statusgo-cross: statusgo-android statusgo-ios
@echo "Full cross compilation done." @echo "Full cross compilation done."
@ls -ld $(GOBIN)/statusgo-* @ls -ld $(GOBIN)/statusgo-*
statusgo-linux: xgo ##@cross-compile Build status-go for Linux
./_assets/patches/patcher -b . -p geth-xgo
$(GOPATH)/bin/xgo --image $(XGOIMAGE) --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=linux/amd64 -v -tags '$(BUILD_TAGS)' $(BUILD_FLAGS) ./cmd/statusd
./_assets/patches/patcher -b . -p geth-xgo -r
@echo "Android cross compilation done."
statusgo-android: xgo ##@cross-compile Build status-go for Android statusgo-android: xgo ##@cross-compile Build status-go for Android
./_assets/patches/patcher -b . -p geth-xgo ./_assets/patches/patcher -b . -p geth-xgo
$(GOPATH)/bin/xgo --image $(XGOIMAGE) --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v -tags '$(BUILD_TAGS)' $(BUILD_FLAGS) ./lib $(GOPATH)/bin/xgo --image $(XGOIMAGE) --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v -tags '$(BUILD_TAGS)' $(BUILD_FLAGS) ./lib