Using apt to download source code is pretty easy, and makes the problem of missing-dependencies all but disappear.
You can use the following to download the source code for any package (note: the source flag to apt will download the source code to your current working directory):
mkdir packagename
cd packagename
apt-get source packagename
While this downloads the source code for the package, it does not automatically download the libraries required to compile the source. To do that, use the following command:
apt-get build-dep packagename
Finally, you can do the standard configure/make/make install procedure inside of the packagename directory.
./configure
make
make install