The following instructions fetch the Google V8 JavaScript engine to your local machine, configure it to create static libraries, and install the resulting artifacts to the location where the MultiChain build system expects to find them.
MultiChain uses V8 version 6.8, and requires at least 4 GB of RAM to build in a reasonable time. It will not build at all with less than 2 GB RAM.
sudo apt-get update
sudo apt-get -y install git python pkg-config build-essential
Google's depot_tools are used by the Google build system to manage Git checkouts.
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=${PATH}:$(pwd)/depot_tools
The following commands check out V8 and select the branch used by MultiChain. Please note that this step downloads about 2 GB of data, and can take a long time (30 minutes or more).
gclient
fetch v8
cd v8
git checkout 6.8-lkgr
The V8 build system currently uses a proprietary version of the Ninja build system, called GN. It is part of the depot_tools
installed earlier.
find . -name BUILD.gn -exec sed -i '/exe_and_shlib_deps/d' {} \;
tools/dev/v8gen.py x64.release
RELEASE=out.gn/x64.release
cat > $RELEASE/args.gn << END
is_debug = false
target_cpu = "x64"
is_component_build = false
v8_static_library = true
use_custom_libcxx = false
use_custom_libcxx_for_host = false
END
gn gen $RELEASE
The Ninja command builds the V8 libraries and data files. The installation location (${HOME}/local/v8
) is currently hard-coded into the MultiChain build system. This will change soon in a future Alpha release.
ninja -C $RELEASE
LIB_DIR=${RELEASE}/obj
PREFIX=${HOME}/local/v8
pushd ${LIB_DIR}
mkdir full
for lib in libv8*.a;
do ar -t $lib | xargs ar rvs $lib.new && mv -v $lib.new full/$lib;
done
cd third_party/icu
mkdir full
for lib in *.a;
do ar -t $lib | xargs ar rvs $lib.new && mv -v $lib.new full/$lib;
done
popd
rm -rf $PREFIX
mkdir -p $PREFIX/include/libplatform $PREFIX/lib $PREFIX/data
install -m 644 -vt $PREFIX/include include/*.h
install -m 644 -vt $PREFIX/include/libplatform include/libplatform/*.h
install -m 644 -vt $PREFIX/lib $LIB_DIR/full/libv8*.a $LIB_DIR/third_party/icu/full/*.a
install -vt $PREFIX/data $RELEASE/*.bin $RELEASE/icudtl.dat