-
Notifications
You must be signed in to change notification settings - Fork 0
/
html2md-build.sh
executable file
·60 lines (46 loc) · 1.91 KB
/
html2md-build.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -e
cd $(dirname $0)
readonly JNI_LIBS="$PWD/app/src/main/jniLibs"
readonly NDK_PATH="$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin"
export PATH="$PATH:$NDK_PATH"
# create JNI libs if not done yet
mkdir -pv $JNI_LIBS/{armeabi-v7a,arm64-v8a,x86,x86_64}
cd $PWD/html2md
echo "Setting up cargo configuration"
export CARGO_HOME="$PWD/.cargo"
mkdir -pv "$CARGO_HOME"
cat <<EOF > "$CARGO_HOME/config"
[target.aarch64-linux-android]
ar = "$NDK_PATH/aarch64-linux-android-ar"
linker = "$NDK_PATH/aarch64-linux-android21-clang"
[target.armv7-linux-androideabi]
ar = "$NDK_PATH/arm-linux-androideabi-ar"
linker = "$NDK_PATH/armv7a-linux-androideabi21-clang"
[target.i686-linux-android]
ar = "$NDK_PATH/i686-linux-android-ar"
linker = "$NDK_PATH/i686-linux-android21-clang"
[target.x86_64-linux-android]
ar = "$NDK_PATH/x86_64-linux-android-ar"
linker = "$NDK_PATH/x86_64-linux-android21-clang"
EOF
echo "Building for armv7..."
export CC=armv7a-linux-androideabi21-clang
export CXX=armv7a-linux-androideabi21-clang++
cargo build --lib --release --target armv7-linux-androideabi
cp -v target/armv7-linux-androideabi/release/libhtml2md.so $JNI_LIBS/armeabi-v7a/libhtml2md.so
echo "Building for aarch64..."
export CC=aarch64-linux-android21-clang
export CXX=aarch64-linux-android21-clang++
cargo build --lib --release --target aarch64-linux-android
cp -v target/aarch64-linux-android/release/libhtml2md.so $JNI_LIBS/arm64-v8a/libhtml2md.so
echo "Building for i686..."
export CC=i686-linux-android21-clang
export CXX=i686-linux-android21-clang++
cargo build --lib --release --target i686-linux-android
cp -v target/i686-linux-android/release/libhtml2md.so $JNI_LIBS/x86/libhtml2md.so
echo "Building for v86_64..."
export CC=x86_64-linux-android21-clang
export CXX=x86_64-linux-android21-clang++
cargo build --lib --release --target x86_64-linux-android
cp -v target/x86_64-linux-android/release/libhtml2md.so $JNI_LIBS/x86_64/libhtml2md.so