Repository navigation
Expand file tree
/
Copy pathv8.sh
More file actions
93 lines (82 loc) · 2.96 KB
/
Copy pathv8.sh
File metadata and controls
93 lines (82 loc) · 2.96 KB
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
93
if [ $(uname -m) == "s390x" ]; then
MACHINE_ARCH="s390x"
elif [ $(uname -m) == "ppc64le" ]; then
MACHINE_ARCH="ppc64"
else
echo "We only build on s390x and ppc64le, exiting!"
exit 1
fi
if [[ -z "$V8_BRANCH" ]]; then
echo "V8_BRANCH is not specified, exiting!"
exit 1
fi
if [[ -z "$V8_MODE" ]]; then
echo "V8_MODE is not specified, exiting!"
exit 1
fi
if [[ ! -f /home/$MACHINE_ARCH/$V8_MODE.gn ]]; then
echo "gn args file for '$V8_MODE' mode not found, exiting!"
exit 1
fi
# Build and test V8
echo "===================================="
echo "Architecture is:" $MACHINE_ARCH
echo "Mode is:" $V8_MODE
echo "Parallel Build/Test (-j):" $NPROC
echo "===================================="
# Fetch latest v8
DEPOT_TOOLS_BOOTSTRAP_PYTHON3=0 fetch v8
cd v8
# Identify Beta and Stable branches
git branch -at |
/bin/grep branch-heads |
/bin/grep -o '/[0-9.]*\.[0-9]*' |
sed s/^.// |
sort -nr >v8-branches.txt
V8_BETA_BRANCH=$(sed '1q;d' v8-branches.txt)
V8_STABLE_BRANCH=$(sed '2q;d' v8-branches.txt)
# Checkout a branch
CHECKOUT=$V8_BRANCH
if [ "$V8_BRANCH" != "main" ]; then
if [ "$V8_BRANCH" == "beta" ]; then
CHECKOUT=branch-heads/$V8_BETA_BRANCH
elif [ "$V8_BRANCH" == "stable" ]; then
CHECKOUT=branch-heads/$V8_STABLE_BRANCH
fi
fi
echo "===================================="
echo "Checkout $CHECKOUT"
echo "===================================="
git checkout $CHECKOUT
if [ "$CHECKOUT" != "main" ]; then
DEPOT_TOOLS_BOOTSTRAP_PYTHON3=0 gclient sync
fi
# Remove compiler flags unsupported by current Clang version.
# TODO: Re-evaluate this list when upgrading Clang.
# Also check excluded platform specific flags under BUILD.gn.
find build/ \( -name "*.gn" -o -name "*.gni" \) | xargs sed -i \
-e '/-Wno-unsafe-buffer-usage-in-static-sized-array/d' \
-e '/-Wno-unused-but-set-global/d' \
-e '/-Wno-stringop-overread/d' \
-e '/-fno-lifetime-dse/d' \
-e '/-fsanitize-ignore-for-ubsan-feature/d' \
-e '/-fdiagnostics-show-inlining-chain/d'
# This workaround is needed on s390x when calling `tools/metagen/metagen.py`.
# Without it, it will crash with a `Floating point exception`.
# TODO: This is already patched on llvm main branch, remove the workaround once
# python3.12-clang package ships the fix:
# https://github.com/llvm/llvm-project/commit/f05ae44
mkdir -p /opt/metagen-clang
cp -r /usr/lib/python3.12/site-packages/clang /opt/metagen-clang/
sed -i -e 's/CFUNCTYPE(c_int, Cursor, Cursor, py_object)/CFUNCTYPE(c_longlong, Cursor, Cursor, py_object)/' \
-e 's/CFUNCTYPE(c_int, Cursor, py_object)/CFUNCTYPE(c_longlong, Cursor, py_object)/' \
/opt/metagen-clang/clang/cindex.py
# Copy args required for gn, build
cp /home/cc_wrapper.sh /bin
mkdir -p out/$MACHINE_ARCH
cp /home/$MACHINE_ARCH/$V8_MODE.gn out/$MACHINE_ARCH/args.gn
gn gen out/$MACHINE_ARCH
ninja -C out/$MACHINE_ARCH -j $NPROC
# Run the tests
python3 tools/run-tests.py -j $NPROC --time --progress=dots --timeout=240 --no-presubmit \
--outdir=out/$MACHINE_ARCH --variants=exhaustive