These steps can be used to rebuild an already available Debian (or Ubuntu) package from source. The steps assume the relevant deb-src apt repository is configured.
In this example I will be rebuilding the netsniff-nf package to remove the dependancy on ntp.
Install basic requirements that are needed to build Debian packages:
apt -y install build-essential devscripts
Get the package source files:
cd /usr/local/src
apt source netsniff-ng
Multiple files should then download including the main source .tar.gz as well as various packaging information.
Make the relevant changes to the package.
Install the dependancies required to build the package:
apt build-dep netsniff-ng
Update the changelog for the package:
dch -i
Change into the package directory:
cd netsniff-ng-0.6.8
Finally build the .deb package file:
debuild -us -uc -b