forked from Jpjames1/zstd-jni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_so_cross.sh
executable file
·34 lines (25 loc) · 1.04 KB
/
make_so_cross.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash -x
VERSION=$(cat version)
compile() {
ARCH=$1
CC=$2
OS=linux
BUILD_DIR="build_cross/$ARCH"
echo "Compiling for $ARCH/$OS"
INSTALL=target/classes/$OS/$ARCH
mkdir -p $BUILD_DIR
rsync -r --delete jni $BUILD_DIR/
rsync -r --delete src/main/native $BUILD_DIR
rsync ./libzstd-jni.so.map $BUILD_DIR
pushd $BUILD_DIR
$CC -shared -static-libgcc -Wl,--version-script=./libzstd-jni.so.map -fPIC -O3 -flto -DZSTD_LEGACY_SUPPORT=4 -DZSTD_MULTITHREAD=1 -I/usr/include -I./jni -I./native -I./native/common -I./native/legacy -std=c99 -lpthread -o libzstd-jni-$VERSION.so native/*.c native/legacy/*.c native/common/*.c native/compress/*.c native/decompress/*.c native/dictBuilder/*.c
popd
mkdir -p $INSTALL
cp $BUILD_DIR/libzstd-jni-$VERSION.so $INSTALL
chmod -x $INSTALL/libzstd-jni-$VERSION.so
}
compile riscv64 "riscv64-linux-gnu-gcc"
#compile arm arm-linux-gnueabihf-gcc
#compile s390x "s390x-linux-gnu-gcc -march=z196"
#compile aarch64 aarch64-linux-gnu-gcc
#compile mips64 mips64-linux-gnu-gcc