My previous post, Compiling Android Source on Mac OS X 10.6 Snow Leopard, is outdated and doesn’t work with the new source code, so I thought I’ll update this for eclair.
Here are the steps.
1. Install XCode, Macports, repo, etc.
I assume everyone knows how to do this. Follow the instructions from the Get Android Source Code 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.
Since there is only 1 patch to grab, I used repo for this.
Patch 12074 - Change Ic4caeff0: Enable building on java 1.6 without conflicts.
This patch will allow you to use Java 1.6 that comes with Snow Leopard instead of Java 1.5.
[sourcecode language="bash"]
repo download platform/build 12074/5
[/sourcecode]
The rest of the patches seems to have made it into the trunk, so it isn’t required to patch them anymore.
3. Edit the files.
However, there is 1 extra step you need to do in order to get a clean build. I can’t find the patch for this yet, so if anyone knows, please comment the patch number. You have to edit the following file:
[sourcecode language="bash"]
system/core/libacc/acc.cpp
[/sourcecode]
In a gist, change all the (int) to (size_t). Change the following lines:
Line 4557:
[sourcecode langauge="cpp" firstline="4557"]
pGen->leaR0((int) glo, mkpCharPtr, ET_RVALUE);
[/sourcecode]
to
[sourcecode language="cpp" firstline="4557"]
pGen->leaR0((size_t) glo, mkpCharPtr, ET_RVALUE);
[/sourcecode]
Line 4637:
[sourcecode langauge="cpp" firstline="4637"]
pGen->loadFloat((int) glo, mkpFloat);
[/sourcecode]
to
[sourcecode language="cpp" firstline="4637"]
pGen->loadFloat((size_t) glo, mkpFloat);
[/sourcecode]
Line 4643:
[sourcecode langauge="cpp" firstline="4643"]
pGen->loadFloat((int) glo, mkpDouble);
[/sourcecode]
to
[sourcecode language="cpp" firstline="4643"]
pGen->loadFloat((size_t) glo, mkpDouble);
[/sourcecode]
Line 4730-4731:
[sourcecode langauge="cpp" firstline="4730"]
pVI->pForward = (void*) pGen->leaForward(
(int) pVI->pForward, pVal);
[/sourcecode]
to
[sourcecode language="cpp" firstline="4730"]
pVI->pForward = (void*) pGen->leaForward(
(size_t) pVI->pForward, pVal);
[/sourcecode]
Line 5740:
[sourcecode langauge="cpp" firstline="5740"]
pGen->resolveForward((int) name->pForward);
[/sourcecode]
to
[sourcecode language="cpp" firstline="5740"]
pGen->resolveForward((size_t) name->pForward);
[/sourcecode]
4. Build and watch it fly.
[sourcecode language="bash"]
make
[/sourcecode]
Wait for an hour or two for the build to be completed and you’ll have a nice Android 2.1 build in the “out” directory.