servo/servo — pull request #4206 by michaelwu (2014-12-04 01:01:08+00:00)
Title: Add a gonk port.

This is a simple port. Building and running is really rough at the moment and there's no touch input yet.

A large number of env variables need to be set to successfully build, along with a fixed skia. A device build for a Flame is recommended.

```
export GONKDIR=/home/mikew/moz/B2G
export GONK_PRODUCT=flame
export CC=arm-linux-androideabi-gcc
export ARCH_DIR=arch-arm
export CPPFLAGS="-DANDROID -DGR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE=1 -isystem $GONKDIR/bionic/libc/$ARCH_DIR/include -isystem $GONKDIR/bionic/libc/include/ -isystem $GONKDIR/bionic/libc/kernel/common -isystem $GONKDIR/bionic/libc/kernel/$ARCH_DIR -isystem $GONKDIR/bionic/libm/include -I$GONKDIR/system -I$GONKDIR/system/core/include -isystem $GONKDIR/bionic -I$GONKDIR/frameworks/native/opengl/include -I$GONKDIR/external/zlib"
export CXXFLAGS="-O2 -mandroid -fPIC $CPPFLAGS -I$GONKDIR/ndk/sources/cxx-stl/stlport/stlport -I$GONKDIR/ndk/sources/cxx-stl/system/include"
export CFLAGS="-O2 -mandroid -fPIC $CPPFLAGS -I$GONKDIR/ndk/sources/cxx-stl/stlport/stlport -I$GONKDIR/ndk/sources/cxx-stl/system/include"
export ANDROID_NDK=/home/mikew/moz/android-ndk-r9b
export ANDROID_TOOLCHAIN=/home/mikew/moz/android-ndk-r9b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
export PATH=$GONKDIR/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin:$PATH
export LDFLAGS="-mandroid -L$GONKDIR/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$GONKDIR/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$GONKDIR/out/target/product/$GONK_PRODUCT/obj/"
```

On the final link step, -C link-args="$LDFLAGS -lGLESv2" needs to be added to the rustc command to successfully build.

This works on the flame device, but the device must be freshly booted and not running b2g. Without b2g, wifi setup must be done manually. Or load a file off the sdcard. "adb shell vdc volume mount sdcard" will mount the sdcard.