Compiling Debian or Ubuntu Source Packages
Often times it's convenient to modify a debian package slightly, or to backport a newer package to an older dist.
This is much easier than it sounds.
As an example, I'll show you how to build a copy of rxvt-unicode with the 256 color patch (which makes vim much prettier!).
First get some packaging utils and scripts:
sudo aptitude install build-essential dpkg-dev fakeroot debhelper devscripts
Add a deb-src line to your /etc/apt/sources.list :
deb-src http://mirrors.kernel.org/debian/ unstable main contrib non-free
It looks just like a deb line.
Now build the package:
mkdir build; cd build sudo aptitude update sudo apt-get build-dep rxvt-unicode-ml apt-get source rxvt-unicode-ml cd rxvt-unicode-* patch -p1 < doc/urxvt-8.2-256color.patch dpkg-buildpackage -b -uc -rfakeroot
Now get some coffee and smoke a few cigarettes.
...
And the packages are built!
cd .. ls *.deb # rxvt-unicode_9.06-1_i386.deb rxvt-unicode-lite_9.06-1_i386.deb rxvt-unicode-ml_9.06-1_i386.deb sudo dpkg -i rxvt-unicode-ml*.deb
Last thing you want to do is put the package you just built and installed on hold, so that aptitude/apt-get doesn't upgrade it to the default version.
sudo aptitude hold rxvt-unicode-ml
The procedure is pretty much the same for backporting packages, you just use a
newer dist for your deb-src line.
If you want to modify not just the source, but things like ./configure
options or other things in the build process, edit the debian/rules file in
the source directory before building.
UPDATE: I'm told that the new way to do this is to use pbuilder.
Last modified: 2009-5-4 (月) at 2:57 am
Random Stuff