Setup new arch in java loadlibrary

This commit is contained in:
Ernesto Castellotti 2018-11-26 16:17:57 +01:00
parent 086f16a916
commit e0db7e7f9c
2 changed files with 29 additions and 3 deletions

View File

@ -22,6 +22,9 @@ package it.ernytech.tdlib.utils;
*/
public enum Arch {
amd64,
i686,
i386,
armhf,
aarch64,
ppc64el
unknown
}

View File

@ -19,6 +19,7 @@ package it.ernytech.tdlib.utils;
import java.io.IOException;
import java.nio.file.*;
import java.nio.ByteOrder;
import java.util.concurrent.ConcurrentHashMap;
/**
@ -99,10 +100,32 @@ public class LoadLibrary {
return Arch.amd64;
}
case "x86" : {
return Arch.i686;
case "x86_64" : {
return Arch.amd64;
}
case "i386" : {
return Arch.i386;
}
case "x86" : {
return Arch.i386;
}
case "arm" : {
return Arch.armhf;
}
case "aarch64" : {
return Arch.aarch64;
}
case "ppc64" : {
if (!ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN)) { // Java always returns ppc64 for all 64-bit powerpc but
return Arch.ppc64el; // powerpc64le (our target) is very different, it uses
} // little-endian unlike powerpc64, so we just check
} // this condition to accurately identify the architecture
default : {
return Arch.unknown;
}