Making a .deb package from the package sources

It's pretty simple once you know the commands. Smile Here it is quite well described. The main commands are ...

#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

PS: for the last example to work you'll need the dpkg-dev and fakeroot packages too

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Update: Making a .deb package from the package sources

Today I've run into an oddity. Compiling the checkinstall package used to work for me with the above described method (at least it worked when checkinstall was still 1.6.1-7ubuntu1 (probably it was in Jaunty). However in Karmic the recent version just won't compile with a 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 calls dpkg-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! Shock
debuild is part of the devscripts 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, ...". Smile

So keep in mind: use debuild all the time! Actually if you take a look at the official Debian FAQ, it now suggests debuild too. Wink