Sometimes the binary distribution of the package is configured or compiled with options that don't suit you. Or it may be compiled for a more recent release than that which you are using and does not work for your release. Normally you would then be left on your own to retrieve the source of the package, configure and compile it, then install it into /usr/local/. This is then outside of the Debian package management system, which is just fine. But there is a better solution.
You can download the source code for any Debian package from the Debian archive. You can then modify it and generate your own .deb file for installation. To download the source of a Debian package you will need deb-src lines in your /etc/apt/sources.list file, such as the following:
deb-src http://ftp.debian.org/debian unstable main contrib non-free
Generally you can add the `-src' to copies of pre-existing `deb' lines.
To retrieve and unpack a source Debian package use:
$ wajig source <package names> (apt-get source)
Note that you can list several packages and grab all of their sources.
The source command downloads a .tar.gz file and a .dsc file for the package. The .tar.gz file contains the source code and associated files. The .dsc file contains test information that is used by the packaging system. The source command will also extract the contents of the .tar.gz archive into a subdirectory consisting of the package name and version.
To go one step further and also configure, compile and generate a default Debian .deb package from source code (useful if you need to compile a package for your setup specifically) then use instead:
$ wajig build <package names> (apt-get source -b)
But, if you need to modify the source in some way and rebuild a package:
$ wajig update $ wajig build ncftp $ dpkg-source -x ncftp_3.0.2-3.dsc $ cd ncftp-3.0.2 $ fakeroot dpkg-buildpackage -b -u