-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-v8
executable file
·70 lines (57 loc) · 1.44 KB
/
build-v8
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
#!/bin/bash
set -eu
TARGET=${1-}
PROFILE=${2-}
if [[ "${TARGET}" == "" || "${PROFILE}" == "" ]]; then
echo "usage: $0 <target> <profile>"
exit 1
fi
case "${TARGET}" in
aarch64-unknown-linux-musl)
ARCH=aarch64
V8_CPU=arm64
;;
armv7-unknown-linux-musleabihf)
ARCH=armv7
V8_CPU=arm
;;
x86_64-unknown-linux-musl)
ARCH=x86_64
V8_CPU=x64
;;
*)
echo "unknown architecture: $1"
exit 1
esac
if read -r -d '' GN_ARGS <<EOF; then :; fi
clang_use_chrome_plugins=false
is_clang=false
is_component_build=false
is_debug=false
line_tables_only=false
treat_warnings_as_errors=false
use_custom_libcxx=false
use_glib=false
custom_toolchain="${PWD}/build:${ARCH}"
use_sysroot=false
use_gold=false
use_lld=false
v8_static_library=true
v8_monolithic=true
v8_use_external_startup_data=false
target_cpu="${V8_CPU}"
target_os="linux"
EOF
if [ "${V8_CPU}" == "arm" ]; then
GN_ARGS+=" v8_snapshot_toolchain=\"${PWD}/build:${ARCH}\""
fi
export TOOLCHAIN="${PWD}/toolchain/bin"
export CC_"${TARGET//[-]/_}"="${TOOLCHAIN}/${TARGET//-unknown}-cc"
export AR_"${TARGET//[-]/_}"="${TOOLCHAIN}/${TARGET//-unknown}-ar"
export OUTPUT="${PWD}/rusty_v8/target/${TARGET}/${PROFILE}"
export GN_ARGS="${GN_ARGS}"
export V8_FROM_SOURCE=1
echo "building v8 for ${TARGET}"
cd rusty_v8 || exit 1
cargo build --target "${TARGET}" --profile "${PROFILE//debug/dev}"
ninja -C "${OUTPUT}/gn_out" v8_monolith