2018-08-02 04:22:09 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-05-24 16:56:26 +02:00
|
|
|
if [ ! -d libdeflate ]; then
|
|
|
|
echo "Cloning libdeflate..."
|
|
|
|
git clone https://github.com/ebiggers/libdeflate.git
|
2019-09-09 05:30:28 +02:00
|
|
|
fi
|
|
|
|
|
2020-05-24 16:56:26 +02:00
|
|
|
echo "Compiling libdeflate..."
|
|
|
|
cd libdeflate || exit
|
|
|
|
make
|
2019-09-09 05:30:28 +02:00
|
|
|
cd ..
|
|
|
|
|
2018-08-02 04:22:09 +02:00
|
|
|
# Modify as you need.
|
2018-12-24 18:18:36 +01:00
|
|
|
MBEDTLS_ROOT=mbedtls
|
2020-05-24 16:56:26 +02:00
|
|
|
CFLAGS="-O3 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/ -fPIC -shared -Wl,-z,noexecstack"
|
2020-06-04 20:56:17 +02:00
|
|
|
ARCH=$(uname -m)
|
|
|
|
mkdir -p src/main/resources/linux_$ARCH
|
2020-05-24 16:56:26 +02:00
|
|
|
gcc $CFLAGS -Ilibdeflate src/main/c/jni_util.c src/main/c/jni_zlib_deflate.c src/main/c/jni_zlib_inflate.c \
|
2020-06-04 20:56:17 +02:00
|
|
|
libdeflate/libdeflate.a -o src/main/resources/linux_$ARCH/velocity-compress.so
|
2020-05-24 16:56:26 +02:00
|
|
|
gcc $CFLAGS -I $MBEDTLS_ROOT/include -shared $MBEDTLS_ROOT/library/aes.c $MBEDTLS_ROOT/library/aesni.c \
|
2018-08-05 05:46:41 +02:00
|
|
|
$MBEDTLS_ROOT/library/platform.c $MBEDTLS_ROOT/library/platform_util.c src/main/c/jni_util.c src/main/c/jni_cipher.c \
|
2020-06-04 20:56:17 +02:00
|
|
|
-o src/main/resources/linux_$ARCH/velocity-cipher.so
|