Linux HOWTOs

About | Home | Search

HOWTO: cairo
Description: 2D graphics library
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything

# Cairo 1.16.0
# ============
# Slackware 13.37, 14.0: cairo 1.10.2
# Slackware 14.1: 1.12.14
# Slackware 14.2: 1.14.6

# Prerequisites:
# zlib
# pkg-config
# pixman >= 0.10.0
# XFree86 or (optional)
# Quartz is MacOS X
# libpng
# freetype
# fontconfig
# ghostscript (--enable-ps) (for the PostScript backend)
# libspectre
# poppler >= 0.8.0,
#  and GTK+'s GDK (for the PDF backend)
# librsvg >= 2.15.0 (for SVG backend test)
# gtk-doc > 1.3 (found in Slackware's sgml-tools/linuxdoc-tools packages; pass --enable-gtk-doc to use)
# Backends that have to be enabled with a configure flag:
# XCB: XCB (--enable-xcb)
# glitz: glitz (--enable-glitz)
# DirectFB: directfb (--enable-directfb)

# If you want to uninstall Cairo or remove an old version before installing
# this one, skip down to the bottom.

# NOTE: As of the November 28, 2006 update to this howto, we use the /usr
# prefix instead of /usr/local.  If you have a Cairo installed under
# /usr/local, skip to the bottom to uninstall your old version before you
# proceed.  Be aware that you may need to rebuild things that use Cairo
# after doing this:
# poppler
# pango
# goffice
# Evolution
# any howto of mine with cairo in it's name...
# This will tell you what libtool .la files are set with libcairo's old
# location:
# grep '/usr/local/lib*/' /usr/lib*/*.la | cut -d':' -f1

# libspectre uses Cairo and Cairo uses libspectre, so if you want
# each to support the other, build one, build the other, and build the
# first one again.

# Poppler won't build poppler-glib without Cairo, and Cairo won't build
# Poppler support without poppler-glib, so just keep compiling and
# installing each of them until configure says yes :-)

# Get it
test -f installed/cairo-1.16.0.tar.xz && mv installed/cairo-1.16.0.tar.xz .
test ! -f cairo-1.16.0.tar.xz &&

# Verify tarball w/ sha1sum:
echo "00e81842ae5e81bb0343108884eb5205be0eac14  cairo-1.16.0.tar.xz" | \
 sha1sum -c

# Extract it
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "cairo-*" -exec rm -r {} \;
tar xJvf ~/cairo-1.16.0.tar.xz
cd cairo-1.16.0
test $UID = 0 && chown -R root:root .

# If you do have X installed, leave off --enable-xlib=no

# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
 ./configure --prefix=/usr --libdir=/usr/lib64 --enable-gtk-doc \

# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
 ./configure --prefix=/usr --enable-gtk-doc --enable-xlib=no

# Build it

# Test the build
make check

# Become root to install it

# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg cairo

# Remove old library files
rm -f /usr/lib*/libcairo.*

# Install it
make install

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# Become yourself again

# Save the source for later
mkdir -p -m 0700 installed
rm -f installed/cairo-*.tar.*
mv cairo-1.16.0.tar.xz installed/

# If you ever want to uninstall Cairo, this should do it:
test -d src/cairo-* && ( cd src/cairo-* ; make uninstall )
for pfx in /usr /usr/local;
  cd $pfx
  test -d include/cairo && rm -r include/cairo
  test -d share/gtk-doc/html/cairo && rm -r share/gtk-doc/html/cairo
  for libdir in ${pfx}/lib ${pfx}/lib64;
    test ! -d $libdir && continue
    cd $libdir
    rm -f libcairo.*
    test -d pkgconfig &&
     ( cd pkgconfig
       rm -f cairo.pc cairo-fc.pc cairo-ft.pc cairo-pdf.pc cairo-png.pc \
        cairo-ps.pc cairo-script.pc cairo-svg.pc )
find ~/src -maxdepth 1 -type d -name "cairo-*" -exec rm -r {} \;
rm -f ~/installed/cairo-*.tar.*

Back to the list

Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>