Android: Difference between revisions

1,432 bytes removed ,  16 March 2010
no edit summary
No edit summary
Line 35: Line 35:


* Standard [https://developer.mozilla.org/En/Linux_Build_Prerequisites Linux build environment] or [https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites Mac OS X build environment]
* Standard [https://developer.mozilla.org/En/Linux_Build_Prerequisites Linux build environment] or [https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites Mac OS X build environment]
* [http://developer.android.com/sdk/ndk/1.6_r1/index.html Android 1.6 NDK]
* [http://developer.android.com/sdk/ndk/index.html Android r3 NDK]
* [http://developer.android.com/sdk/ Android SDK]
* [http://developer.android.com/sdk/ Android SDK]


==== Quickstart (Linux) ====
==== Quickstart (Linux) ====
Just paste these commands into your terminal to download and install the NDK and SDK.
Download the SDK and NDK:


# get SDK and NDK
  wget http://dl.google.com/android/android-sdk_r05-linux_86.tgz
  wget http://dl.google.com/android/android-sdk_r04-linux_86.tgz &&
  wget http://dl.google.com/android/ndk/android-ndk-r3-linux-x86.zip
  wget http://dl.google.com/android/ndk/android-ndk-1.6_r1-linux-x86.zip &&
 
Then unpack them:
# unpack SDK and NDK
 
  unzip android-ndk-1.6_r1-linux-x86.zip &&
  unzip android-ndk-r3-linux-x86.zip
  tar xvfz android-sdk_r04-linux_86.tgz &&
  tar xvfz android-sdk_r05-linux_86.tgz
# setup NDK
cd android-ndk-1.6_r1 &&
build/host-setup.sh &&
cd ..


The SDK needs to be setup manually.
The SDK needs to be setup manually.
Line 60: Line 55:
* Click Save & Apply
* Click Save & Apply
* Installed Packages->Update All...
* Installed Packages->Update All...
* You may uncheck everything you don't need. Just installing the latest 1.x and 2.x SDKs is fine.
* Select at least the Android SDK, API level 6. Optinally you can install API levels 4 and 7.
* Click Install Accepted
* Click Install, Accept, etc.


=== Building ===
=== Building ===
==== Fix headers ====
Certain header files in the NDK do not compile as C++. Paste this command in your terminal while in the NDK directory to patch them.
patch -Np1 << "EOF"
--- android-ndk-1.6_r1-orig/build/platforms/android-4/arch-arm/usr/include/android/log.h 2009-07-28 17:26:01.000000000 -0700
+++ android-ndk-1.6_r1/build/platforms/android-4/arch-arm/usr/include/android/log.h 2010-01-15 17:37:23.000000000 -0800
@@ -85,7 +85,7 @@
      ANDROID_LOG_WARN,
      ANDROID_LOG_ERROR,
      ANDROID_LOG_FATAL,
-    ANDROID_LOG_SILENT,    /* only for SetMinPriority(); must be last */
+    ANDROID_LOG_SILENT    /* only for SetMinPriority(); must be last */
  } android_LogPriority;
 
  /*
--- android-ndk-1.6_r1-orig/build/platforms/android-4/arch-arm/usr/include/asm-generic/siginfo.h 2009-07-28 17:26:01.000000000 -0700
+++ android-ndk-1.6_r1/build/platforms/android-4/arch-arm/usr/include/asm-generic/siginfo.h 2010-01-15 17:37:10.000000000 -0800
@@ -55,7 +55,7 @@
  struct {
  timer_t _tid;
  int _overrun;
- char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
+ //char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
  sigval_t _sigval;
  int _sys_private;
  } _timer;
--- android-ndk-1.6_r1-orig/build/platforms/android-4/arch-arm/usr/include/dlfcn.h 2009-07-28 17:26:01.000000000 -0700
+++ android-ndk-1.6_r1/build/platforms/android-4/arch-arm/usr/include/dlfcn.h 2010-01-15 17:37:10.000000000 -0800
@@ -42,7 +42,7 @@
    RTLD_LAZY = 1,
 
    RTLD_LOCAL  = 0,
-  RTLD_GLOBAL = 2,
+  RTLD_GLOBAL = 2
  };
 
  #define RTLD_DEFAULT  ((void*) 0xffffffff)
EOF


==== Full Build ====
==== Full Build ====


Normal build, with the following mozconfig:
Normal Firefox build, with the following mozconfig.  If building fennec, clone the mobile-browser repo as 'mobile' in the toplevel mozilla dir.  This assumes that the NDK/SDK were unpacked in the parent directory; if they're elsewhere, change the paths accordingly.


  ac_add_options --enable-application=browser
  ac_add_options --enable-application=browser
Line 130: Line 85:
  # android options
  # android options
  ac_add_options --target=arm-android-eabi
  ac_add_options --target=arm-android-eabi
  ac_add_options --with-android-ndk="$PWD/../android-ndk-1.6_r1"
  ac_add_options --with-android-sdk="$PWD/../android-sdk-linux_86/platforms/android-2.0.1"
  ac_add_options --with-android-ndk="$PWD/../android-ndk-r3"
  ac_add_options --with-android-sdk="$PWD/../android-sdk-linux_86/platforms/android-6"
  ac_add_options --with-android-tools="$PWD/../android-sdk-linux_86/tools"
  ac_add_options --with-android-tools="$PWD/../android-sdk-linux_86/tools"
  ac_add_options --with-endian=little
  ac_add_options --with-endian=little
Line 144: Line 100:
  ac_add_options --disable-tests
  ac_add_options --disable-tests


This assumes the NDK was installed in the parent directory. The SDK paths will also need to be adjusted depending on where the SDK is installed and which android version you want to target.
A standard build should succeed with those paths (note: if you get build bustage in widget, then we're still waiting on a patch that removes the need to poke android internals for gfx).
 
After that build finishes, a make inside embedding/android should generate a gecko.apk that's installable on an Android device.


==== JS/NSPR only ====
==== JS/NSPR only ====
Confirmed users, Bureaucrats and Sysops emeriti
792

edits