-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-build.sh
executable file
·53 lines (42 loc) · 1.98 KB
/
pre-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
#!/usr/bin/env bash
source ~/.bash_profile
dir=`pwd`
export AARCH64LINUX_ANDROID_OPENSSL_INCLUDE_DIR="`pwd`/app/rust/libnode/include"
export AARCH64_LINUX_ANDROID_OPENSSL_LIB_DIR="`pwd`/app/rust/libnode/bin/arm64-v8a"
export I686_LINUX_ANDROID_OPENSSL_INCLUDE_DIR="`pwd`/app/rust/libnode/include"
export I686_LINUX_ANDROID_OPENSSL_LIB_DIR="`pwd`/app/rust/libnode/bin/x86"
export ARMV7_LINUX_ANDROIDEABI_OPENSSL_INCLUDE_DIR="`pwd`/app/rust/libnode/include"
export ARMV7_LINUX_ANDROIDEABI_OPENSSL_LIB_DIR="`pwd`/app/rust/libnode/bin/armeabi-v7a"
NDK_STANDALONE=$HOME/ndk-standalone
export PATH="$PATH":"$NDK_STANDALONE/arm64/bin"
export PATH="$PATH":"$NDK_STANDALONE/arm/bin"
export PATH="$PATH":"$NDK_STANDALONE/x86/bin"
create_standalone_ndk() {
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android
rustup target add wasm32-unknown-unknown
mkdir -p ${NDK_STANDALONE}
${NDK_HOME}/build/tools/make_standalone_toolchain.py --api 21 --arch arm64\
--install-dir ${NDK_STANDALONE}/arm64
${NDK_HOME}/build/tools/make_standalone_toolchain.py --api 21 --arch arm\
--install-dir ${NDK_STANDALONE}/arm
${NDK_HOME}/build/tools/make_standalone_toolchain.py --api 21 --arch x86\
--install-dir ${NDK_STANDALONE}/x86
}
if ! [[ -d ${NDK_STANDALONE} ]]
then
create_standalone_ndk
fi
# node ./gen-config.js
cd `pwd`/app/rust
# rm -f ./target/arm64-v8a/librust.a
rm -f ./target/armeabi-v7a/librust.a
rm -f ./target/x86/librust.a
# RUST_BACKTRACE=1 cargo +nightly build --target aarch64-linux-android --release
# RUST_BACKTRACE=1 cargo build --target armv7-linux-androideabi
RUST_BACKTRACE=1 cargo build --target i686-linux-android
# mkdir -p ./target/arm64-v8a
mkdir -p ./target/armeabi-v7a
mkdir -p ./target/x86
# cp ./target/aarch64-linux-android/release/librust.a ./target/arm64-v8a/librust.a
# cp ./target/armv7-linux-androideabi/debug/librust.a ./target/armeabi-v7a/librust.a
cp ./target/i686-linux-android/debug/librust.a ./target/x86/librust.a