编译 Firefox的官方link在 https://wiki.mozilla.org/Mobile/Fennec/Android, 我只是记录下实践过程而已
Linux 下的 Firefox 是用gcc/g++ 基于glibc编译的
编译Android 下的 Firefox 需要使用 Android SDK 和Android NDK
Android 的 SDK/NDK tools 使用了32 libs, 所以在 64位 Linux下,还要安装若干32位的libs
If you‘re using a 64-bit Linux, you‘ll need to install 32 bit libs to allow the toolchain binaries to run. Otherwise you
may get a "bash: file not found" error when trying to use any of the SDK/NDK tools.
确保 java javac都是1.7, 我的版本不一致,就遇到问题了
对于Android SDK的要求
Members of the Fennec team are successfully building Fennec with SDK Build Tools version
21, SDK Platform Tools 21,
and Android SDK Tools 23.0.5.
You will also need the "Android Support Library" and "Google Play Services" under Extras. In addition, you should check an Android SDK Platform, such as Android
5.0 (API 21). You can uninstall & remove all other/older SDK Platforms as well as older versions of the SDK Tools/SDK
Build Tools/SDK Platform Tools, and doing so might in fact stop the build from getting confused.
我非官方要求,而是括号中的版本成功编译。(基于API 21(Android 5.0)遇到问题,我也不想编译5.0的,所以用 API 19)
SDK
Build Tools version 21 (19.0.3)
Android
SDK Tools 23.0.5.
( 22.6.2)
Android SDK Platform API 21 (19)
Android
Support Library & Google Play Services
Firefox 编译要就写 .mozconfg 文件, 我的内容如下:
cat .mozconfig
#
ac_add_options --with-android-ndk="$HOME/android-ndk-r8e"
ac_add_options --with-android-sdk="$HOME/adt-bundle-linux-x86_64-20131030/sdk/platforms/android-19"
# android options
ac_add_options --enable-application=mobile/android
ac_add_options --target=arm-linux-androideabi
ac_add_options --with-ccache
mk_add_options MOZ_OBJDIR=./objdir-droid
mk_add_options MOZ_MAKE_FLAGS=-j4
之后运行 ./mach
build 进行编译,要生成 apk文件,需要执行 ./mach papkage
当系统显示:Your
build was successful!, 就恭喜了!
如果改了其中某个文件,使用 ./mach
<path> (比如:./mach build mozglue/linker)可以节约时间