3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-09-29 06:30:16 +02:00

Check for AARCH64.

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-06-04 15:03:27 -04:00
Ursprung bb69481f99
Commit 31d1871bd5
2 geänderte Dateien mit 16 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -7,6 +7,7 @@ import java.util.function.BooleanSupplier;
public class NativeConstraints {
private static final boolean NATIVES_ENABLED = !Boolean.getBoolean("velocity.natives-disabled");
private static final boolean IS_AMD64;
private static final boolean IS_AARCH64;
private static final boolean CAN_GET_MEMORYADDRESS;
static {
@ -21,15 +22,23 @@ public class NativeConstraints {
// HotSpot on Intel macOS prefers x86_64, but OpenJ9 on macOS and HotSpot/OpenJ9 elsewhere
// give amd64.
IS_AMD64 = osArch.equals("amd64") || osArch.equals("x86_64");
IS_AARCH64 = osArch.equals("aarch64");
}
static final BooleanSupplier LINUX = () -> {
return NATIVES_ENABLED
&& CAN_GET_MEMORYADDRESS
static final BooleanSupplier NATIVE_BASE = () -> NATIVES_ENABLED && CAN_GET_MEMORYADDRESS;
static final BooleanSupplier LINUX_X86_64 = () -> {
return NATIVE_BASE.getAsBoolean()
&& System.getProperty("os.name", "").equalsIgnoreCase("Linux")
&& IS_AMD64;
};
static final BooleanSupplier LINUX_AARCH64 = () -> {
return NATIVE_BASE.getAsBoolean()
&& System.getProperty("os.name", "").equalsIgnoreCase("Linux")
&& IS_AARCH64;
};
static final BooleanSupplier JAVA_11 = () -> {
return Double.parseDouble(System.getProperty("java.specification.version")) >= 11;
};

Datei anzeigen

@ -62,11 +62,11 @@ public class Natives {
public static final NativeCodeLoader<VelocityCompressorFactory> compress = new NativeCodeLoader<>(
ImmutableList.of(
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX_X86_64,
copyAndLoadNative("/linux_x86_64/velocity-compress.so"),
"libdeflate (Linux x86_64)",
LibdeflateVelocityCompressor.FACTORY),
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX_AARCH64,
copyAndLoadNative("/linux_aarch64/velocity-compress.so"),
"libdeflate (Linux aarch64)",
LibdeflateVelocityCompressor.FACTORY),
@ -79,10 +79,10 @@ public class Natives {
public static final NativeCodeLoader<VelocityCipherFactory> cipher = new NativeCodeLoader<>(
ImmutableList.of(
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX_X86_64,
copyAndLoadNative("/linux_x86_64/velocity-cipher.so"),
"mbed TLS (Linux x86_64)", NativeVelocityCipher.FACTORY),
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX_AARCH64,
copyAndLoadNative("/linux_aarch64/velocity-cipher.so"),
"mbed TLS (Linux aarch64)", NativeVelocityCipher.FACTORY),
new NativeCodeLoader.Variant<>(NativeCodeLoader.ALWAYS, () -> {