[Optimus One, P500, V General] SWEATTAIMI:
(This is not nessesary for MAC but you can have this for further use later,

In general you will need:

Python 2.4 -- 2.7, which you can download from python.org.

JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from java.sun.com.

Git 1.7 or newer. You can find it at git-scm.com)

Setting up a Mac OS X build environment

To build the Android files in a Mac OS environment, you need an Intel/x86 machine running MacOS 10.6 (Snow Leopard).

Android must be built on a case-sensitive file system because the sources contain files that differ only in case. We recommend that you build Android on a partition that has been formatted with the journaled file system HFS+. HFS+ is required to successfully build Mac OS applications such as the Android Emulator for OS X.

Creating a case sensitive disk image

If you want to avoid partitioning/formatting your hard drive, you can use a case-sensitive disk image instead. To create the image, launch Disk Utility and select "New Image". A size of 25GB is the minimum to complete the build, larger numbers are more future-proof. Using sparse images saves space while allowing to grow later as the need arises. Be sure to select "case sensitive, journaled" as the volume format.

You can also create it from a shell with the following command:

# hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmg

This will create a .dmg (or possibly a .dmg.sparsefile) file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named "android.dmg" stored in your home directory, you can add the following to your ~/.bash_profile to mount the image when you execute "mountAndroid":

# mount the android file image

function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }

Once mounted, you'll do all your work in the "android" volume. You can eject it (unmount it) just like you would with an external drive.

Installing required packages

Install XCode from the Apple developer site http://developer.apple.com/. We recommend version 3.1.4 or newer, i.e. gcc 4.2. Version 4.x could cause difficulties. If you are not already registered as an Apple developer, you will have to create an Apple ID in order to download.

Install MacPorts from macports.org.

Note: Make sure that /opt/local/bin appears in your path BEFORE /usr/bin. If not, add

export PATH=/opt/local/bin:$PATH

to your ~/.bash_profile.

Get make, git, and GPG packages from MacPorts:

$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupg

If using Mac OS 10.4, also install bison:

$ POSIXLY_CORRECT=1 sudo port install bison

Reverting from make 3.82

There is a bug in gmake 3.82 that prevents android from building. You can install version 3.81 using MacPorts by taking the following steps:

Edit /opt/local/etc/macports/sources.conf and add a line that says

file:///Users/Shared/dports

above the rsync line. Then create this directory:

$ mkdir /Users/Shared/dports

In the new dports directory, run

$ svn co --revision 50980 http://svn.macports.org/repository/macports/trunk/dports/devel/gmake/ devel/gmake/

Create a port index for your new local repository:

$ portindex /Users/Shared/dports

Finally, install the old version of gmake with

$ sudo port install gmake @3.81

Setting a file descriptor limit

On MacOS the default limit on the number of simultaneous file descriptors open is too low and a highly parallel build process may exceed this limit.

To increase the cap, add the following lines to your ~/.bash_profile:

# set the number of open files to be 1024

ulimit -S -n 1024

Next: Download the source

Your build environment is good to go! Proceed to downloading the source....