In theory this is quite easy, but you need to run it under 64-bit Ubuntu - even Windows binaries have to be built in Ubuntu - and some bits have to be run as root. (There's no trivial way to do just a 32-bit build.) Oh, and it'll probably be a bit slow if you run it under VMWare.
First install the prerequisites:
sudo apt-get install python-vm-builder qemu-kvm apt-cacher git-core ruby
sudo service apt-cacher start
You'll of course need to enter your login password when prompted.
Now download gitian and bitcoin and create your VM:
git clone https://github.com/devrandom/gitian-builder
git clone https://github.com/bitcoin/bitcoin
bin/make-base-vm -a i386
bin/make-base-vm -a amd64
You'll again need to enter your login password so that make-base-vm can run some commands as root.
Edit bitcoin/contrib/gitian.yml to replace the -f in "unzip -f ../wxWidgets-2.9.2-x64-gitian.zip" with -o or the 64-bit Bitcoin build will fail later.
Get the other bits you need:
wget 'http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.6.tar.gz' -O miniupnpc-1.6.tar.gz
Now you can actually try building Linux binaries:
cp build/out/wxWidgets-2.9.2-x32-gitian.zip build/out/wxWidgets-2.9.2-x64-gitian.zip inputs
bin/gbuild ../bitcoin/contrib/gitian.yml -c bitcoin=HEAD
This will take a while and use several gigabytes of disk space, but at the end you should have 32 and 64-bit Bitcoin binaries in build/out/bin/32 and build/out/bin/64. Bear in mind that every gbuild run seems to empty build/out, so if you want to keep those binaries you'll need to copy them somewhere. You can also safely delete target-lucid-amd64.qcow2 and target-lucid-i386.qcow2 once it's done to free up some space. To build Windows binaries:
You need to do all the same preparation steps if you haven't done so already, plus you need to download some extra source packages. You also need to edit bitcoin/contrib/gitian-win32.yml - find the line that reads:
sed 's|wingenminiupnpcstrings $< $@|./wingenminiupnpcstrings $< $@|' -i Makefile.mingw
Change it to:
sed 's|wingenminiupnpcstrings $< $@|sh updateminiupnpcstrings.sh|' -i Makefile.mingw
Now run these commands:
cp build/out/wxwidgets-win32-2.9.2-gitian.zip inputs/
cp build/out/boost-win32-1.47.0-gitian.zip inputs/
bin/gbuild ../bitcoin/contrib/gitian-win32.yml -c bitcoin=HEAD
You should get a bitcoin.exe and an installer bitcoin-0.4.00-win32-setup.exe in build/out/, plus a bitcoind.exe in build/out/daemon/Issues you're likely to encounter:ssh: connect to host localhost port 2223: Connection refused
This means that qemu has failed to start. Try editing libexec/start-target and changing "kvm" to "qemu". If that fails, look in var/target.log for any error messages.Connection timed out during banner exchange
This means your qemu VM didn't manage to boot far enough for ssh to be running. There appears to be a lurking bug in some python-vm-builder versions that causes bootloader installation to fail.cp: cannot open `base-lucid-i386.qcow2' for reading: Permission denied
sudo chmod 644 base-lucid-i386.qcow2
There may be more issues I haven't spotted; I'm actually running this from Gentoo rather than Ubuntu because I'm doing it for my own purposes rather than the bounty specifically, so some bits are cribbed from the README. (Notes for Gentoo users: emerge qemu-kvm ruby debootstrap multipath-tools apt-cacher-ng dev-python/cheetah, manually download and install vm-builder-0.12.4+bzr469.) Let me know how you get on!
(Edited with hopefully-working build instructions for Windows binaries.)