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
This commit is contained in:
Adam Retter 2017-02-10 14:58:07 -08:00 committed by Facebook Github Bot
parent 9afa20cf2f
commit 421ce7c2ba

View File

@ -4,6 +4,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 isPowerPC() {
return ARCH.contains("ppc");
}
public static boolean isWindows() {
return (OS.contains("win"));
}
@ -36,16 +40,22 @@ public class Environment {
public static String getJniLibraryName(final String name) {
if (isUnix()) {
final String arch = (is64Bit()) ? "64" : "32";
return String.format("%sjni-linux%s", name, arch);
final String arch = is64Bit() ? "64" : "32";
if(isPowerPC()) {
return String.format("%sjni-linux-ppc%s", name, arch);
} else {
return String.format("%sjni-linux%s", name, arch);
}
} else if (isMac()) {
return String.format("%sjni-osx", name);
} 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()) {
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) {