3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00
Velocity/native/compile-macos.sh

23 Zeilen
813 B
Bash

2022-06-08 07:18:19 +02:00
#!/bin/bash
if [ ! "$CC" ]; then
export CC=clang
fi
if [ ! -d libdeflate ]; then
echo "Cloning libdeflate..."
git clone https://github.com/ebiggers/libdeflate.git
fi
echo "Compiling libdeflate..."
cd libdeflate || exit
cmake -B build && cmake --build build --target libdeflate_static
2022-06-08 07:18:19 +02:00
cd ..
CFLAGS="-O2 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin/ -fPIC -shared -Wall -Werror -fomit-frame-pointer"
ARCH=$(uname -m)
2022-06-08 15:58:15 +02:00
mkdir -p src/main/resources/macos_$ARCH
2022-06-08 07:18:19 +02:00
$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
2022-06-08 07:18:19 +02:00
$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