3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 13:30:17 +01:00
Velocity/native/compile-linux.sh
Andrew Steinborn 0f919d7163 Recompile natives for Linux x86_64
Debian 9 was used to compile the libdeflate native and OpenSSL 1.1.x crypto, CentOS for OpenSSL 1.0.x crypto only.
2020-10-27 01:44:14 -04:00

25 Zeilen
947 B
Bash
Ausführbare Datei

#!/bin/bash
if [ ! "$CC" ]; then
# The libdeflate authors recommend that we build using GCC as it produces "slightly faster binaries":
# https://github.com/ebiggers/libdeflate#for-unix
export CC=gcc
fi
if [ ! -d libdeflate ]; then
echo "Cloning libdeflate..."
git clone https://github.com/ebiggers/libdeflate.git
fi
echo "Compiling libdeflate..."
cd libdeflate || exit
CFLAGS="-fPIC -O2 -fomit-frame-pointer" make
cd ..
CFLAGS="-O2 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/ -fPIC -shared -Wl,-z,noexecstack -Wall -Werror -fomit-frame-pointer"
ARCH=$(uname -m)
mkdir -p src/main/resources/linux_$ARCH
$CC $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_$ARCH/velocity-compress.so
$CC $CFLAGS -shared src/main/c/jni_util.c src/main/c/jni_cipher.c \
-o src/main/resources/linux_$ARCH/velocity-cipher.so -lcrypto