aboutsummaryrefslogtreecommitdiffstats
path: root/GNUmakefile
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-10-15 10:38:00 +0800
committerGitHub <noreply@github.com>2018-10-15 10:38:00 +0800
commit15ed497b84e7f3ebe265f52c8f45839e332905c6 (patch)
tree11fbdd14983d9b3ef93f94fbff60339acc6e2697 /GNUmakefile
parentc636088a657b81b2baff6fa5cc72eaaeb2b817e2 (diff)
downloadtangerine-consensus-15ed497b84e7f3ebe265f52c8f45839e332905c6.tar
tangerine-consensus-15ed497b84e7f3ebe265f52c8f45839e332905c6.tar.gz
tangerine-consensus-15ed497b84e7f3ebe265f52c8f45839e332905c6.tar.bz2
tangerine-consensus-15ed497b84e7f3ebe265f52c8f45839e332905c6.tar.lz
tangerine-consensus-15ed497b84e7f3ebe265f52c8f45839e332905c6.tar.xz
tangerine-consensus-15ed497b84e7f3ebe265f52c8f45839e332905c6.tar.zst
tangerine-consensus-15ed497b84e7f3ebe265f52c8f45839e332905c6.zip
misc: Use prebuild bls docker image. (#199)
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile21
1 files changed, 17 insertions, 4 deletions
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'`