Installing librsvg
From DreamHost
| The instructions provided in this article or section are considered advanced. You are expected to be knowledgeable in the UNIX shell. |
| The instructions provided in this article or section require shell access unless otherwise stated. You can use the PuTTY client on Windows, or SSH on UNIX and UNIX-like systems such as Linux or Mac OS X. |
librsvg
librsvg is a open source SVG rendering library written as part of the GNOME project.
It can be used to convert SVG vector images to PNG raster images using the rsvg-convert program.
Environment
$ export PKG_CONFIG_PATH=$HOME/lib/pkgconfig $ export PATH=$HOME/bin:$PATH $ export LDFLAGS=-L$HOME/lib $ export LD_LIBRARY_PATH=$HOME/lib $ export CPPFLAGS=-I$HOME/include
Obtain Source Code
One will need to download the source code for the following packages.
- Glib
- version 2.20.4 - http://ftp.gnome.org/pub/GNOME/sources/glib/2.20/
- ATK
- version 1.9.1 - http://www.linuxfromscratch.org/blfs/view/6.1/x/atk.html
- Cairo
- version 1.2.4 - http://cairographics.org/news/cairo-1.2.4/
- Pango
- version 1.14.8 - http://ftp.gnome.org/pub/GNOME/sources/pango/1.14/
- GTK+
- version 2.10.6 - see installation section - http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.10/
- libcroco
- version 0.6.2 - http://www.linuxfromscratch.org/blfs/view/svn/general/libcroco.html
- libgsf
- version 1.14.4 - http://ftp.acc.umu.se/pub/gnome/sources/libgsf/1.14/
- popt
- version 1.10.4 - http://www.linuxfromscratch.org/blfs/view/6.3/general/popt.html
- librsvg
- version 2.26.0 - https://launchpad.net/ubuntu/+source/librsvg/2.26.0-1
One can use wget to download the files to $HOME/src and extract them in that directory:
$ mkdir ~/src $ cd ~/src $ wget url # .tar.gz extension $ tar -xzf filename # .tar.bz2 extension $ tar -xjf filename
Installation
Install packages in the order shown above. cairo and GTK+ are special cases.
# for all packages except Cairo and GTK+, substitute "package" with the respective package name $ cd ~/src/package $ ./configure --prefix=$HOME $ make $ make install # Cairo (disable xlib) $ cd cairo-1.2.4 $ ./configure --prefix=$HOME --enable-xlib=no $ make $ make install
If you get error "cairo-type1-subset.c:366: error: implicit declaration of function 'isspace'", insert line #include <ctype.h> before line #include <ft2build.h> in file src/cairo-type1-subset.c (for example, with joe editor: joe src/cairo-type1-subset.c and then press Ctrl+K X to save and exit).
# GTK+ # Full installation cannot be completed, as it requires X # libraries and headers. Attempt anyways so we can install # gtk-pixbuf separately. $ cd gtk+-2.10.6 $ ./configure --prefix=$HOME --without-x --without-libtiff --with-gdktarget=linux-fb $ cd gdk-pixbuf $ make $ make install $ cp ../gdk-pixbuf-2.0.pc $HOME/lib/pkgconfig
Result
In addition to some other executables, a python script named 'rsvg' is placed in $HOME/bin along with 'rsvg-convert' which is the ELF binary.
Usage: rsvg-convert [OPTION...] [FILE...] - SVG Converter Help Options: -?, --help Show help options Application Options: -d, --dpi-x=<float> pixels per inch [optional; defaults to 90dpi] -p, --dpi-y=<float> pixels per inch [optional; defaults to 90dpi] -x, --x-zoom=<float> x zoom factor [optional; defaults to 1.0] -y, --y-zoom=<float> y zoom factor [optional; defaults to 1.0] -z, --zoom=<float> zoom factor [optional; defaults to 1.0] -w, --width=<int> width [optional; defaults to the SVG's width] -h, --height=<int> height [optional; defaults to the SVG's height] -f, --format=[png, pdf, ps, svg] save format [optional; defaults to 'png'] -o, --output output filename [optional; defaults to stdout] -a, --keep-aspect-ratio whether to preserve the aspect ratio [optional; defaults to FALSE] -b, --background-color=[black, white, #abccee, #aaa...] set the background color [optional; defaults to None] -v, --version show version information --base-uri base uri
Credit
Thanks to Psychonaut for posting installation instructions to the Discussion Forum a long time ago.