Let's assume foo is a package that I want to configure differently than the package maintainer does, but I don't want to go through the hassle of creating my own build scripts. Luckily, Debian (and Ubuntu) provide a way to use the package maintainer's scripts without the need to do anything yourself but enter a few simple lines into your shell.
The following commands will
- Download the source code of the latest version available for foo into a subdirectory of the current working directory
- Install all the dependencies needed to build foo
- Configure foo more to your liking
- Create installable deb-files while skipping the signing of those files (since you probably don't have the keys to do that anyway)
Notice that you don't need root for any of those commands!
apt-get source foo apt-get build-dep foo cd foo-4.2 ./configure --with-more-awesomeness dpkg-buildpackage -b -us -uc
If you want to, you can increase the version number of foo after configuring it by editing the debian/changelog file. Just copy the previous entry and adjust to reflect your changes.