[feature] add option to build portable binaries (#685)
Co-authored-by: Martin <martin.boehm@1mbsoftware.net>
This commit is contained in:
parent
5802a43169
commit
fb7a71034b
3
Makefile
3
Makefile
@ -4,6 +4,7 @@ PACKAGER = $(shell id -u):$(shell id -g)
|
||||
BASE_IMAGE = $$(awk -F= '$$1=="ID" { print $$2 ;}' /etc/os-release):$$(awk -F= '$$1=="VERSION_ID" { print $$2 ;}' /etc/os-release | tr -d '"')
|
||||
NO_CACHE = false
|
||||
TCMALLOC =
|
||||
PORTABLE = 0
|
||||
ARGS ?=
|
||||
|
||||
TARGETS=$(subst .json,, $(shell ls configs/coins))
|
||||
@ -46,7 +47,7 @@ build-images: clean-images
|
||||
.bin-image:
|
||||
@if [ $$(build/tools/image_status.sh $(BIN_IMAGE):latest build/docker) != "ok" ]; then \
|
||||
echo "Building image $(BIN_IMAGE) from $(BASE_IMAGE)"; \
|
||||
docker build --no-cache=$(NO_CACHE) --build-arg TCMALLOC=$(TCMALLOC) --build-arg BASE_IMAGE=$(BASE_IMAGE) -t $(BIN_IMAGE) build/docker/bin; \
|
||||
docker build --no-cache=$(NO_CACHE) --build-arg TCMALLOC=$(TCMALLOC) --build-arg BASE_IMAGE=$(BASE_IMAGE) --build-arg PORTABLE_ROCKSDB=$(PORTABLE) -t $(BIN_IMAGE) build/docker/bin; \
|
||||
else \
|
||||
echo "Image $(BIN_IMAGE) is up to date"; \
|
||||
fi
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
ARG BASE_IMAGE
|
||||
FROM $BASE_IMAGE
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG PORTABLE_ROCKSDB
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
@ -36,7 +37,7 @@ RUN echo -n "GOPATH: " && echo $GOPATH
|
||||
|
||||
# install rocksdb
|
||||
RUN cd /opt && git clone -b $ROCKSDB_VERSION --depth 1 https://github.com/facebook/rocksdb.git
|
||||
RUN cd /opt/rocksdb && CFLAGS=-fPIC CXXFLAGS=-fPIC make -j 4 release
|
||||
RUN cd /opt/rocksdb && CFLAGS=-fPIC CXXFLAGS=-fPIC PORTABLE=$PORTABLE_ROCKSDB make -j 4 release
|
||||
RUN strip /opt/rocksdb/ldb /opt/rocksdb/sst_dump && \
|
||||
cp /opt/rocksdb/ldb /opt/rocksdb/sst_dump /build
|
||||
|
||||
|
||||
@ -86,6 +86,8 @@ command: `make NO_CACHE=true all-bitcoin`.
|
||||
|
||||
`TCMALLOC`: RocksDB, the storage engine used by Blockbook, allows to use alternative memory allocators. Use the `TCMALLOC` variable to specify Google's TCMalloc allocator `make TCMALLOC=true all-bitcoin`. To run Blockbook built with TCMalloc, the library must be installed on the target server, for example by `sudo apt-get install google-perftools`.
|
||||
|
||||
`PORTABLE`: By default, the RocksDB binaries shipped with Blockbook are optimized for the platform you're compiling on (-march=native or the equivalent). If you want to build a portable binary, use `make PORTABLE=1 all-bitcoin`.
|
||||
|
||||
### Naming conventions and versioning
|
||||
|
||||
All configuration keys described below are in coin definition file in *configs/coins*.
|
||||
@ -199,7 +201,8 @@ export PATH=$PATH:$GOPATH/bin
|
||||
```
|
||||
|
||||
Install RocksDB: https://github.com/facebook/rocksdb/blob/master/INSTALL.md
|
||||
and compile the static_lib and tools
|
||||
and compile the static_lib and tools. Optionally, consider adding `PORTABLE=1` before the
|
||||
make command to create a portable binary.
|
||||
|
||||
```
|
||||
sudo apt-get update && sudo apt-get install -y \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user