xref: /6.0.3/tlm/deps/packages/v8/v8_unix.sh (revision 8bbe7c2d)
1#!/bin/bash -ex
2
3INSTALL_DIR=$1
4PLATFORM=$2
5
6pushd `dirname $0` > /dev/null
7SCRIPTPATH=`pwd -P`
8popd > /dev/null
9
10case "$PLATFORM" in
11    ubuntu14.04|debian7|debian8|debian9)
12        # The buildslave images should contain this package. However
13        # we're doing this v8 upgrade right in the last days of Spock,
14        # and re-building the buildslaves images seems an unnecessary risk.
15        sudo apt-get update && sudo apt-get install -y pkg-config
16        ;;
17esac
18
19# Some old Linuxes have a glibc version too old to work with the tools
20# in the Google-provided toolchain. So, we have to use a hackier build
21# process. Isolate that away in a separate script
22case "$PLATFORM" in
23    suse11*|centos6|debian7)
24        exec $SCRIPTPATH/v8_old_unix.sh $INSTALL_DIR $PLATFORM
25        ;;
26esac
27
28# Get Google's depot_tools; checkout from October 18th, 2018,
29# which worked for the SuSE platforms on the last build.
30git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
31pushd depot_tools && git checkout 93277a7 && popd
32export PATH=`pwd`/depot_tools:$PATH
33
34# Disable gclient auto-update (won't work anyway since we're using a
35# vendored copy)
36export DEPOT_TOOLS_UPDATE=0
37
38# Use gclient (from depot_tools) to sync our vendored version
39# of v8. Note: this is not truly vendored, as both depot_tools
40# and the v8 build download many things from Google as part
41# of the build. Therefore we can't guarantee this will work
42# indefinitely. I could not find a way around this issue.
43# I do pull our couchbasedeps version of icu4c to ensure that
44# couchbase can link against libv8.so with our cbdeps icu4c.
45cat > .gclient <<EOF
46solutions = [
47  {
48    "url": "https://github.com/couchbasedeps/v8.git@5.9.223",
49    "managed": False,
50    "name": "v8",
51    "deps_file": "DEPS",
52    "custom_deps": { "v8/third_party/icu": "https://chromium.googlesource.com/chromium/deps/icu.git@origin/chromium/59staging" },
53  },
54];
55EOF
56gclient sync --noprehooks --nohooks
57gclient runhooks
58
59# On Debian 9 (and others?), we want DT_RUNPATH enabled on libv8.so
60# and friends. This ridiculous hack is the only way I could find to do so.
61case "$PLATFORM" in
62    debian9)
63        pushd v8/build
64        git apply $SCRIPTPATH/v8_linux_runpath.patch
65        popd
66        ;;
67esac
68
69# Actual v8 configure and build steps - we build debug and release.
70cd v8
71V8_ARGS='target_cpu="x64" is_component_build=true v8_enable_backtrace=true v8_use_snapshot=true v8_use_external_startup_data=false v8_enable_i18n_support=true v8_test_isolation_mode="noop"'
72gn gen out.gn/release --args="$V8_ARGS is_debug=false"
73ninja -C out.gn/release
74gn gen out.gn/debug --args="$V8_ARGS is_debug=true"
75ninja -C out.gn/debug
76
77# Copy right stuff to output directory.
78mkdir -p \
79    $INSTALL_DIR/lib/Release \
80    $INSTALL_DIR/lib/Debug \
81    $INSTALL_DIR/include/libplatform
82(
83    cd out.gn/release
84    cp -avi libv8*.* $INSTALL_DIR/lib/Release
85)
86(
87    cd out.gn/debug
88    cp -avi libv8*.* $INSTALL_DIR/lib/Debug
89)
90(
91    cd include
92    cp -avi v8*.h $INSTALL_DIR/include
93    cp -avi libplatform/[a-z]*.h $INSTALL_DIR/include/libplatform
94)
95