3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00
Velocity/native/compile-osx.sh
Andrew Steinborn e21c33d435 Switch to zlib-ng
zlib-ng boasts higher throughput than regular zlib, by combining patches
from Cloudflare, zlib, and ARM's improvements to zlib along with a more
modern codebase.

Profiling consistently shows that compression is the largest CPU expense
by far, so even a minor speed-up here is significant.
2019-09-08 23:30:28 -04:00

23 Zeilen
938 B
Bash
Ausführbare Datei

#!/bin/bash
if [ ! -d zlib-ng ]; then
echo "Cloning zlib-ng..."
git clone https://github.com/zlib-ng/zlib-ng.git
fi
echo "Compiling zlib-ng..."
cd zlib-ng
CFLAGS="-fPIC -O3" ./configure --zlib-compat --static
make clean && make
cd ..
# Modify as you need.
MBEDTLS_ROOT=mbedtls
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
CFLAGS="-O3 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin/ -fPIC -shared"
clang $CFLAGS -Izlib-ng src/main/c/jni_util.c src/main/c/jni_zlib_deflate.c src/main/c/jni_zlib_inflate.c \
src/main/c/jni_zlib_common.c zlib-ng/libz.a -o src/main/resources/macosx/velocity-compress.dylib
clang $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 \
-o src/main/resources/macosx/velocity-cipher.dylib