Skip to content

Doc building for android

Aydin Kim edited this page Aug 28, 2013 · 9 revisions

These are preliminary cross-build instructions of Servo for Android. We can create share object binaries for Android with in-tree Rust compiler.

At first, We need some android development tools like NDK, SDK and toolchain for cross-compile. Android NDK can be downloaded from http://developer.android.com/tools/sdk/ndk/index.html . Android SDK can be downloaded from http://developer.android.com/sdk/index.html . Install NDK and SDK refer to guideline on the website.

We should setup toolchain from NDK. Example command to setup standalone tool chain:

'ndk root'/build/tools/make-standalone-toolchain.sh --platform=android-14 --install-dir='dir to install' --ndk-dir='ndk dir'

Install the Debian packages below.

sudo apt-get install autoconf2.13 curl libtool ia32-libs

Build Servo

git clone https://github.com/mozilla/servo.git
cd servo
mkdir -p build && cd build
../configure --target-triples=arm-linux-androideabi --android-cross-path=<Android toolchain path> --android-ndk-path=<Android NDK path> --android-sdk-path=<Android SDK path>
make

Important Notices.

  • We uses freeglut of android version for window system. In this case, the application can be executed with android native application, not java app. The android freeglut has android_main internally and starts program from there so that we should link freeglut functions with rust-freeglut ffi functions to prevent program crash.

  • Different to Linux or Mac, on Android, Servo's program entry is in the library, not executable. So we could not execute program with command line arguments. We had hacked the program entry for android. You can set environment argument with 'SERVO_URL' before program beginning to specify URLs to load. example:

export SERVO_URL=http://github.com/mozilla/servo
  • Default directories are listed below
android toolchain path : /opt/ndk_standalone
android NDK path : /opt/android-ndk
android SDK path : /opt/android-sdk

You may change these using command line arguments when configure. You can see more 'configure --help'

  • Default settings
default font directory : /system/fonts (in android)
default resource path : /sdcard/servo (in android)
default font configuration : /sdcard/servo/.fcconfig (in android)
default fallback font : Roboto

--TODO--

Clone this wiki locally