Add support for JNI Library on Linux on PowerPC.

Summary:
Closes https://github.com/facebook/rocksdb/issues/1317
Closes https://github.com/facebook/rocksdb/pull/1845

Differential Revision: D4546491

Pulled By: siying

fbshipit-source-id: 86190b4
main
Adam Retter 8 years ago committed by Facebook Github Bot
parent 9afa20cf2f
commit 421ce7c2ba
  1. 18
      java/src/main/java/org/rocksdb/util/Environment.java

@ -4,6 +4,10 @@ public class Environment {
private static String OS = System.getProperty("os.name").toLowerCase(); private static String OS = System.getProperty("os.name").toLowerCase();
private static String ARCH = System.getProperty("os.arch").toLowerCase(); private static String ARCH = System.getProperty("os.arch").toLowerCase();
public static boolean isPowerPC() {
return ARCH.contains("ppc");
}
public static boolean isWindows() { public static boolean isWindows() {
return (OS.contains("win")); return (OS.contains("win"));
} }
@ -36,16 +40,22 @@ public class Environment {
public static String getJniLibraryName(final String name) { public static String getJniLibraryName(final String name) {
if (isUnix()) { if (isUnix()) {
final String arch = (is64Bit()) ? "64" : "32"; final String arch = is64Bit() ? "64" : "32";
return String.format("%sjni-linux%s", name, arch); if(isPowerPC()) {
return String.format("%sjni-linux-ppc%s", name, arch);
} else {
return String.format("%sjni-linux%s", name, arch);
}
} else if (isMac()) { } else if (isMac()) {
return String.format("%sjni-osx", name); return String.format("%sjni-osx", name);
} else if (isSolaris()) { } else if (isSolaris()) {
return String.format("%sjni-solaris%d", name, is64Bit() ? 64 : 32); final String arch = is64Bit() ? "64" : "32";
return String.format("%sjni-solaris%s", name, arch);
} else if (isWindows() && is64Bit()) { } else if (isWindows() && is64Bit()) {
return String.format("%sjni-win64", name); return String.format("%sjni-win64", name);
} }
throw new UnsupportedOperationException();
throw new UnsupportedOperationException(String.format("Cannot determine JNI library name for ARCH='%s' OS='%s' name='%s'", ARCH, OS, name));
} }
public static String getJniLibraryFileName(final String name) { public static String getJniLibraryFileName(final String name) {

Loading…
Cancel
Save