From 15ed497b84e7f3ebe265f52c8f45839e332905c6 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Mon, 15 Oct 2018 10:38:00 +0800 Subject: misc: Use prebuild bls docker image. (#199) --- GNUmakefile | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'GNUmakefile') diff --git a/GNUmakefile b/GNUmakefile index bbf6c9f..819519e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -7,6 +7,8 @@ else BINDIR := $(abspath $(BINDIR)) endif PROJECT_ROOT=github.com/dexon-foundation/dexon-consensus-core +BLS_REPO = spiderpowa/bls-go-alpine +BLS_LIB = vendor/github.com/Spiderpowa/bls/lib/libbls384.a BUILDER_REPO = dexonfoundation/dexon-alpine ifeq ($(DOCKER),true) @@ -25,14 +27,16 @@ define BUILD_RULE $1: pre-build ifeq ($(DOCKER),true) $(AT_DOCKER_GO)docker run --rm \ + -v BLSDATA:/data/bls \ -v "$(GOPATH)":/go:z \ -v $(BINDIR):/artifacts:z \ -e "GOPATH=/go" \ -w /go/src/$(PROJECT_ROOT) \ $(BUILDER_REPO):latest sh -c "\ - cd .dep/dkg/mcl && make clean; cd -; \ - cd .dep/dkg/bls && make clean && make test_go DOCKER=alpine -j; cd -; \ - go build -o /artifacts/$1 $(PROJECT_ROOT)/cmd/$1" + mv -f $(BLS_LIB) $(BLS_LIB).bak; \ + cp /data/bls/libbls384.a $(BLS_LIB) ;\ + go build -o /artifacts/$1 $(PROJECT_ROOT)/cmd/$1; \ + mv -f $(BLS_LIB).bak $(BLS_LIB)" else @mkdir -p $(BINDIR) $(AT_LOCAL_GO)go install -ldflags '$(GO_LDFLAGS)' $(PROJECT_ROOT)/cmd/$1 @@ -50,10 +54,13 @@ COMPONENTS = \ default: all all: $(COMPONENTS) +ifeq ($(DOCKER),true) + @docker volume rm BLSDATA > /dev/null +endif $(foreach component, $(COMPONENTS), $(eval $(call BUILD_RULE,$(component)))) -pre-build: dep +pre-build: dep docker-dep pre-submit: dep check-format lint test vet @@ -61,6 +68,12 @@ dep: @bin/install_eth_dep.sh @bin/install_dkg_dep.sh +docker-dep: +ifeq ($(DOCKER),true) + @docker run --rm -v BLSDATA:/data/bls $(BLS_REPO):latest \ + sh -c "cp -f /usr/lib/libbls384.a /data/bls/" +endif + format: @go fmt `go list ./... | grep -v 'vendor'` -- cgit v1.2.3