To create a custom debian/ubuntu package...
Install build dependencies. (Assuming you have mk-build-deps)
$ mk-build-deps foobar $ dpkg -i foobar-build-deps*.deb
Get the source to modify.
$ apt-get source foobar $ cd foobar*
Make change to the source.
Update the changelog.
$ dch -i
Instead of the pre-populated value, use the previous and append ~tag. (I did ~kitlaan1)
Build it (and sign).
$ debuild -sd
If you just want a source-build,
$ debuild -S -sd
Note: If you want unstripped-binaries,
$ DEB_BUILD_OPTIONS="nostrip noopt" $ debuild ...