Monday, February 02, 2009

 

Getting and building Google Android from the source code on Mac OS X

Install XCode version 3.0, available from http://developer.apple.com/technology/tools.html.

Install MacPorts, available from http://svn.macports.org/repository/macports/downloads/MacPorts-1.7.0/

Open up a terminal, check /opt/local/bin is at the start of $PATH, and run
sudo port selfupdate
Hopefully it'll say something like:
Password:

MacPorts base version 1.700 installed
Downloaded MacPorts base version 1.700

The MacPorts installation is not outdated so it was not updated
Get these packages from port, with the following command:
POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupg
Go make a cup of coffee, or two, as several minutes will pass, depending on your machine and download speeds, and several terminal screens full of build comments will scroll slowly by.

Installing repo

Go back to your home directory:
cd ~
If you don't already have one make a bin folder:
mkdir bin
Make sure it's on the path:
export PATH=/Users/threaded/bin:$PATH
echo $PATH
Download the repo script:
curl http://android.git.kernel.org/repo >~/bin/repo
Look to see if it is executable:
ls -al ~/bin/repo
Most probably it isn't so:
chmod a+x ~/bin/repo
To build the Android files you're recommended to use a case-sensitive Journaled HFS+. If you don't want to go creating a partition, formatting it, all the other ball-n-chain, you can, on the Mac, create a disk image. It is recommend to be 8 GB, but more won't harm.

What I did:
The OS should mount the .dmg file created, at /Volumes/mydroid, and we use this for the following work:
cd /Volumes/mydroid
Run repo init to get the files:
repo init -u git://android.git.kernel.org/platform/manifest.git
If you get a permission denied, then you've forgotten to do the chmod to repo mentioned above, like I did. ;-)

After a little huff-n-puff, it'll ask for a name and email. The name should be real, as it'll be used for attributions, and the email address needs to be to a Google account. This doesn't have to be a Gmail address, but that's easiest.

Now you can get the files:
repo sync
Again this is long-winded, so there's time for yet another coffee.

Now, finally you can:
make
If you get:
build/core/main.mk:64: ************************************************************
build/core/main.mk:65: You are building on a case-insensitive filesystem.
build/core/main.mk:66: Please move your source tree to a case-sensitive filesystem.
build/core/main.mk:67: ************************************************************
build/core/main.mk:68: *** Case-insensitive filesystems not supported. Stop.
That'll be because you are not where you think you are, but should rather be inside a Case-Sensitive, Journaled file system. ;-)

Another chance for several more cups of coffee. Lots of warning messages fly by on the terminal that don't really mean that much.

You can see if it works by dragging the newly built emulator to a terminal window:
Volumes/mydroid/out/host/darwin-x86/bin/emulator

which should illicit the response:
emulator: ERROR: You did not specify a virtual machine name, and the system
directory could not be found.

If you are an Android SDK user, please use '@' or '-vm '
to start a given virtual machine (see -help-vm for details).

Otherwise, follow the instructions in -help-disk-images to start the emulator

Labels:


Comments:
I get an error "repo: command not found" on running the following script - repo init -u git://android.git.kernel.org/platform/manifest.git
 
Have a look at your path: the user's bin directory is probably not there. So write ./bin/repo instead.
 
Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]