Skip to content

Building clank for Android

paul99 edited this page Mar 26, 2013 · 2 revisions

Getting the source for MIPS

Note: This building method of clank for MIPS requires android source tree to be present.

In the Android root directory do the following command sequence to checkout code:

cd external
git clone git://github.com/paul99/clank.git chrome
cd chrome
git clone git://github.com/paul99/third_party.git third_party

Building the APK

This building method consists of building native 'libchromeview' library for MIPS and replacing that library in final apk by repacking it.

Build the library

To build the library it is essential that android build environment is set and android libraries for MIPS are present.

To set up Android environment variables and eventually build the android use following commands in android root directory:

. build/envsetup.sh && lunch full_mips-eng && m -j8 

If you are building on aosp master, you need to setup a path used by out/host/{host-arch}/bin/bison (which is now in the search path before your system bison):

export BISON_PKGDATADIR=$ANDROID_BUILD_TOP/external/bison/data

In external/chrome directory build the 'libchromeview' library with the following commands:

export TARGET_ARCH=mips
cd external/chrome && . build/android/envsetup.sh && clank_gyp && make -j8 libchromeview.so

Replacing Library and Repacking APK

In external/chrome/ directory download the Chrome apk for Download section.

1. Unpack the apk:

apktool d Chrome.apk

2. Replace library and strip:

rm -rf Chrome/lib/armeabi-v7a

mkdir Chrome/lib/mips

cp ../out/Release/target.lib/libchromeview.so Chrome/lib/mips

mipsel-linux-android-strip Chrome/lib/mips/libchromeview.so

3. Update the application package:

./change_chromium_package.py -u Chrome -p com.mips.chromium -a  "Mips Chromium"

4. Repack APK with replaced library:

apktool b Chrome Chromium_unaligned.apk

5. Sign APK:

First step, generate key-store if it does not exist with:

keytool -genkey -alias my_keystore_alias -keypass mypass -keystore /path_to_keystore/mykeystore.keystore -storepass mypass -validity 180

Sign the apk with generated keystore from previus step.

jarsigner -verbose -keystore /path_to_keystore/mykeystore.keystore Chromium_unaligned.apk my_keystore_alias

When asked for password use the phrase you put after -keypass in key

generation step, which is "mypass" in this example.

6. Align APK:

zipalign -f -v 4 Chromium_unaligned.apk Chromium.apk

Install APK

adb install -r Chromium.apk