mirror of https://github.com/facebook/rocksdb.git
Support rocksdbjava aarch64 build and test (#5258)
Summary: Verified with an Ampere Computing eMAG aarch64 system. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5258 Differential Revision: D15807309 Pulled By: maysamyabandeh fbshipit-source-id: ab85d2fd3fe40e6094430ab0eba557b1e979510d
This commit is contained in:
parent
60f3ec2ca5
commit
5c76ba9dc4
5
Makefile
5
Makefile
|
@ -1641,7 +1641,7 @@ JAVA_INCLUDE = -I$(JAVA_HOME)/include/ -I$(JAVA_HOME)/include/linux
|
|||
ifeq ($(PLATFORM), OS_SOLARIS)
|
||||
ARCH := $(shell isainfo -b)
|
||||
else ifeq ($(PLATFORM), OS_OPENBSD)
|
||||
ifneq (,$(filter $(MACHINE), amd64 arm64 sparc64))
|
||||
ifneq (,$(filter $(MACHINE), amd64 arm64 sparc64 aarch64))
|
||||
ARCH := 64
|
||||
else
|
||||
ARCH := 32
|
||||
|
@ -1655,6 +1655,9 @@ ifeq (,$(findstring ppc,$(MACHINE)))
|
|||
else
|
||||
ROCKSDBJNILIB = librocksdbjni-linux-$(MACHINE).so
|
||||
endif
|
||||
ifneq (,$(findstring aarch64,$(MACHINE)))
|
||||
ROCKSDBJNILIB = librocksdbjni-linux-$(MACHINE).so
|
||||
endif
|
||||
ROCKSDB_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-linux$(ARCH).jar
|
||||
ROCKSDB_JAR_ALL = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH).jar
|
||||
ROCKSDB_JAVADOCS_JAR = rocksdbjni-$(ROCKSDB_MAJOR).$(ROCKSDB_MINOR).$(ROCKSDB_PATCH)-javadoc.jar
|
||||
|
|
|
@ -540,6 +540,8 @@ if test -z "$PORTABLE"; then
|
|||
elif test -n "`echo $TARGET_ARCHITECTURE | grep ^arm`"; then
|
||||
# TODO: Handle this with approprite options.
|
||||
COMMON_FLAGS="$COMMON_FLAGS"
|
||||
elif test -n "`echo $TARGET_ARCHITECTURE | grep ^aarch64`"; then
|
||||
COMMON_FLAGS="$COMMON_FLAGS"
|
||||
elif [ "$TARGET_OS" == "IOS" ]; then
|
||||
COMMON_FLAGS="$COMMON_FLAGS"
|
||||
elif [ "$TARGET_OS" != "AIX" ] && [ "$TARGET_OS" != "SunOS" ]; then
|
||||
|
|
|
@ -5,6 +5,10 @@ public class Environment {
|
|||
private static String OS = System.getProperty("os.name").toLowerCase();
|
||||
private static String ARCH = System.getProperty("os.arch").toLowerCase();
|
||||
|
||||
public static boolean isAarch64() {
|
||||
return ARCH.contains("aarch64");
|
||||
}
|
||||
|
||||
public static boolean isPowerPC() {
|
||||
return ARCH.contains("ppc");
|
||||
}
|
||||
|
@ -60,7 +64,7 @@ public class Environment {
|
|||
public static String getJniLibraryName(final String name) {
|
||||
if (isUnix()) {
|
||||
final String arch = is64Bit() ? "64" : "32";
|
||||
if(isPowerPC()) {
|
||||
if(isPowerPC() || isAarch64()) {
|
||||
return String.format("%sjni-linux-%s", name, ARCH);
|
||||
} else if(isS390x()) {
|
||||
return String.format("%sjni-linux%s", name, ARCH);
|
||||
|
|
|
@ -130,6 +130,24 @@ public class EnvironmentTest {
|
|||
isEqualTo("librocksdbjni.dll");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aarch64() {
|
||||
setEnvironmentClassFields("Linux", "aarch64");
|
||||
assertThat(Environment.isUnix()).isTrue();
|
||||
assertThat(Environment.isAarch64()).isTrue();
|
||||
assertThat(Environment.is64Bit()).isTrue();
|
||||
assertThat(Environment.getJniLibraryExtension()).
|
||||
isEqualTo(".so");
|
||||
assertThat(Environment.getSharedLibraryName("rocksdb")).
|
||||
isEqualTo("rocksdbjni");
|
||||
assertThat(Environment.getJniLibraryName("rocksdb")).
|
||||
isEqualTo("rocksdbjni-linux-aarch64");
|
||||
assertThat(Environment.getJniLibraryFileName("rocksdb")).
|
||||
isEqualTo("librocksdbjni-linux-aarch64.so");
|
||||
assertThat(Environment.getSharedLibraryFileName("rocksdb")).
|
||||
isEqualTo("librocksdbjni.so");
|
||||
}
|
||||
|
||||
private void setEnvironmentClassFields(String osName,
|
||||
String osArch) {
|
||||
setEnvironmentClassField(OS_FIELD_NAME, osName);
|
||||
|
|
Loading…
Reference in New Issue