geforkt von Mirrors/Velocity
Lay down foundation for cross-architecture natives
We have dropped the rarely used kqueue and replaced it with the new Netty aarch64 native. In addition, lay down the foundation for other aarch64 natives.
Dieser Commit ist enthalten in:
Ursprung
456b4b217f
Commit
bb69481f99
@ -13,8 +13,10 @@ cd ..
|
|||||||
# Modify as you need.
|
# Modify as you need.
|
||||||
MBEDTLS_ROOT=mbedtls
|
MBEDTLS_ROOT=mbedtls
|
||||||
CFLAGS="-O3 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/ -fPIC -shared -Wl,-z,noexecstack"
|
CFLAGS="-O3 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/ -fPIC -shared -Wl,-z,noexecstack"
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
mkdir -p src/main/resources/linux_$ARCH
|
||||||
gcc $CFLAGS -Ilibdeflate src/main/c/jni_util.c src/main/c/jni_zlib_deflate.c src/main/c/jni_zlib_inflate.c \
|
gcc $CFLAGS -Ilibdeflate src/main/c/jni_util.c src/main/c/jni_zlib_deflate.c src/main/c/jni_zlib_inflate.c \
|
||||||
libdeflate/libdeflate.a -o src/main/resources/linux_x64/velocity-compress.so
|
libdeflate/libdeflate.a -o src/main/resources/linux_$ARCH/velocity-compress.so
|
||||||
gcc $CFLAGS -I $MBEDTLS_ROOT/include -shared $MBEDTLS_ROOT/library/aes.c $MBEDTLS_ROOT/library/aesni.c \
|
gcc $CFLAGS -I $MBEDTLS_ROOT/include -shared $MBEDTLS_ROOT/library/aes.c $MBEDTLS_ROOT/library/aesni.c \
|
||||||
$MBEDTLS_ROOT/library/platform.c $MBEDTLS_ROOT/library/platform_util.c src/main/c/jni_util.c src/main/c/jni_cipher.c \
|
$MBEDTLS_ROOT/library/platform.c $MBEDTLS_ROOT/library/platform_util.c src/main/c/jni_util.c src/main/c/jni_cipher.c \
|
||||||
-o src/main/resources/linux_x64/velocity-cipher.so
|
-o src/main/resources/linux_$ARCH/velocity-cipher.so
|
@ -63,8 +63,12 @@ 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,
|
||||||
copyAndLoadNative("/linux_x64/velocity-compress.so"),
|
copyAndLoadNative("/linux_x86_64/velocity-compress.so"),
|
||||||
"libdeflate (Linux amd64)",
|
"libdeflate (Linux x86_64)",
|
||||||
|
LibdeflateVelocityCompressor.FACTORY),
|
||||||
|
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
|
||||||
|
copyAndLoadNative("/linux_aarch64/velocity-compress.so"),
|
||||||
|
"libdeflate (Linux aarch64)",
|
||||||
LibdeflateVelocityCompressor.FACTORY),
|
LibdeflateVelocityCompressor.FACTORY),
|
||||||
new NativeCodeLoader.Variant<>(NativeConstraints.JAVA_11, () -> {
|
new NativeCodeLoader.Variant<>(NativeConstraints.JAVA_11, () -> {
|
||||||
}, "Java 11", () -> Java11VelocityCompressor.FACTORY),
|
}, "Java 11", () -> Java11VelocityCompressor.FACTORY),
|
||||||
@ -76,8 +80,11 @@ 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,
|
||||||
copyAndLoadNative("/linux_x64/velocity-cipher.so"), "mbed TLS (Linux amd64)",
|
copyAndLoadNative("/linux_x86_64/velocity-cipher.so"),
|
||||||
NativeVelocityCipher.FACTORY),
|
"mbed TLS (Linux x86_64)", NativeVelocityCipher.FACTORY),
|
||||||
|
new NativeCodeLoader.Variant<>(NativeConstraints.LINUX,
|
||||||
|
copyAndLoadNative("/linux_aarch64/velocity-cipher.so"),
|
||||||
|
"mbed TLS (Linux aarch64)", NativeVelocityCipher.FACTORY),
|
||||||
new NativeCodeLoader.Variant<>(NativeCodeLoader.ALWAYS, () -> {
|
new NativeCodeLoader.Variant<>(NativeCodeLoader.ALWAYS, () -> {
|
||||||
}, "Java", JavaVelocityCipher.FACTORY)
|
}, "Java", JavaVelocityCipher.FACTORY)
|
||||||
)
|
)
|
||||||
|
@ -48,8 +48,7 @@ dependencies {
|
|||||||
compile "io.netty:netty-handler:${nettyVersion}"
|
compile "io.netty:netty-handler:${nettyVersion}"
|
||||||
compile "io.netty:netty-transport-native-epoll:${nettyVersion}"
|
compile "io.netty:netty-transport-native-epoll:${nettyVersion}"
|
||||||
compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64"
|
compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64"
|
||||||
compile "io.netty:netty-transport-native-kqueue:${nettyVersion}"
|
compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-aarch64"
|
||||||
compile "io.netty:netty-transport-native-kqueue:${nettyVersion}:osx-x86_64"
|
|
||||||
compile "io.netty:netty-resolver-dns:${nettyVersion}"
|
compile "io.netty:netty-resolver-dns:${nettyVersion}"
|
||||||
|
|
||||||
compile "org.apache.logging.log4j:log4j-api:${log4jVersion}"
|
compile "org.apache.logging.log4j:log4j-api:${log4jVersion}"
|
||||||
|
@ -7,11 +7,6 @@ import io.netty.channel.epoll.EpollDatagramChannel;
|
|||||||
import io.netty.channel.epoll.EpollEventLoopGroup;
|
import io.netty.channel.epoll.EpollEventLoopGroup;
|
||||||
import io.netty.channel.epoll.EpollServerSocketChannel;
|
import io.netty.channel.epoll.EpollServerSocketChannel;
|
||||||
import io.netty.channel.epoll.EpollSocketChannel;
|
import io.netty.channel.epoll.EpollSocketChannel;
|
||||||
import io.netty.channel.kqueue.KQueue;
|
|
||||||
import io.netty.channel.kqueue.KQueueDatagramChannel;
|
|
||||||
import io.netty.channel.kqueue.KQueueEventLoopGroup;
|
|
||||||
import io.netty.channel.kqueue.KQueueServerSocketChannel;
|
|
||||||
import io.netty.channel.kqueue.KQueueSocketChannel;
|
|
||||||
import io.netty.channel.nio.NioEventLoopGroup;
|
import io.netty.channel.nio.NioEventLoopGroup;
|
||||||
import io.netty.channel.socket.DatagramChannel;
|
import io.netty.channel.socket.DatagramChannel;
|
||||||
import io.netty.channel.socket.ServerSocketChannel;
|
import io.netty.channel.socket.ServerSocketChannel;
|
||||||
@ -27,11 +22,7 @@ enum TransportType {
|
|||||||
(name, type) -> new NioEventLoopGroup(0, createThreadFactory(name, type))),
|
(name, type) -> new NioEventLoopGroup(0, createThreadFactory(name, type))),
|
||||||
EPOLL("epoll", EpollServerSocketChannel.class, EpollSocketChannel.class,
|
EPOLL("epoll", EpollServerSocketChannel.class, EpollSocketChannel.class,
|
||||||
EpollDatagramChannel.class,
|
EpollDatagramChannel.class,
|
||||||
(name, type) -> new EpollEventLoopGroup(0, createThreadFactory(name, type))),
|
(name, type) -> new EpollEventLoopGroup(0, createThreadFactory(name, type)));
|
||||||
KQUEUE("Kqueue", KQueueServerSocketChannel.class, KQueueSocketChannel.class,
|
|
||||||
KQueueDatagramChannel.class,
|
|
||||||
(name, type) -> new KQueueEventLoopGroup(0, createThreadFactory(name, type)));
|
|
||||||
|
|
||||||
|
|
||||||
final String name;
|
final String name;
|
||||||
final Class<? extends ServerSocketChannel> serverSocketChannelClass;
|
final Class<? extends ServerSocketChannel> serverSocketChannelClass;
|
||||||
@ -71,8 +62,6 @@ enum TransportType {
|
|||||||
|
|
||||||
if (Epoll.isAvailable()) {
|
if (Epoll.isAvailable()) {
|
||||||
return EPOLL;
|
return EPOLL;
|
||||||
} else if (KQueue.isAvailable()) {
|
|
||||||
return KQUEUE;
|
|
||||||
} else {
|
} else {
|
||||||
return NIO;
|
return NIO;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren