Android

Android

Central location for information about the Android port of Gecko.

Current Status

  • NSPR builds
  • JS builds and shell runs

Getting Source Code

Currently, the source lives in a user hg repo:

http://hg.mozilla.org/users/vladimir_mozilla.com/mozilla-droid

Building

Prerequisites

The NDK is the only Android-specific prereq for building, though you will probably want the Android SDK for an emulator and tools such as 'adb'. Either 2.0 or 1.6 will do.

Building

Currently, on nspr and JS build, so you have to do two separate build steps.

In the commands below, replace these with the appropriate paths:

$NDK is the NDK location
$moz is the mozilla-droid repo checkout
$out is some base destination directory

First, regenerate configure in the js dir (the nspr configure is checked in):

% cd $moz/js/src && autoconf2.13

Then create a nspr directory, configure nspr, and build it:

% cd $out
% mkdir nspr
% cd nspr
% $moz/nsprpub/configure \
   --target=arm-android-eabi \
   --with-android-ndk=$NDK 
% make -s

Then do the same for JS, telling it where to find the NSPR you just built:

% cd $out
% mkdir js
% cd js
% $moz/js/src/configure \
   --target=arm-android-eabi \
   --with-android-ndk=$NDK \
   --with-nspr-cflags=-I$out/nspr/dist/include/nspr \
   --with-nspr-libs='-L$out/nspr/dist/lib -lnspr4 -lplc4 -lplds4' \
   --enable-threadsafe \
   --with-endian=little \
   --with-arm-kuser
% make -s

Running

You'll need to copy the NSPR libraries and the js shell to the emulator or your device. Whether you're running on a physical device or an emulator, /data/local should be writable by the user.

% cd $out/nspr/dist/lib
% for f in *.so ; do adb push $f /data/local ; done
% cd $out/js/shell
% adb push js /data/local

Then, connect to a shell on the device, and run js (adb shell prompts prefixed with "android"):

% adb shell
android% cd /data/local
android% LD_LIBRARY_PATH= ./js
js> 1+1
2