(info extreta de "The Debian GNU/LInux FAQ". Última actualització: agost de 2010)
The preferred way to do this is by using various wrapper tools. We'll show how it's done using the `devscripts' tools. Install this package if you haven't done so already.
Now, first get the source package:
apt-get source foo
and change to the source tree:
cd foo-*
Then install needed build-dependencies (if any):
sudo apt-get build-dep foo
Then create a dedicated version of your own build (so that you won't get confused later when Debian itself releases a new version)
dch -l local 'Blah blah blah'
And finally build your package
debuild -us -uc
If everything worked out fine, you should now be able to install your package by running
sudo dpkg -i ../*.deb
If you prefer to do things manually, and don't want to use `devscripts', follow this procedure:
You will need all of foo_*.dsc, foo_*.tar.gz and foo_*.diff.gz to compile the source (note: there is no .diff.gz for some packages that are native to Debian).
If you have the `dpkg-dev' package installed, the following command:
dpkg-source -x foo_version-revision.dsc
will extract the package into a directory called `foo-version'.
If you want just to compile the package, you may cd into `foo-version' directory and issue the command
dpkg-buildpackage -rfakeroot -b
to build the package (note that this also requires the `fakeroot' package), and then
dpkg -i ../foo_version-revision_arch.deb
to install the newly-built package(s).