2013-11-18 21:16:06 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-06-26 03:28:42 +02:00
|
|
|
set -eu
|
2015-02-01 11:05:16 +01:00
|
|
|
|
2021-06-26 03:28:42 +02:00
|
|
|
echo "Compiling mbedtls"
|
|
|
|
(cd mbedtls && make no_test)
|
|
|
|
|
|
|
|
echo "Compiling zlib"
|
|
|
|
(cd zlib && CFLAGS=-fPIC ./configure --static && make)
|
|
|
|
|
2024-06-24 23:01:10 +02:00
|
|
|
CC="gcc"
|
|
|
|
CFLAGS="-c -fPIC -O3 -Wall -Werror -I$JAVA_HOME/include/ -I$JAVA_HOME/include/linux/"
|
|
|
|
LDFLAGS="-shared"
|
2021-06-26 03:28:42 +02:00
|
|
|
|
2024-06-24 23:01:10 +02:00
|
|
|
echo "Compiling bungee"
|
|
|
|
$CC $CFLAGS -o shared.o src/main/c/shared.c
|
|
|
|
$CC $CFLAGS -Imbedtls/include -o NativeCipherImpl.o src/main/c/NativeCipherImpl.c
|
|
|
|
$CC $CFLAGS -Izlib -o NativeCompressImpl.o src/main/c/NativeCompressImpl.c
|
|
|
|
|
|
|
|
echo "Linking native-cipher.so"
|
|
|
|
$CC $LDFLAGS -o src/main/resources/native-cipher.so shared.o NativeCipherImpl.o mbedtls/library/libmbedcrypto.a
|
|
|
|
|
|
|
|
echo "Linking native-compress.so"
|
|
|
|
$CC $LDFLAGS -o src/main/resources/native-compress.so shared.o NativeCompressImpl.o zlib/libz.a
|
|
|
|
|
|
|
|
echo "Cleaning up"
|
|
|
|
rm shared.o NativeCipherImpl.o NativeCompressImpl.o
|