After various attempts, I’ve finally figured out how to compile the android source code on Mac OS X 10.6 Snow Leopard. It works on both 64-bit and 32-bit kernels. Here are the steps.
1. Install XCode, Macports, repo, etc.
I assume everyone knows how to do this. Follow the instructions from the Android source page. Just remember to create a new partition that is a case-sensitive partition if you’re using a non case-sensitive primary partition. I’ll start off after you’ve gotten the source from git.
2. Get the following patches.
Notice that I didn’t use “repo download” to get those patches. I realized that repo sometimes “undo” the patches when you download another patch. All bash commands start at the root of your Android source directory.
This patch will allow you to use Java 1.6 that comes with Snow Leopard instead of Java 1.5.
git pull git://android.git.kernel.org/platform/build refs/changes/74/12074/3
This patch will add x86-64 checking for Darwin.
git pull git://android.git.kernel.org/platform/system/core refs/changes/45/11845/3
This patch allows qemu to build.
git pull git://android.git.kernel.org/platform/external/qemu refs/changes/46/11846/3
This patch allows libacc to compile.
git pull git://android.git.kernel.org/platform/system/core refs/changes/97/12597/1
3. Build and watch it fly.
I haven’t quite tested the image files and binaries but it seems to me like it works pretty well. Now to get my hands dirty and start messing around with the actual code.
Oh and remember, every time you do a repo sync, you might have to reapply some of the patches. I’m not too sure why. If there’s anyone who understands git well enough, please explain.
(UPDATE): New updated blog post for Android 2.1 – Compiling Android 2.1 Eclair Source on Mac OS X 10.6 Snow Leopard