Compile/Backport packages from source Ubuntu/Debian

I’ve run into several situations where the packages I want are not available on the distribution version I’m running.

One way to solve this is to upgrade to a newer distribution that contains the packages you want.

Or you can just compile them your self and install them after that. This is done in two steps, one is we need to fetch the sources and then we need to compile them.

As I’m on on Lucid 10.04 and I need a newer libnotify library, I will get it from Maveric sources repository and then compile it.

apt-src install libnotify
apt-src build libnotify

Or just run the following, it will have the same effect as the previous two lines:

apt-src install -b -i libnotify

After this you will have the following packages:

libnotify1_0.5.0-2ubuntu1_amd64.deb
libnotify-bin_0.5.0-2ubuntu1_amd64.deb
libnotify-dev_0.5.0-2ubuntu1_amd64.deb
libnotify-doc_0.5.0-2ubuntu1_all.deb

If you have read Creating your own local compiled packages repository you can just move those files to the folder described there and after that run the update script and then run:

apt-get upgrade

It will upgrade the version of libnotify to the one you just compiled.