-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathv8_compile.sh
executable file
·92 lines (72 loc) · 1.6 KB
/
v8_compile.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
set -e
dir="$(cd "$(dirname "$0")" && pwd)"
v8_dir="${dir}/v8"
if [ ! -d "$v8_dir" ]; then
echo "v8 not found at $v8_dir"
exit 1
fi
depot_tools_dir="${v8_dir}/third_party/depot_tools"
if [ ! -d "$depot_tools_dir" ]; then
depot_tools_dir="${dir}/depot_tools"
fi
PATH="${depot_tools_dir}:$PATH"
export PATH
os="$RUNNER_OS"
if [ -z "$os" ]; then
case "$(uname -s)" in
Linux)
os="Linux"
;;
Darwin)
os="macOS"
;;
*)
echo "Unknown OS type"
exit 1
esac
fi
cores="2"
if [ "$os" = "Linux" ]; then
cores="$(grep -c processor /proc/cpuinfo)"
elif [ "$os" = "macOS" ]; then
cores="$(sysctl -n hw.logicalcpu)"
fi
if [ -n "$RUNNER_ARCH" ]; then
target_cpu="$(echo $RUNNER_ARCH | tr '[:upper:]' '[:lower:]')"
else
case "$(uname -m)" in
x86_64)
target_cpu="x64"
;;
x86|i386|i686)
target_cpu="x86"
;;
arm64|aarch64)
target_cpu="arm64"
;;
arm*)
target_cpu="arm"
;;
esac
fi
echo "Building V8 for $os $target_cpu"
cc_wrapper=""
if command -v ccache >/dev/null 2>&1 ; then
cc_wrapper="ccache"
fi
gn_args="$(grep -v "^#" "${dir}/args/${os}.gn" | grep -v "^$")
cc_wrapper=\"$cc_wrapper\"
target_cpu=\"$target_cpu\"
v8_target_cpu=\"$target_cpu\""
cd "${dir}/v8"
gn gen "./out/release" --args="$gn_args"
echo "==================== Build args start ===================="
gn args "./out/release" --list | tee "${dir}/gn-args_${os}.txt"
echo "==================== Build args end ===================="
(
set -x
ninja -C "./out/release" -j "$cores" v8_monolith
)
ls -lh ./out/release/obj/libv8_*.a
cd -