I will show how to build a debian package from source, needed if you need to apply a custom patch to some package.

  1. Download the debian source
# apt-get source package-name
  1. Download the dependencies required to build the source
# apt-get build-dep package-nam
  1. Patch the source as needed.

  2. Build the debian package:

# cd source-dir # debuild -us -uc

The recompiled .deb file will be in the parent directory, you can install it with dpkg as usual.