Date

This is already well documented in the Debian FAQ, but here goes...

To get the source to the current directory:

$ apt-get source PACKAGE
$ cd PACKAGE_DIR

To change the build rules. For example, if you simply want to change a configure option:

$ vi debian/rules

To change the version number, you must add a record to the changelog. This is important if you want apt to keep your version installed, rather than continually 'upgrading' it:

$ vi debian/changelog

To rebuild the package:

$ sudo apt-get build-dep PACKAGE
$ dpkg-buildpackage -rfakeroot -b

This creates the package in the parent of the current directory. You can install it from there:

$ cd ..
$ sudo dpkg -i PACKAGE.DEB