forked from puerts/backend-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
android-static.sh
executable file
·78 lines (67 loc) · 2.59 KB
/
android-static.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
[ -z "$GITHUB_WORKSPACE" ] && GITHUB_WORKSPACE="$( cd "$( dirname "$0" )"/.. && pwd )"
WORKSPACE=$GITHUB_WORKSPACE
HOMEPATH=~
VERSION=$1
ARCH="$2"
WITH_SSL=$3
case $ARCH in
arm)
OUTPUT="armeabi-v7a"
;;
x86)
OUTPUT="x86"
;;
x86_64)
OUTPUT="x64"
;;
arm64|aarch64)
OUTPUT="arm64-v8a"
;;
*)
echo "Unsupported architecture provided: $ARCH"
exit 1
;;
esac
cd $HOMEPATH
git clone https://github.com/nodejs/node.git
cd node
git fetch origin v$VERSION
git checkout v$VERSION
echo "=====[Patching Node.js]====="
node $WORKSPACE/node-script/do-gitpatch.js -p $WORKSPACE/patchs/android_disable_alink_thin_v$VERSION.patch
node $WORKSPACE/node-script/do-gitpatch.js -p $WORKSPACE/patchs/lib_uv_add_on_watcher_queue_updated_v$VERSION.patch
node $WORKSPACE/node-script/do-gitpatch.js -p $WORKSPACE/patchs/fix_no_handler_inside_posix_v$VERSION.patch
node $WORKSPACE/node-script/add_arraybuffer_new_without_stl.js deps/v8
node $WORKSPACE/node-script/make_v8_inspector_export.js
echo "=====[Building Node.js]====="
cp $WORKSPACE/android-configure-static ./
./android-configure-static ~/android-ndk-r21b $2 24 $WITH_SSL
make -j8
mkdir -p ../puerts-node/nodejs/lib/Android/$OUTPUT/
cp \
out/Release/obj.target/deps/histogram/libhistogram.a \
out/Release/obj.target/deps/uvwasi/libuvwasi.a \
out/Release/obj.target/libnode.a \
out/Release/obj.target/libnode_stub.a \
out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a \
out/Release/obj.target/tools/v8_gypfiles/libv8_libplatform.a \
out/Release/obj.target/deps/zlib/libzlib.a \
out/Release/obj.target/deps/llhttp/libllhttp.a \
out/Release/obj.target/deps/cares/libcares.a \
out/Release/obj.target/deps/uv/libuv.a \
out/Release/obj.target/deps/nghttp2/libnghttp2.a \
out/Release/obj.target/deps/brotli/libbrotli.a \
out/Release/obj.target/deps/openssl/libopenssl.a \
out/Release/obj.target/tools/v8_gypfiles/libv8_base_without_compiler.a \
out/Release/obj.target/tools/v8_gypfiles/libv8_libbase.a \
out/Release/obj.target/tools/v8_gypfiles/libv8_zlib.a \
out/Release/obj.target/tools/v8_gypfiles/libv8_compiler.a \
out/Release/obj.target/tools/v8_gypfiles/libv8_initializers.a \
../puerts-node/nodejs/lib/Android/$OUTPUT/
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
if version_lt $VERSION "16"; then
cp out/Release/obj.target/tools/v8_gypfiles/libv8_libsampler.a \
../puerts-node/nodejs/lib/Android/$OUTPUT/
fi