3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-06 16:20:14 +01:00
Velocity/native/build-support/compile-macos.sh
Andrew Steinborn af629cf000
Fall 2024 recompile of the natives (#1416)
This time around, instead of the very ad hoc approach I have historically taken, this time we actually have a convenient script that takes care of basically all the hard work necessary, including cross-compilation.

We compile natives for Ubuntu 20.04 LTS (OpenSSL 1.1.x native and libdeflate) and Ubuntu 22.04 LTS (OpenSSL 3.x.x native), for both x86_64 and aarch64.

The macOS natives have also been recompiled on macOS Sonoma.
2024-08-31 20:30:47 -04:00

23 Zeilen
844 B
Bash
Ausführbare Datei

#!/bin/bash
if [ ! "$CC" ]; then
export CC=clang
fi
if [ ! -d libdeflate ]; then
echo "Cloning libdeflate..."
git clone --branch v1.21 --single-branch https://github.com/ebiggers/libdeflate.git
fi
echo "Compiling libdeflate..."
cd libdeflate || exit
cmake -B build && cmake --build build --target libdeflate_static
cd ..
CFLAGS="-O2 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin/ -fPIC -shared -Wall -Werror -fomit-frame-pointer"
ARCH=$(uname -m)
mkdir -p src/main/resources/macos_$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/build/libdeflate.a -o src/main/resources/macos_$ARCH/velocity-compress.dylib
$CC $CFLAGS -shared src/main/c/jni_util.c src/main/c/jni_cipher_macos.c \
-o src/main/resources/macos_$ARCH/velocity-cipher.dylib -lSystem