#download the packages that are required for compiling <package>
apt-get build-dep <package>
#download the source and build <package>
apt-get -b source <package>
#or you can download and build separately
apt-get source <package>
cd <package-dir>
dpkg-buildpackage -rfakeroot -uc -us -b
Comments
Update: Making a .deb package from the package sources
dpkg-buildpackage -rfakeroot -uc -us -b
, no matter what.I've googled around for quite some time and saw that recently people prefer using
debuild
which actually callsdpkg-buildpackage
. I've given it a try and it worked:debuild -uc -us -b
Debuild executed this:
dpkg-buildpackage -rfakeroot -D -us -uc -b
But executing the same command directly results in an error too!
debuild
is part of thedevscripts
package and the package description says this about it: "wrapper to build a package without having to su or worry about how to invoke dpkg to build using fakeroot. Also deals with common environment problems, umask etc. [fakeroot, lintian, gnupg]"Apparently the important part in this is "common environment problems, ...".
So keep in mind: use
debuild
all the time! Actually if you take a look at the official Debian FAQ, it now suggestsdebuild
too.