Building Mozilla with SVG Support
This page provides information for people who want to include native SVG support in their own builds of Mozilla based products.
Note: the latest releases of Mozilla Firefox and SeaMonkey now come with SVG support turned on, as do the nightly builds for testers. If you just want to use or test the SVG support in one of these products, then you no longer need to download an unofficial custom build or build it yourself.
If you are sure you want to make your own builds (to test patches or to work on the SVG implementation perhaps), first read through the general Mozilla build documentation to learn how to set up a build environment for Mozilla. Once you have successfully set up your build environment, adding native SVG support to your builds simply requires you to add the following line to your .mozconfig file.
This is most likely all you need to know. The only notable exception is if you're among the small minority of people still using Microsoft Windows 98 (or older).
Microsoft Windows 98 Users
If you are using Microsoft Windows 98 then the default SVG renderer, cairo, is not the best choice for you. Problems with cairo's text rendering on win9x can cause cairo to go into an error state which stops any SVG containing <text> elements from being displayed. If you want SVG support in Mozilla Firefox 1.5 or SeaMonkey 1.0 you are probably better off with a build that renders SVG using GDI+ instead - read on. If you want a later release of these products you're out of luck. Development of the GDI+ backend stopped with these releases.
Choosing an Alternative SVG Renderer
This section only applies to Mozilla Firefox 1.5 and SeaMonkey 1.0. Development of the alternative renderers ended with these releases. If you are only interested in these versions then there are three rendering backends to choose from, allowing either cairo, Libart or GDI+ (on Microsoft Windows only) to be used as the SVG renderer. The default renderer for all platforms is cairo.
Libart was the first real renderer to be used in Mozilla's implementation of SVG, but it couldn't be used in official releases due to its incompatible licencing terms. The Libart backend also never provided support for text on Microsoft Windows. As a mature graphics library its advantage was that it offered fast rendering performance.
If you want to create a build that uses the Libart backend instead of cairo, then add the following lines to your .mozconfig configuration file.
ac_add_options --enable-svg ac_add_options --enable-svg-renderer=libart mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl
Note that for (rudimentary) text support on Linux/Mac OS X with the Libart backend, you need a freetype2-enabled build. Builds will automatically be freetype2 enabled if you have freetype2 on your system at configure time. Please be aware that you'll need to activate freetype in your pref.js according to these instructions.
The support for 'pluggable' rendering backends was originally added so that native graphics libraries such as GDI+ could be used as the SVG renderer. One of the advantages of adding GDI+ as a renderer was that it allowed text in SVG graphics to be rendered on Windows. Its big disadvantage was that it only comes pre-installed on Windows XP. Users of older Windows operating systems therefore had to download and install GDI+ (something the majority would not do) since it was too big to bundle with Mozilla.
If you want to create a build that uses the GDI+ backend instead of cairo, then add the following lines to your .mozconfig configuration file.
ac_add_options --enable-svg ac_add_options --enable-svg-renderer=gdiplus
You will also need the GDI+ headers and lib. These are included in the Platform SDK distributed with Microsoft Visual C++ .NET, or if you are using an older version of Visual C++ you can download them free of charge as part of the (unfortunately very large) MS Core Platform SDK.
Remember that if your build is to be distributed for use on a Windows OS prior to XP, then GDI+ will also need to be installed. The required DLL, gdiplus.dll, can be downloaded from the Microsoft download center here (1017KB download) by your users. It should be placed in the Mozilla installation directory or in another suitable directory in the computer's PATH. Also remember that if you build using Visual C++ .NET then non-Windows XP systems will also require the runtime DLLs (e.g. msvcp71.dll and msvcr71.dll for VS7.1).