Compiling latest Calibre for Ubuntu 10.04

Update: Calibre 0.7.40 was released today but the same process can be applied.

While waiting for my Kindle 3G I am preparing my Ubuntu machine to handle it at its best. I read about Calibre which seems to be the best open-source ebook management software available so I visited http://calibre-ebook.com/ to give it a try. Unfortunately there are no packages for Ubuntu 10.04 Lucid so I had to install it from sources, and here are the steps that I needed for Calibre 0.7.38 (07 Jan, 2011):

1. Install dependencies (you might need other packages as well, what follows are the packages I needed on my machine):

sudo apt-get install libpoppler-dev libchm-dev libmagickwand-dev python-sip-dev python-qt4-dev libpoppler-qt4-dev

2. Install podofo >= 0.8.2 as it is needed for some PDF functionalities in Calibre. The package in Lucid repositories is 0.8.0 so we have to compile this from sources as well:

wget http://downloads.sourceforge.net/podofo/podofo-0.8.4.tar.gz?use_mirror=osdn -o podofo-0.8.4.tar.gz
tar zxf podofo-0.8.4.tar.gz
mkdir podofo-build
cd podofo-build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/podofo" ../podofo-0.8.4
make
make install

As you can see PoDoFo will be installed in your home dir, but you can choose to install in /usr, in this case the last command will have to include ‘sudo’.

3. If everything went OK so far we are ready to build Calibre:

wget -O- http://status.calibre-ebook.com/dist/src | tar xvz
cd calibre
export PODOFO_LIB_DIR=/home/<your user>/podofo/lib/
export PODOFO_INC_DIR=/home/<your user>/podofo/include/podofo
sudo python setup.py install

If you still see warnings about PoDoFo not being found (happened to me) seems like the install script is not reading the variable PODOFO_INC_DIR from the environment. I edited the file setup/buildenvironment,py, changing the lines:

podofo_inc = '/usr/include/podofo'
podofo_lib = '/usr/lib'

to

podofo_inc = '/home/<user>/podofo/include/podofo'
podofo_lib = '/home/<user>/podofo/lib'

and restart the install script.

If everything went well you should see a Calibre entry in the Applications->Office menu and two other entries in the Applications->Graphics menu.

calibre
calibre

If you have any problems with the instructions above let me know in the comments and I will try to help if I can.