From b523c70355d975a072ac6aee7401bc4854642092 Mon Sep 17 00:00:00 2001 From: Jakub Matys Date: Mon, 28 May 2018 15:22:02 +0200 Subject: [PATCH] Added blockbook-tools package --- Makefile | 7 ++++++- build/bin/Dockerfile | 6 +++++- build/bin/Makefile | 7 +++++++ build/deb/debian/blockbook-tools.install | 2 ++ build/deb/debian/blockbook-tools.links | 2 ++ build/deb/debian/control | 5 +++++ 6 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 build/deb/debian/blockbook-tools.install create mode 100644 build/deb/debian/blockbook-tools.links diff --git a/Makefile b/Makefile index b4ece5dc..a3bd67b3 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,11 @@ test-all: .bin-image deb: .deb-image docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(DEB_IMAGE) +tools: + docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(BIN_IMAGE) make tools + +all: build-images deb + build-images: rm -f .bin-image .deb-image $(MAKE) .bin-image .deb-image @@ -38,7 +43,7 @@ clean: clean-bin clean-deb clean-all: clean clean-images clean-bin: - rm -f build/blockbook + find build -maxdepth 1 -type f -executable -delete clean-deb: rm -f build/*.deb diff --git a/build/bin/Dockerfile b/build/bin/Dockerfile index a84074e2..9b43433a 100644 --- a/build/bin/Dockerfile +++ b/build/bin/Dockerfile @@ -14,6 +14,8 @@ ENV PATH=$PATH:$GOPATH/bin ENV CGO_CFLAGS="-I/opt/rocksdb/include" ENV CGO_LDFLAGS="-L/opt/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4" +RUN mkdir /build + # install and configure go RUN cd /opt && wget https://storage.googleapis.com/golang/$GOLANG_VERSION.tar.gz && \ tar xf $GOLANG_VERSION.tar.gz @@ -24,7 +26,9 @@ RUN echo -n "GOPATH: " && echo $GOPATH # install rocksdb RUN cd /opt && git clone https://github.com/facebook/rocksdb.git -RUN cd /opt/rocksdb && CFLAGS=-fPIC CXXFLAGS=-fPIC make -j 4 static_lib +RUN cd /opt/rocksdb && CFLAGS=-fPIC CXXFLAGS=-fPIC make -j 4 release +RUN strip /opt/rocksdb/ldb /opt/rocksdb/sst_dump && \ + cp /opt/rocksdb/ldb /opt/rocksdb/sst_dump /build RUN go get github.com/golang/dep/cmd/dep diff --git a/build/bin/Makefile b/build/bin/Makefile index 3b29d758..0c2e5ec0 100644 --- a/build/bin/Makefile +++ b/build/bin/Makefile @@ -1,9 +1,12 @@ +SHELL = /bin/bash UPDATE_VENDOR ?= 1 VERSION ?= devel GITCOMMIT = $(shell cd /src && git describe --tags --always --dirty) BUILDTIME = $(shell date --iso-8601=seconds) LDFLAGS := -X blockbook/common.version=$(VERSION) -X blockbook/common.gitcommit=$(GITCOMMIT) -X blockbook/common.buildtime=$(BUILDTIME) +all: build tools + build: prepare-sources cd $(GOPATH)/src/blockbook && go build -o $(CURDIR)/blockbook -ldflags="-s -w $(LDFLAGS)" cp $(CURDIR)/blockbook /out/blockbook @@ -14,6 +17,10 @@ build-debug: prepare-sources cp $(CURDIR)/blockbook /out/blockbook chown $(PACKAGER) /out/blockbook +tools: + cp $(CURDIR)/{ldb,sst_dump} /out + chown $(PACKAGER) /out/{ldb,sst_dump} + test: prepare-sources cd $(GOPATH)/src/blockbook && go test -short ./... diff --git a/build/deb/debian/blockbook-tools.install b/build/deb/debian/blockbook-tools.install new file mode 100644 index 00000000..6dda8cf4 --- /dev/null +++ b/build/deb/debian/blockbook-tools.install @@ -0,0 +1,2 @@ +ldb /opt/coins/blockbook/tools +sst_dump /opt/coins/blockbook/tools diff --git a/build/deb/debian/blockbook-tools.links b/build/deb/debian/blockbook-tools.links new file mode 100644 index 00000000..e72bfe7f --- /dev/null +++ b/build/deb/debian/blockbook-tools.links @@ -0,0 +1,2 @@ +/opt/coins/blockbook/tools/ldb /usr/bin/ldb +/opt/coins/blockbook/tools/sst_dump /usr/bin/sst_dump diff --git a/build/deb/debian/control b/build/deb/debian/control index 424137cf..e4bcf533 100644 --- a/build/deb/debian/control +++ b/build/deb/debian/control @@ -5,6 +5,11 @@ Maintainer: jakub.matys@satoshilabs.com Build-Depends: debhelper, dh-systemd, dh-exec Standards-Version: 3.9.5 +Package: blockbook-tools +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Satoshilabs blockbook server (tools) + Package: blockbook-btc Architecture: amd64 Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, bitcoin-btc