Download QEMU
The sources can be found here:
http://wiki.qemu-project.org/download/qemu-1.4.0.tar.bz2
wget http://wiki.qemu-project.org/download/qemu-1.4.0.tar.bz2
Install dependencies
This is what I needed to install, however you might require extra dependencies that were already installed on my system and are thus not on this list .
General build tools:
sudo apt-get install build-essential bzr bzr-builddeb cdbs \ debhelper devscripts dh-make diff dpatch fakeroot \ gnome-pkg-tools gnupg liburi-perl lintian patch patchutils \ pbuilder piuparts quilt ubuntu-dev-tools wget
QEMU dependencies:
sudo apt-get install \ libglib2.0-dev libsdl1.2-dev libjpeg-dev libvde-dev \ libvdeplug2-dev libbrlapi-dev libaio-dev libfdt-dev texi2html \ texinfo info2man pod2pdf libnss3-dev libcap-dev libattr1-dev \ gcc-4.6-multilib
To be sure you have everything you can also do a sudo apt-get build-dep qemu
, even though the Ubuntu 12.04 has an outdated version of QEMU.