Skip to content

Building VisibleV8 for Android

Sohom Datta edited this page May 9, 2024 · 2 revisions

Building VisibleV8 for Android

This is a step-by-step method for building VisibleV8 for Android from scratch. First step is to fetch the chromium code. The next step (optional) is to revert our codebase to an earlier version of chromium for which we wish to build VisibleV8. The final step is to apply the patch set and build the whole thing from scratch.

Fetch the code-base

  1. Clone the depot_tools repository:

    git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    
  2. Add depot_tools to the end of your PATH (you will probably want to put this in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools to /path/to/depot_tools:

    export PATH="$PATH:/path/to/depot_tools"

  3. Create a chromium directory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the full path has no spaces):

    mkdir ~/chromium && cd ~/chromium
    fetch --nohooks android
    
  4. cd src

  5. Install additional build dependencies: build/install-build-deps-android.sh

  6. gclient runhooks

  7. In order to set up the build, first create ninja configuration files: gn args out/Default and then edit the file with the following configurations variables

    target_os = "android"
    target_cpu = "arm64"  # See "Figuring out target_cpu" below
    

Reverting to chosen version of chromium

  1. gclient sync --with_branch_heads --with_tags
  2. git fetch
  3. We now checkout to the desired version. Make sure you know the branch code for the version you want to revert to. You can find it here: git checkout -b branch_$BRANCH branch-heads/$BRANCH
  4. gclient sync --with_branch_heads --with_tags

This concludes the second step for building chromium. We will now apply the patch set to our code base before building it.

Applying patch-set and building VisibleV8 for android

  1. Find the patch-set that corresponds with the chromium version you have checked-out with. For the sake of simplification, I am going to assume that the branch code we are going to use is 4472. The patch-set for this version can be found here. But you can find the patch-sets here. Make sure you run the following command from path/to/vv8/src/v8: patch -p1 <$VV8/patches/c1e1dff6f551c4aab857/trace-apis.diff

  2. Lastly, run the build command from path/to/vv8/src/:

    autoninja -C out/Default chrome_public_apk

Clone this wiki locally