@ -134,12 +134,6 @@ CFLAGS += -DHAVE_POWER8
HAVE_POWER8 = 1
HAVE_POWER8 = 1
e n d i f
e n d i f
i f e q ( , $( shell $ ( CXX ) -fsyntax -only -march =armv 8-a +crc +crypto -xc /dev /null 2>&1) )
CXXFLAGS += -march= armv8-a+crc+crypto
CFLAGS += -march= armv8-a+crc+crypto
ARMCRC_SOURCE = 1
e n d i f
# if we're compiling for shared libraries, add the shared flags
# if we're compiling for shared libraries, add the shared flags
i f e q ( $( LIB_MODE ) , s h a r e d )
i f e q ( $( LIB_MODE ) , s h a r e d )
CXXFLAGS += $( PLATFORM_SHARED_CFLAGS) -DROCKSDB_DLL
CXXFLAGS += $( PLATFORM_SHARED_CFLAGS) -DROCKSDB_DLL
@ -264,6 +258,16 @@ $(error pkg-config failed)
e n d i f
e n d i f
e n d i f
e n d i f
CXXFLAGS += $( ARCHFLAG)
i f e q ( , $( shell $ ( CXX ) -fsyntax -only -march =armv 8-a +crc +crypto -xc /dev /null 2>&1) )
i f n e q ( $( PLATFORM ) , O S _ M A C O S X )
CXXFLAGS += -march= armv8-a+crc+crypto
CFLAGS += -march= armv8-a+crc+crypto
ARMCRC_SOURCE = 1
e n d i f
e n d i f
export JAVAC_ARGS
export JAVAC_ARGS
CLEAN_FILES += make_config.mk rocksdb.pc
CLEAN_FILES += make_config.mk rocksdb.pc
@ -313,6 +317,19 @@ ifeq ($(LIB_MODE),shared)
EXEC_LDFLAGS += -Wl,-rpath -Wl,'$$ORIGIN'
EXEC_LDFLAGS += -Wl,-rpath -Wl,'$$ORIGIN'
e n d i f
e n d i f
i f e q ( $( PLATFORM ) , O S _ M A C O S X )
i f e q ( $( ARCHFLAG ) , - a r c h a r m 6 4 )
i f n e q ( $( MACHINE ) , a r m 6 4 )
# If we're building on a non-arm64 machine but targeting arm64 Mac, we need to disable
# linking with jemalloc (as it won't be arm64-compatible) and remove some other options
# set during platform detection
DISABLE_JEMALLOC = 1
PLATFORM_CFLAGS := $( filter-out -march= native -DHAVE_SSE42, $( PLATFORM_CFLAGS) )
PLATFORM_CXXFLAGS := $( filter-out -march= native -DHAVE_SSE42, $( PLATFORM_CXXFLAGS) )
e n d i f
e n d i f
e n d i f
# ASAN doesn't work well with jemalloc. If we're compiling with ASAN, we should use regular malloc.
# ASAN doesn't work well with jemalloc. If we're compiling with ASAN, we should use regular malloc.
i f d e f C O M P I L E _ W I T H _ A S A N
i f d e f C O M P I L E _ W I T H _ A S A N
DISABLE_JEMALLOC = 1
DISABLE_JEMALLOC = 1
@ -2055,11 +2072,13 @@ ifneq ($(origin JNI_LIBC), undefined)
JNI_LIBC_POSTFIX = -$( JNI_LIBC)
JNI_LIBC_POSTFIX = -$( JNI_LIBC)
e n d i f
e n d i f
i f e q ( , $( ROCKSDBJNILIB ) )
i f n e q ( , $( filter ppc % s 390x arm 64 aarch 64 sparc 64, $ ( MACHINE ) ) )
i f n e q ( , $( filter ppc % s 390x arm 64 aarch 64 sparc 64, $ ( MACHINE ) ) )
ROCKSDBJNILIB = librocksdbjni-linux-$( MACHINE) $( JNI_LIBC_POSTFIX) .so
ROCKSDBJNILIB = librocksdbjni-linux-$( MACHINE) $( JNI_LIBC_POSTFIX) .so
e l s e
e l s e
ROCKSDBJNILIB = librocksdbjni-linux$( ARCH) $( JNI_LIBC_POSTFIX) .so
ROCKSDBJNILIB = librocksdbjni-linux$( ARCH) $( JNI_LIBC_POSTFIX) .so
e n d i f
e n d i f
e n d i f
ROCKSDB_JAVA_VERSION ?= $( ROCKSDB_MAJOR) .$( ROCKSDB_MINOR) .$( ROCKSDB_PATCH)
ROCKSDB_JAVA_VERSION ?= $( ROCKSDB_MAJOR) .$( ROCKSDB_MINOR) .$( ROCKSDB_PATCH)
ROCKSDB_JAR = rocksdbjni-$( ROCKSDB_JAVA_VERSION) -linux$( ARCH) $( JNI_LIBC_POSTFIX) .jar
ROCKSDB_JAR = rocksdbjni-$( ROCKSDB_JAVA_VERSION) -linux$( ARCH) $( JNI_LIBC_POSTFIX) .jar
ROCKSDB_JAR_ALL = rocksdbjni-$( ROCKSDB_JAVA_VERSION) .jar
ROCKSDB_JAR_ALL = rocksdbjni-$( ROCKSDB_JAVA_VERSION) .jar
@ -2085,7 +2104,13 @@ ZSTD_DOWNLOAD_BASE ?= https://github.com/facebook/zstd/archive
CURL_SSL_OPTS ?= --tlsv1
CURL_SSL_OPTS ?= --tlsv1
i f e q ( $( PLATFORM ) , O S _ M A C O S X )
i f e q ( $( PLATFORM ) , O S _ M A C O S X )
i f e q ( , $( findstring librocksdbjni -osx ,$ ( ROCKSDBJNILIB ) ) )
i f e q ( $( MACHINE ) , a r m 6 4 )
ROCKSDBJNILIB = librocksdbjni-osx-aarch64.jnilib
e l s e
ROCKSDBJNILIB = librocksdbjni-osx.jnilib
ROCKSDBJNILIB = librocksdbjni-osx.jnilib
e n d i f
e n d i f
ROCKSDB_JAR = rocksdbjni-$( ROCKSDB_JAVA_VERSION) -osx.jar
ROCKSDB_JAR = rocksdbjni-$( ROCKSDB_JAVA_VERSION) -osx.jar
SHA256_CMD = openssl sha256 -r
SHA256_CMD = openssl sha256 -r
i f n e q ( "$(wildcard $(JAVA_HOME)/include/darwin)" , "" )
i f n e q ( "$(wildcard $(JAVA_HOME)/include/darwin)" , "" )
@ -2094,6 +2119,7 @@ else
JAVA_INCLUDE = -I/System/Library/Frameworks/JavaVM.framework/Headers/
JAVA_INCLUDE = -I/System/Library/Frameworks/JavaVM.framework/Headers/
e n d i f
e n d i f
e n d i f
e n d i f
i f e q ( $( PLATFORM ) , O S _ F R E E B S D )
i f e q ( $( PLATFORM ) , O S _ F R E E B S D )
JAVA_INCLUDE = -I$( JAVA_HOME) /include -I$( JAVA_HOME) /include/freebsd
JAVA_INCLUDE = -I$( JAVA_HOME) /include -I$( JAVA_HOME) /include/freebsd
ROCKSDBJNILIB = librocksdbjni-freebsd$( ARCH) .so
ROCKSDBJNILIB = librocksdbjni-freebsd$( ARCH) .so
@ -2128,7 +2154,11 @@ zlib-$(ZLIB_VER).tar.gz:
libz.a : zlib -$( ZLIB_VER ) .tar .gz
libz.a : zlib -$( ZLIB_VER ) .tar .gz
-rm -rf zlib-$( ZLIB_VER)
-rm -rf zlib-$( ZLIB_VER)
tar xvzf zlib-$( ZLIB_VER) .tar.gz
tar xvzf zlib-$( ZLIB_VER) .tar.gz
cd zlib-$( ZLIB_VER) && CFLAGS = '-fPIC ${JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' ./configure --static && $( MAKE)
if [ -n" $( ARCHFLAG) " ] ; then \
cd zlib-$( ZLIB_VER) && CFLAGS = '-fPIC ${JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' ./configure --static --archs= " $( ARCHFLAG) " && $( MAKE) ; \
else \
cd zlib-$( ZLIB_VER) && CFLAGS = '-fPIC ${JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' ./configure --static && $( MAKE) ; \
fi
cp zlib-$( ZLIB_VER) /libz.a .
cp zlib-$( ZLIB_VER) /libz.a .
bzip2-$(BZIP2_VER).tar.gz :
bzip2-$(BZIP2_VER).tar.gz :
@ -2142,7 +2172,7 @@ bzip2-$(BZIP2_VER).tar.gz:
libbz2.a : bzip 2-$( BZIP 2_VER ) .tar .gz
libbz2.a : bzip 2-$( BZIP 2_VER ) .tar .gz
-rm -rf bzip2-$( BZIP2_VER)
-rm -rf bzip2-$( BZIP2_VER)
tar xvzf bzip2-$( BZIP2_VER) .tar.gz
tar xvzf bzip2-$( BZIP2_VER) .tar.gz
cd bzip2-$( BZIP2_VER) && $( MAKE) CFLAGS = '-fPIC -O2 -g -D_FILE_OFFSET_BITS=64 ${JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' AR = 'ar ${EXTRA_ARFLAGS}'
cd bzip2-$( BZIP2_VER) && $( MAKE) CFLAGS = '-fPIC -O2 -g -D_FILE_OFFSET_BITS=64 $(ARCHFLAG) $ {JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' AR = 'ar ${EXTRA_ARFLAGS}' libbz2.a
cp bzip2-$( BZIP2_VER) /libbz2.a .
cp bzip2-$( BZIP2_VER) /libbz2.a .
snappy-$(SNAPPY_VER).tar.gz :
snappy-$(SNAPPY_VER).tar.gz :
@ -2157,7 +2187,7 @@ libsnappy.a: snappy-$(SNAPPY_VER).tar.gz
-rm -rf snappy-$( SNAPPY_VER)
-rm -rf snappy-$( SNAPPY_VER)
tar xvzf snappy-$( SNAPPY_VER) .tar.gz
tar xvzf snappy-$( SNAPPY_VER) .tar.gz
mkdir snappy-$( SNAPPY_VER) /build
mkdir snappy-$( SNAPPY_VER) /build
cd snappy-$( SNAPPY_VER) /build && CFLAGS = '${JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' CXXFLAGS = '${JAVA_STATIC_DEPS_CXXFLAGS} ${EXTRA_CXXFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' cmake -DCMAKE_POSITION_INDEPENDENT_CODE= ON ${ PLATFORM_CMAKE_FLAGS } .. && $( MAKE) ${ SNAPPY_MAKE_TARGET }
cd snappy-$( SNAPPY_VER) /build && CFLAGS = '$(ARCHFLAG) $ {JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' CXXFLAGS = '$(ARCHFLAG) ${JAVA_STATIC_DEPS_CXXFLAGS} ${EXTRA_CXXFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' cmake -DCMAKE_POSITION_INDEPENDENT_CODE= ON ${ PLATFORM_CMAKE_FLAGS } .. && $( MAKE) ${ SNAPPY_MAKE_TARGET }
cp snappy-$( SNAPPY_VER) /build/libsnappy.a .
cp snappy-$( SNAPPY_VER) /build/libsnappy.a .
lz4-$(LZ4_VER).tar.gz :
lz4-$(LZ4_VER).tar.gz :
@ -2171,7 +2201,7 @@ lz4-$(LZ4_VER).tar.gz:
liblz4.a : lz 4-$( LZ 4_VER ) .tar .gz
liblz4.a : lz 4-$( LZ 4_VER ) .tar .gz
-rm -rf lz4-$( LZ4_VER)
-rm -rf lz4-$( LZ4_VER)
tar xvzf lz4-$( LZ4_VER) .tar.gz
tar xvzf lz4-$( LZ4_VER) .tar.gz
cd lz4-$( LZ4_VER) /lib && $( MAKE) CFLAGS = '-fPIC -O2 ${JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' all
cd lz4-$( LZ4_VER) /lib && $( MAKE) CFLAGS = '-fPIC -O2 $(ARCHFLAG) $ {JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' all
cp lz4-$( LZ4_VER) /lib/liblz4.a .
cp lz4-$( LZ4_VER) /lib/liblz4.a .
zstd-$(ZSTD_VER).tar.gz :
zstd-$(ZSTD_VER).tar.gz :
@ -2185,7 +2215,7 @@ zstd-$(ZSTD_VER).tar.gz:
libzstd.a : zstd -$( ZSTD_VER ) .tar .gz
libzstd.a : zstd -$( ZSTD_VER ) .tar .gz
-rm -rf zstd-$( ZSTD_VER)
-rm -rf zstd-$( ZSTD_VER)
tar xvzf zstd-$( ZSTD_VER) .tar.gz
tar xvzf zstd-$( ZSTD_VER) .tar.gz
cd zstd-$( ZSTD_VER) /lib && DESTDIR = . PREFIX = $( MAKE) CFLAGS = '-fPIC -O2 ${JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' libzstd.a
cd zstd-$( ZSTD_VER) /lib && DESTDIR = . PREFIX = $( MAKE) CFLAGS = '-fPIC -O2 $(ARCHFLAG) $ {JAVA_STATIC_DEPS_CCFLAGS} ${EXTRA_CFLAGS}' LDFLAGS = '${JAVA_STATIC_DEPS_LDFLAGS} ${EXTRA_LDFLAGS}' libzstd.a
cp zstd-$( ZSTD_VER) /lib/libzstd.a .
cp zstd-$( ZSTD_VER) /lib/libzstd.a .
# A version of each $(LIB_OBJECTS) compiled with -fPIC and a fixed set of static compression libraries
# A version of each $(LIB_OBJECTS) compiled with -fPIC and a fixed set of static compression libraries
@ -2207,6 +2237,29 @@ endif
$( MAKE) rocksdbjavastatic_deps
$( MAKE) rocksdbjavastatic_deps
$( MAKE) rocksdbjavastatic_libobjects
$( MAKE) rocksdbjavastatic_libobjects
$( MAKE) rocksdbjavastatic_javalib
$( MAKE) rocksdbjavastatic_javalib
$( MAKE) rocksdbjavastatic_jar
rocksdbjavastaticosx : rocksdbjavastaticosx_archs
mv java/target/librocksdbjni-osx-x86_64.jnilib java/target/librocksdbjni-osx.jnilib
mv java/target/librocksdbjni-osx-arm64.jnilib java/target/librocksdbjni-osx-aarch64.jnilib
rocksdbjavastaticosx_ub : rocksdbjavastaticosx_archs
lipo -create -output ./java/target/$( ROCKSDBJNILIB) java/target/librocksdbjni-osx-x86_64.jnilib java/target/librocksdbjni-osx-arm64.jnilib
$( MAKE) rocksdbjavastatic_jar
rocksdbjavastaticosx_archs :
$( MAKE) rocksdbjavastaticosx_arch_x86_64
$( MAKE) rocksdbjavastaticosx_arch_arm64
rocksdbjavastaticosx_arch_% :
i f e q ( $( JAVA_HOME ) , )
$( error JAVA_HOME is not set )
e n d i f
$( MAKE) clean-ext-libraries-bin
$( MAKE) clean-rocks
ARCHFLAG = " -arch $* " $( MAKE) rocksdbjavastatic_deps
ARCHFLAG = " -arch $* " $( MAKE) rocksdbjavastatic_libobjects
ARCHFLAG = " -arch $* " ROCKSDBJNILIB = " librocksdbjni-osx- $* .jnilib " $( MAKE) rocksdbjavastatic_javalib
i f e q ( $( JAR_CMD ) , )
i f e q ( $( JAR_CMD ) , )
i f n e q ( $( JAVA_HOME ) , )
i f n e q ( $( JAVA_HOME ) , )
@ -2225,7 +2278,9 @@ rocksdbjavastatic_javalib:
cd java/target; if [ " $( DEBUG_LEVEL) " = = "0" ] ; then \
cd java/target; if [ " $( DEBUG_LEVEL) " = = "0" ] ; then \
strip $( STRIPFLAGS) $( ROCKSDBJNILIB) ; \
strip $( STRIPFLAGS) $( ROCKSDBJNILIB) ; \
fi
fi
cd java; $( JAR_CMD) -cf target/$( ROCKSDB_JAR) HISTORY*.md
rocksdbjavastatic_jar :
cd java; $( JAR_CMD) -cf target/$( ROCKSDB_JAR) HISTORY*.md
cd java/target; $( JAR_CMD) -uf $( ROCKSDB_JAR) $( ROCKSDBJNILIB)
cd java/target; $( JAR_CMD) -uf $( ROCKSDB_JAR) $( ROCKSDBJNILIB)
cd java/target/classes; $( JAR_CMD) -uf ../$( ROCKSDB_JAR) org/rocksdb/*.class org/rocksdb/util/*.class
cd java/target/classes; $( JAR_CMD) -uf ../$( ROCKSDB_JAR) org/rocksdb/*.class org/rocksdb/util/*.class
cd java/target/apidocs; $( JAR_CMD) -cf ../$( ROCKSDB_JAVADOCS_JAR) *
cd java/target/apidocs; $( JAR_CMD) -cf ../$( ROCKSDB_JAVADOCS_JAR) *
@ -2238,14 +2293,14 @@ rocksdbjavastatic_deps: $(JAVA_COMPRESSIONS)
rocksdbjavastatic_libobjects : $( LIB_OBJECTS )
rocksdbjavastatic_libobjects : $( LIB_OBJECTS )
rocksdbjavastaticrelease : rocksdbjavastatic
rocksdbjavastaticrelease : rocksdbjavastaticosx
cd java/crossbuild && ( vagrant destroy -f || true ) && vagrant up linux32 && vagrant halt linux32 && vagrant up linux64 && vagrant halt linux64 && vagrant up linux64-musl && vagrant halt linux64-musl
cd java/crossbuild && ( vagrant destroy -f || true ) && vagrant up linux32 && vagrant halt linux32 && vagrant up linux64 && vagrant halt linux64 && vagrant up linux64-musl && vagrant halt linux64-musl
cd java; $( JAR_CMD) -cf target/$( ROCKSDB_JAR_ALL) HISTORY*.md
cd java; $( JAR_CMD) -cf target/$( ROCKSDB_JAR_ALL) HISTORY*.md
cd java/target; $( JAR_CMD) -uf $( ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib
cd java/target; $( JAR_CMD) -uf $( ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib
cd java/target/classes; $( JAR_CMD) -uf ../$( ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class
cd java/target/classes; $( JAR_CMD) -uf ../$( ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class
openssl sha1 java/target/$( ROCKSDB_JAR_ALL) | sed 's/.*= \([0-9a-f]*\)/\1/' > java/target/$( ROCKSDB_JAR_ALL) .sha1
openssl sha1 java/target/$( ROCKSDB_JAR_ALL) | sed 's/.*= \([0-9a-f]*\)/\1/' > java/target/$( ROCKSDB_JAR_ALL) .sha1
rocksdbjavastaticreleasedocker : rocksdbjavastatic rocksdbjavastaticdockerx 86 rocksdbjavastaticdockerx 86_ 64 rocksdbjavastaticdockerx 86musl rocksdbjavastaticdockerx 86_ 64musl
rocksdbjavastaticreleasedocker : rocksdbjavastaticosx rocksdbjavastaticdockerx 86 rocksdbjavastaticdockerx 86_ 64 rocksdbjavastaticdockerx 86musl rocksdbjavastaticdockerx 86_ 64musl
cd java; $( JAR_CMD) -cf target/$( ROCKSDB_JAR_ALL) HISTORY*.md
cd java; $( JAR_CMD) -cf target/$( ROCKSDB_JAR_ALL) HISTORY*.md
cd java/target; $( JAR_CMD) -uf $( ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib
cd java/target; $( JAR_CMD) -uf $( ROCKSDB_JAR_ALL) librocksdbjni-*.so librocksdbjni-*.jnilib
cd java/target/classes; $( JAR_CMD) -uf ../$( ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class
cd java/target/classes; $( JAR_CMD) -uf ../$( ROCKSDB_JAR_ALL) org/rocksdb/*.class org/rocksdb/util/*.class