Pages

September 29, 2010

Scrpit for building Debian Squeeze libcairo2 with Ubuntu patches

[Update 2011-06-25: Indeed, you should consider this post obsolete. See this post for more info.] 
[Update 2011-06-24: This whole business may be unnecessary as it appears installing a recent version of Iceweasel from http://mozilla.debian.net/ also installs new libcairo2 with decent font rendering. I've yet to do careful comparisons, but it's possible that this solves both "ugly rendering in general" as well as "ugly rendering in Firefox" issues.]
[Update 2011-03-06 Reader datSilencer points out that the location of the Arch patch has changed. I have updated the script to reflect the change.]

Based on the post I wrote earlier, which is itself based on work published in a CrunchBang Linux Forum thread and by quanliking, I put together a script for quasi-automatically building libcario2 for Squeeze using the Ubuntu and Arch patches.

You can get the script at http://download.tuxfamily.org/skinny/libcairo2-patched/build-libcairo2.sh.

Prerequisites
  • Enable sources in your /etc/apt/sources.list (i.e.,  make sure sources.list has something similar to deb-src http://ftp.us.debian.org/debian/ squeeze main non-free contrib in it). If you make any changes, be sure to # apt-get update
  • # apt-get install build-essential devscripts fakeroot
  • # apt-get build-dep cairo
To use
  1. Download build-libcairo2.sh into the directory where you plan to build the packages. I recommend you start with a dedicated and empty directory.
  2. Open the script in a text editor and change the constants at the top as documented.
  3. Make the script executable and execute it:
    $ chmod +x build-libcairo2.sh
    $ ./build-libcairo2.sh
  4. Part of the way through, it will prompt you to fill in a line that opens in your default CLI editor. Do what it asks.
  5. When it's finished, open a term and follow the directions to install.
Rebuilding
When it comes time to rebuild (i.e., after a new Debian release) you must start over with an empty directory. Or at the very least, you must rename the top-level folder named libcairo2 that your previous build generated. This is to make sure that you get the most recent everything and that there are no goofy problems that might lead to a build that melts Arctic ice or increases the mercury content of fish.

Todo
An obvious bit of low-hanging fruit is to make entering of version info interactive, but it's arguable that that would be easier and less error prone that editing the script.

To round this out, we also need an additional script or package that adds the needed files from Ubuntu's fontconfig-config package to /etc/fonts/conf.avail and /etc/fonts/conf.d.

Notes
I uploaded the i386 packages that I built for my own use to http://download.tuxfamily.org/skinny/libcairo2-patched. Feel free to try these if you don't feel like building them yourself. However, I'm not making any promises that I'll keep these up-to-date.

Legal disclaimer
I have tested the code and packages mentioned here to make sure they don't bruise kittens or eat children. However, I wrote and built this stuff for my own use and have made it available here with no warranty of any kind whatsoever in the hopes it might be useful to others. Use at your own risk.