Browse Source

tools.mk: install protoc

- works only for Linux / Mac 64bit
- you need to call it manually - make protoc
- on Mac, brew install protoc might be favorable
pull/4186/head
Anton Kaliaev 5 years ago
parent
commit
d7d61e9a6c
2 changed files with 31 additions and 17 deletions
  1. +1
    -14
      Makefile
  2. +30
    -3
      tools.mk

+ 1
- 14
Makefile View File

@ -71,19 +71,6 @@ install_abci:
dist:
@BUILD_TAGS=$(BUILD_TAGS) sh -c "'$(CURDIR)/scripts/dist.sh'"
#For ABCI and libs
get_protoc:
@# https://github.com/google/protobuf/releases
curl -L https://github.com/google/protobuf/releases/download/v3.6.1/protobuf-cpp-3.6.1.tar.gz | tar xvz && \
cd protobuf-3.6.1 && \
DIST_LANG=cpp ./configure && \
make && \
make check && \
sudo make install && \
sudo ldconfig && \
cd .. && \
rm -rf protobuf-3.6.1
go-mod-cache: go.sum
@echo "--> Download go modules to local cache"
@go mod download
@ -247,7 +234,7 @@ contract-tests:
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: check build build_race build_abci dist install install_abci check_tools tools update_tools draw_deps \
get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver fmt build-linux localnet-start \
protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver fmt build-linux localnet-start \
localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop protoc_grpc protoc_all \
build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests \
build_c-amazonlinux

+ 30
- 3
tools.mk View File

@ -35,7 +35,7 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd)
###
# tools
# Go tools
###
TOOLS_DESTDIR ?= $(GOPATH)/bin
@ -63,7 +63,7 @@ $(CERTSTRAP):
protobuf: $(PROTOBUF)
$(PROTOBUF):
@echo "Get Protobuf"
@echo "Get GoGo Protobuf"
@go get github.com/gogo/protobuf/protoc-gen-gogo@v1.3.1
# used to build tm-monitor binaries
@ -80,5 +80,32 @@ $(GOODMAN):
tools-clean:
rm -f $(CERTSTRAP) $(PROTOBUF) $(GOX) $(GOODMAN)
rm -f tools-stamp
rm -rf /usr/local/include/google/protobuf
rm -f /usr/local/bin/protoc
###
# Non Go tools
###
# Choose protobuf binary based on OS (only works for 64bit Linux and Mac).
# NOTE: On Mac, installation via brew (brew install protoc) might be favorable.
PROTOC_ZIP=""
ifneq ($(OS),Windows_NT)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
PROTOC_ZIP="protoc-3.10.1-linux-x86_64.zip"
endif
ifeq ($(UNAME_S),Darwin)
PROTOC_ZIP="protoc-3.10.1-osx-x86_64.zip"
endif
endif
protoc:
@echo "Get Protobuf"
@echo "In case of any errors, please install directly from https://github.com/protocolbuffers/protobuf/releases"
@curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.10.1/$(PROTOC_ZIP)
@unzip -o $(PROTOC_ZIP) -d /usr/local bin/protoc
@unzip -o $(PROTOC_ZIP) -d /usr/local 'include/*'
@rm -f $(PROTOC_ZIP)
.PHONY: all tools tools-clean
.PHONY: all tools tools-clean protoc

Loading…
Cancel
Save