2020-02-18 07:15:33 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-02-18 07:34:39 +01:00
|
|
|
if [ ! -d zlib-cf ]; then
|
|
|
|
echo "Cloning Cloudflare zlib..."
|
|
|
|
git clone -b gcc.amd64 https://github.com/cloudflare/zlib.git zlib-cf
|
2020-02-18 07:15:33 +01:00
|
|
|
fi
|
|
|
|
|
2020-02-18 07:35:54 +01:00
|
|
|
echo "Compiling Cloudflare zlib..."
|
|
|
|
cd zlib-cf
|
|
|
|
CFLAGS="-fPIC -O3 -mtune=skylake -flto" AR=gcc-ar RANLIB=gcc-ranlib ./configure --static
|
|
|
|
make clean && make
|
|
|
|
cd ..
|
2020-02-18 07:15:33 +01:00
|
|
|
|
|
|
|
# Modify as you need.
|
|
|
|
MBEDTLS_ROOT=mbedtls
|
|
|
|
CFLAGS="-O3 -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/ -fPIC -shared -mtune=skylake -flto"
|
2020-02-18 07:34:39 +01:00
|
|
|
gcc $CFLAGS -Izlib-cf 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-cf/libz.a -Wl,-z,noexecstack -o src/main/resources/linux_x64/velocity-compress.so
|
2020-02-18 07:15:33 +01:00
|
|
|
gcc $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/linux_x64/velocity-cipher.so
|