From c2be43430722e26472e299c8c6b9bc9e1d2d46ec Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Thu, 11 May 2017 15:17:26 -0700 Subject: [PATCH] Build and link with ZStd when creating the static RocksJava build Summary: Closes https://github.com/facebook/rocksdb/pull/2279 Differential Revision: D5048161 Pulled By: yiwu-arbug fbshipit-source-id: 43742ff93137e0a35ea7e855692c9e9a0cd41968 --- Makefile | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c68ac141f..c7a4eb510 100644 --- a/Makefile +++ b/Makefile @@ -1447,6 +1447,9 @@ SNAPPY_DOWNLOAD_BASE ?= https://github.com/google/snappy/releases/download LZ4_VER ?= 1.7.5 LZ4_SHA256 ?= 0190cacd63022ccb86f44fa5041dc6c3804407ad61550ca21c382827319e7e7e LZ4_DOWNLOAD_BASE ?= https://github.com/lz4/lz4/archive +ZSTD_VER ?= 1.2.0 +ZSTD_SHA256 ?= 4a7e4593a3638276ca7f2a09dc4f38e674d8317bbea51626393ca73fc047cbfb +ZSTD_DOWNLOAD_BASE ?= https://github.com/facebook/zstd/archive ifeq ($(PLATFORM), OS_MACOSX) ROCKSDBJNILIB = librocksdbjni-osx.jnilib @@ -1526,12 +1529,25 @@ liblz4.a: cd lz4-$(LZ4_VER)/lib && make CFLAGS='-fPIC -O2 ${EXTRA_CFLAGS}' all cp lz4-$(LZ4_VER)/lib/liblz4.a . +libzstd.a: + -rm -rf zstd-$(ZSTD_VER) + curl -O -L ${ZSTD_DOWNLOAD_BASE}/v$(ZSTD_VER).tar.gz + mv v$(ZSTD_VER).tar.gz zstd-$(ZSTD_VER).tar.gz + ZSTD_SHA256_ACTUAL=`$(SHA256_CMD) zstd-$(ZSTD_VER).tar.gz | cut -d ' ' -f 1`; \ + if [ "$(ZSTD_SHA256)" != "$$ZSTD_SHA256_ACTUAL" ]; then \ + echo zstd-$(ZSTD_VER).tar.gz checksum mismatch, expected=\"$(ZSTD_SHA256)\" actual=\"$$ZSTD_SHA256_ACTUAL\"; \ + exit 1; \ + fi + tar xvzf zstd-$(ZSTD_VER).tar.gz + cd zstd-$(ZSTD_VER)/lib && make CFLAGS='-fPIC -O2 ${EXTRA_CFLAGS}' all + cp zstd-$(ZSTD_VER)/lib/libzstd.a . + # A version of each $(LIBOBJECTS) compiled with -fPIC and a fixed set of static compression libraries java_static_libobjects = $(patsubst %,jls/%,$(LIBOBJECTS)) CLEAN_FILES += jls ifneq ($(ROCKSDB_JAVA_NO_COMPRESSION), 1) -JAVA_COMPRESSIONS = libz.a libbz2.a libsnappy.a liblz4.a +JAVA_COMPRESSIONS = libz.a libbz2.a libsnappy.a liblz4.a libzstd.a endif JAVA_STATIC_FLAGS = -DZLIB -DBZIP2 -DSNAPPY -DLZ4