Rebuilding Cairo with XCB support in Fedora 17 - skordal/cupcake GitHub Wiki

Introduction

The default Cairo packages that comes with Fedora does not include XCB support. This article documents how to build new Cairo packages with the required XCB support for Cupcake. The instructions below worked well for Fedora 17 with Cairo-1.10.2-7.

Setting up for building RPMs

First, you will need the neccessary tools. This includes a compiler and the neccessary dependencies for building the package. If you don't have the dependencies, you will get errors when attempting to build the package, so there is no need to worry.

To create an RPM build environment, run the following command:

 rpmdev-setuptree

This will create a directory called rpmbuild in your home folder, which contains the directory hierarchy neccessary for building RPM packages.

To download the Cairo source package, run the following command:

 cd rpmbuild/SRPMS
 yumdownloader --source cairo

Install the source package into the rpmbuild hierarchy using:

 rpm -ivh cairo-*.rpm

Modifying the package specs

Now, open up the spec file for editing in your favourite text editor (mine being vim):

 vim SPECS/cairo.spec

The first edit nessesary to this file is to change the release number. This is neccessary when installing the packages built so that yum will upgrade any packages you already have installed.

Next, edit the configure flags. These are found under the %build section further down in the file. Here you must add --enable-xcb to enable the xcb backend.

Finally, add the new files that are built to the list of installed files under the %files devel section. If you do not do this, you will get an error when building the package telling you which files the package manager does not know how to package. Add these files to the list of files by adding the following to the section:

 %{_includedir}/cairo/cairo-xcb.h
 %{_libdir}/pkgconfig/cairo-xcb.pc
 %{_libdir}/pkgconfig/cairo-xcb-shm.pc

Building the package

You are now ready to build the package! Issue the following command, and watch as Cairo is built:

 QA_RPATHS=$[ 0x0001 | 0x0010] rpmbuild -bb SPECS/cairo.spec

Installing the package

To install the new packages, run yum as follows:

 yum localinstall RPMS/$(arch)/cairo-*.rpm

You should now have a working installation of Cairo with its XCB backend enabled.