devikkim / ComplieV8ForAndroid

This repository is guide for v8 using android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ComplieV8ForAndroid

This repository is guide for v8 using android

Set dependencies (on Linux:ubuntu)

  1. get depot tools more :
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

export PATH=`pwd`/depot_tools:"$PATH"
  1. make sure you have these packages installed (Linux only)
sudo apt-get install curl libc6-dev-i386 g++-multilib

Compile v8 on linux (ubuntu)

  1. install v8 (checkout version)
fetch v8
cd v8
git pull
git checkout <v8_version>
  1. download android tools
echo "target_os = ['android']" >> ../.gclient && gclient sync
  1. check v8gen.py list
tools/dev/v8gen.py list

example :

arm.debug
arm.optdebug
arm.release
arm64.debug
arm64.optdebug
arm64.release
ia32.debug
ia32.optdebug
ia32.release
x64.debug
x64.optdebug
x64.release
  1. generate compilation target
tools/dev/v8gen.py gen <one_of_list>
  1. change out.gn/<one_of_list>/args.gn
vi out.gn/<one_of_list>/args.gn

example :

args.gn file

v8_use_snapshot = true
v8_use_external_startup_data = false
is_official_build = true
is_debug = false
symbol_level = 0
target_cpu = "arm"
v8_target_cpu = "arm"
v8_enable_i18n_support = false
target_os = "android"
v8_android_log_stdout = true
  1. compile target
ninja -C out.gn/<one_of_list> -j 4
  1. create lib files
cd out.gn/<one_of_list>/obj
mkdir libs
cd libs
ar -rcsD libv8_base.a ../v8_base/*.o
ar -rcsD libv8_base.a ../v8_libbase/*.o
ar -rcsD libv8_base.a ../v8_libsampler/*.o
ar -rcsD libv8_base.a ../v8_libplatform/*.o 
ar -rcsD libv8_base.a ../src/inspector/inspector/*.o
ar -rcsD libv8_snapshot.a ../v8_snapshot/*.o 
ar -rcsD libv8_nosnapshot.a ../v8_nosnapshot/*.o
ar -rcsD libv8_external_snapshot.a ../v8_external_snapshot/*.o

Maybe not all of the above files are created. But it does not matter. Only the libv8_base.a and libv8_nosnapshot.a files need to be created.

  1. source headers, for inspector compilation. copy v8 compliation header files
mkdir -p src/base/platform
cp -R ../../../../src/*.h ./src
cp -R ../../../../src/base/*.h ./src/base
cp -R ../../../../src/base/platform/*.h ./src/base/platform
cp -R ../../../../include ./
  1. Make sure the file has been created in path/to/v8/out.gn/<one_of_list>/obj/libs/

About

This repository is guide for v8 using android