How to compile ffmpeg (with support for most of the popular codecs) for Mac OS X

OSX Expert's guide on how to compile ffmpeg for the Mac is pretty detailed and a huge help. However since it was written some time ago, quite a few things changed. This post provides an -at the moment- up-to-date version of OSX Expert's instructions. I still use a Snow Leopard (10.6.8) with Xcode 4.2, so small adjustments might be necessary for more recent Mac OS X and/or Xcode versions.