Some have asked me how they could backport Debian packages themselves. This is actually quite easy for most packages, but can be very difficult for others. The basics are always the same though.

First I tell my build-system to get source packages from the Unstable distribution by modifying my /etc/apt/sources.list:

deb http://ftp.nl.debian.org/debian/ stable main
deb-src http://ftp.nl.debian.org/debian/ unstable main
deb http://security.debian.org/ stable/updates main

Don’t forget to run apt-get update. If you intend to share your packages make sure the system your building on is clean from any other backports that might interfere and are not commonly used by others.

Now create/go to a directory where you want to build your backport of PACKAGE and download the sources:

apt-get source package
cd package-version

If you already know of changes that need to be made for the package to compile on Sarge than go ahead and edit the debian/rules file. When unsure, skip this step and come back to it if you run into problems building the package later on.

vi debian/rules

In order to control when apt install a new build of your package you need to adjust the version number. Simply copy&paste the top entry and have it reflect your changes.

vi debian/changelog

To build the package make sure all dependencies are met:

apt-get build-dep package

Sometimes not all dependencies can be met. This can be because the version in Sarge is too old or because a package is missing completely. There’s several things you can do here. You could choose to also backport the outdated/missing package. Doing this is often at the risk of ending up backporting a whole chain of packages. You can also edit the debian/control file to lower the version to the one available in Sarge and see if it works. Finally, if the dependency is really optional (like some specific database driver you don’t really need) you can edit the necessary files in the debian directory to remove the dependency completely.

Now, go ahead and try to build the package:

dpkg-buildpackage -rfakeroot -b

Very often you’ll be repeating some of the steps over and over. Keep in mind that the dependencies will get you a functional package, but will not always get you all the features. Packages will build without xxxx-dev present, but will end up not supporting libxxxx while they would if it was installed at build-time.

  • No Related Post