$ apt-get source foo
$ apt-get build-dep foo
# apt-get install devscripts
$ mkdir /tmp/dpkg $ cd $! $ apt-get source apache2
$ cd apache2-2.2.3/
$ vi debian/rules
$ debuild -rfackroot or $ debuild -us -uc
$ debuild clean
$ cd /tmp/dpkg/ $ ls *.deb