-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-android-manually.sh
executable file
·56 lines (34 loc) · 1.13 KB
/
build-android-manually.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
#!/bin/bash
set -ex
###################################################################
#配置
NODE_VERSION=14.16.1
ANDROID_NDK_HOME=~/Desktop/android-ndk-r22
ALL_SUPPORT_ABIS=(arm64 arm x86 x86_64)
###################################################################
create_env() {
local FILENAME="v$NODE_VERSION.tar.gz"
curl -L https://github.com/nodejs/node/archive/refs/tags/${FILENAME} > $FILENAME
tar zxvf $FILENAME
cp android-configure node-$NODE_VERSION/
cp common.gypi node-$NODE_VERSION/
}
build_android(){
for ANDROID_ABI in ${ALL_SUPPORT_ABIS[*]};
do
make clean
./android-configure $ANDROID_NDK_HOME $ANDROID_ABI 23
make -j $(getconf _NPROCESSORS_ONLN)
NDK_ARCH_NAME=$ANDROID_ABI
if [ $NDK_ARCH_NAME == "arm" ]; then
NDK_ARCH_NAME="armeabi-v7a"
elif [ $NDK_ARCH_NAME == "arm64" ]; then
NDK_ARCH_NAME="arm64-v8a"
fi
mkdir -p ./out/Release/share_library/android/bin/$NDK_ARCH_NAME/
cp ./out/Release/obj.target/libnode.so ./out/Release/share_library/android/bin/$NDK_ARCH_NAME/libnode.so
done
}
create_env
cd node-$NODE_VERSION
build_android