Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Check for AARCH64.
Dieser Commit ist enthalten in:
Ursprung
bb69481f99
Commit
31d1871bd5
@ -7,6 +7,7 @@ import java.util.function.BooleanSupplier;
|
|||||||
public class NativeConstraints {
|
public class NativeConstraints {
|
||||||
private static final boolean NATIVES_ENABLED = !Boolean.getBoolean("velocity.natives-disabled");
|
private static final boolean NATIVES_ENABLED = !Boolean.getBoolean("velocity.natives-disabled");
|
||||||
private static final boolean IS_AMD64;
|
private static final boolean IS_AMD64;
|
||||||
|
private static final boolean IS_AARCH64;
|
||||||
private static final boolean CAN_GET_MEMORYADDRESS;
|
private static final boolean CAN_GET_MEMORYADDRESS;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -21,15 +22,23 @@ public class NativeConstraints {
|
|||||||
// HotSpot on Intel macOS prefers x86_64, but OpenJ9 on macOS and HotSpot/OpenJ9 elsewhere
|
// HotSpot on Intel macOS prefers x86_64, but OpenJ9 on macOS and HotSpot/OpenJ9 elsewhere
|
||||||
// give amd64.
|
// give amd64.
|
||||||
IS_AMD64 = osArch.equals("amd64") || osArch.equals("x86_64");
|
IS_AMD64 = osArch.equals("amd64") || osArch.equals("x86_64");
|
||||||
|
IS_AARCH64 = osArch.equals("aarch64");
|
||||||
}
|
}
|
||||||
|
|
||||||
static final BooleanSupplier LINUX = () -> {
|
static final BooleanSupplier NATIVE_BASE = () -> NATIVES_ENABLED && CAN_GET_MEMORYADDRESS;
|
||||||
return NATIVES_ENABLED
|
|
||||||
&& CAN_GET_MEMORYADDRESS
|
static final BooleanSupplier LINUX_X86_64 = () -> {
|
||||||
|
return NATIVE_BASE.getAsBoolean()
|
||||||
&& System.getProperty("os.name", "").equalsIgnoreCase("Linux")
|
&& System.getProperty("os.name", "").equalsIgnoreCase("Linux")
|
||||||
&& IS_AMD64;
|
&& IS_AMD64;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static final BooleanSupplier LINUX_AARCH64 = () -> {
|
||||||
|
return NATIVE_BASE.getAsBoolean()
|
||||||
|
&& System.getProperty("os.name", "").equalsIgnoreCase("Linux")
|
||||||
|
&& IS_AARCH64;
|
||||||
|
};
|
||||||
|
|
||||||
static final BooleanSupplier JAVA_11 = () -> {
|
static final BooleanSupplier JAVA_11 = () -> {
|
||||||
return Double.parseDouble(System.getProperty("java.specification.version")) >= 11;
|
return Double.parseDouble(System.getProperty("java.specification.version")) >= 11;
|
||||||
};
|
};
|
||||||
|
@ -62,11 +62,11 @@ public class Natives {
|
|||||||
|
|
||||||
public static final NativeCodeLoader<VelocityCompressorFactory> compress = new NativeCodeLoader<>(
|
public static final NativeCodeLoader<VelocityCompressorFactory> compress = new NativeCodeLoader<>(
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
|
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX_X86_64,
|
||||||
copyAndLoadNative("/linux_x86_64/velocity-compress.so"),
|
copyAndLoadNative("/linux_x86_64/velocity-compress.so"),
|
||||||
"libdeflate (Linux x86_64)",
|
"libdeflate (Linux x86_64)",
|
||||||
LibdeflateVelocityCompressor.FACTORY),
|
LibdeflateVelocityCompressor.FACTORY),
|
||||||
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
|
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX_AARCH64,
|
||||||
copyAndLoadNative("/linux_aarch64/velocity-compress.so"),
|
copyAndLoadNative("/linux_aarch64/velocity-compress.so"),
|
||||||
"libdeflate (Linux aarch64)",
|
"libdeflate (Linux aarch64)",
|
||||||
LibdeflateVelocityCompressor.FACTORY),
|
LibdeflateVelocityCompressor.FACTORY),
|
||||||
@ -79,10 +79,10 @@ public class Natives {
|
|||||||
|
|
||||||
public static final NativeCodeLoader<VelocityCipherFactory> cipher = new NativeCodeLoader<>(
|
public static final NativeCodeLoader<VelocityCipherFactory> cipher = new NativeCodeLoader<>(
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
|
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX_X86_64,
|
||||||
copyAndLoadNative("/linux_x86_64/velocity-cipher.so"),
|
copyAndLoadNative("/linux_x86_64/velocity-cipher.so"),
|
||||||
"mbed TLS (Linux x86_64)", NativeVelocityCipher.FACTORY),
|
"mbed TLS (Linux x86_64)", NativeVelocityCipher.FACTORY),
|
||||||
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
|
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX_AARCH64,
|
||||||
copyAndLoadNative("/linux_aarch64/velocity-cipher.so"),
|
copyAndLoadNative("/linux_aarch64/velocity-cipher.so"),
|
||||||
"mbed TLS (Linux aarch64)", NativeVelocityCipher.FACTORY),
|
"mbed TLS (Linux aarch64)", NativeVelocityCipher.FACTORY),
|
||||||
new NativeCodeLoader.Variant<>(NativeCodeLoader.ALWAYS, () -> {
|
new NativeCodeLoader.Variant<>(NativeCodeLoader.ALWAYS, () -> {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren