This is actually very simple, but the first time you do it it takes quite a while to sync the repository. As such, I kept screwing it up by forgetting that I was following instructions on one page but was supposed to substitute URL values in from another page.

Read over the entire post before even starting.

The main build instructions are here. And the (slightly out of date) dependencies are here.

First, install a ton of dependencies — I’m on a 64-bit machine so I include some multilib stuff specifically because of that:

sudo apt-get install -y git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool g++-multilib lib32z1-dev lib32ncurses5-dev

Sun-java6-jdk is no longer available from the default .deb repositories, so I followed instructions here and acquired it via (you have to agree to some licensing during the install):

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk

lib32readline5-dev is apparently replaced by lib32readline-gplv2-dev, so:

sudo apt-get install lib32readline-gplv2-dev

That should take care of dependencies. Now grab the repo script:

mkdir -p ~/bin

curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

chmod a+x ~/bin/repo

Decide where you’re going to place the files and sync the repository:

mkdir ~/cm4mm

cd cm4mm

repo init -u git://github.com/nadlabak/android.git -b gingerbread
repo sync

That stage takes a LONG time. A very long time. But when it’s over, you’re almost ready to build! Download the rom manager:

vendor/cyanogenmod/get-rommanager

And then finally, build:

. build/envsetup.sh && brunch umts_sholes

My notes are a wee bit jumbled from when I screwed this up by using the wrong source. So before you build, you may need to copy over some proprietary files. See the steps here for that. I realize now that the path used in those steps isn’t valid for the cm4mm directory structure so I’m not sure what’s going on there.

Note: so far I’ve gotten it to successfully build — but I haven’t actually tried running my own build.

Good luck.