| 1 |
Detailed compilation instructions |
| 2 |
================================= |
| 3 |
|
| 4 |
A full build of librsvg requires the |
| 5 |
`meson build system <https://mesonbuild.com>`_. A full build will |
| 6 |
produce these artifacts (see :doc:`product` for details): |
| 7 |
|
| 8 |
- ``rsvg-convert`` binary and its ``man`` page. |
| 9 |
- librsvg shared library with the GObject-based API. |
| 10 |
- GDK-Pixbuf loader for SVG files. |
| 11 |
- HTML documentation for the GObject-based API, with ``gi-docgen``. |
| 12 |
- GObject-introspection information for language bindings. |
| 13 |
- Vala language bindings. |
| 14 |
|
| 15 |
Some of the artifacts above are optional; please see the section |
| 16 |
:ref:`compile_time_options` below for details. |
| 17 |
|
| 18 |
It is perfectly fine to :source:`ask the maintainer <README.md#maintainers>` |
| 19 |
if you have questions about the meson setup; it’s a tricky bit of |
| 20 |
machinery, and we are glad to help. |
| 21 |
|
| 22 |
The rest of this document explains librsvg’s peculiarities apart from |
| 23 |
the usual way of compiling meson projects. |
| 24 |
|
| 25 |
.. _build_time_dependencies: |
| 26 |
|
| 27 |
Build-time dependencies |
| 28 |
----------------------- |
| 29 |
|
| 30 |
.. include:: _build_dependencies.rst |
| 31 |
|
| 32 |
See :doc:`devel_environment` for details on how to install these dependencies. |
| 33 |
|
| 34 |
.. _basic_compilation_instructions: |
| 35 |
|
| 36 |
Basic compilation instructions |
| 37 |
------------------------------ |
| 38 |
|
| 39 |
If you are compiling a tarball: |
| 40 |
|
| 41 |
.. code:: sh |
| 42 |
|
| 43 |
mkdir -p _build |
| 44 |
meson setup _build -Ddocs=enabled -Dintrospection=enabled -Dvala=enabled |
| 45 |
meson compile -C _build |
| 46 |
meson install -C _build |
| 47 |
|
| 48 |
The options that start with ``-D`` are listed in the |
| 49 |
``meson_options.txt`` file and are described in the next section. |
| 50 |
|
| 51 |
.. _compile_time_options: |
| 52 |
|
| 53 |
Compile-time options |
| 54 |
-------------------- |
| 55 |
|
| 56 |
These are invoked during ``meson setup`` as ``-Doption_name=value``. |
| 57 |
See `meson's documentation on using build-time options |
| 58 |
<https://mesonbuild.com/Build-options.html>`_ for details. |
| 59 |
|
| 60 |
These are librsvg's options: |
| 61 |
|
| 62 |
* ``introspection`` - Specifies whether the build will generate |
| 63 |
`GObject Introspection <https://gi.readthedocs.io/en/latest/>`_ |
| 64 |
information for language bindings. Values are |
| 65 |
``enabled``/``disabled``/``auto``. |
| 66 |
|
| 67 |
* ``pixbuf`` - Specifies whether to build with support for `gdk-pixbuf |
| 68 |
<https://docs.gtk.org/gdk-pixbuf/>`_ in the library APIs. |
| 69 |
Values are ``enabled``/``disabled``/``auto``. |
| 70 |
|
| 71 |
* ``pixbuf-loader`` - Specifies whether to build a `gdk-pixbuf |
| 72 |
<https://docs.gtk.org/gdk-pixbuf/>`_ module to let applications which use |
| 73 |
gdk-pixbuf load and render SVG files as if they were raster images. |
| 74 |
Values are ``enabled``/``disabled``/``auto``. |
| 75 |
|
| 76 |
* ``rsvg-convert`` - Specifies whether to build the `rsvg-convert` |
| 77 |
binary. You can disable this if you just need the library to link |
| 78 |
into other programs. Values are ``enabled``/``disabled``/``auto``. |
| 79 |
|
| 80 |
* ``docs`` - Specifies whether the C API reference and the |
| 81 |
rsvg-convert manual page should be built. These require ``gi-docgen |
| 82 |
<https://gnome.pages.gitlab.gnome.org/gi-docgen/>`_ and ``rst2man`` |
| 83 |
from Python's `docutils <https://www.docutils.org/>`_, respectively. |
| 84 |
Values are ``enabled``/``disabled``/``auto``. |
| 85 |
|
| 86 |
* ``vala`` - Specifies whether a `Vala <https://vala.dev/>`_ language |
| 87 |
binding should be built. Requires the Vala compiler to be |
| 88 |
installed. Values are ``enabled``/``disabled``/``auto``. |
| 89 |
|
| 90 |
* ``tests`` - Specifies whether the test suite should be built. |
| 91 |
Value is a boolean that defaults to ``true``. |
| 92 |
|
| 93 |
* ``triplet`` - Specifies the `Rust target triplet |
| 94 |
<https://doc.rust-lang.org/stable/rustc/platform-support.html>`_; |
| 95 |
only needed for cross-compilation. Value is a string. |
| 96 |
|
| 97 |
* ``avif`` - Specifies whether the image-rs crate, which librsvg uses |
| 98 |
to load raster images, should be built with support for the AVIF |
| 99 |
format. Requires the `dav1d |
| 100 |
<https://code.videolan.org/videolan/dav1d>`_ library. Values are |
| 101 |
``enabled``/``disabled``/``auto``. |
| 102 |
|
| 103 |
* ``rustc-version`` - Specifies the ``rustc`` version to use; only |
| 104 |
supported on Windows. Value is a string. |
| 105 |
|
| 106 |
|
| 107 |
.. _building_with_no_network_access: |
| 108 |
|
| 109 |
Building with no network access |
| 110 |
------------------------------- |
| 111 |
|
| 112 |
Automated build systems generally avoid network access so that they can |
| 113 |
compile from known-good sources, instead of pulling random updates from |
| 114 |
the net every time. However, normally Cargo likes to download |
| 115 |
dependencies when it first compiles a Rust project. |
| 116 |
|
| 117 |
You can use `cargo vendor |
| 118 |
<https://doc.rust-lang.org/cargo/commands/cargo-vendor.html>`_ to |
| 119 |
download librsvg's Rust dependencies ahead of time, so that subsequent |
| 120 |
compilation don't require network access. |
| 121 |
|
| 122 |
Build systems can use `Cargo’s source replacement |
| 123 |
mechanism <https://doc.rust-lang.org/cargo/reference/source-replacement.html>`_ to override |
| 124 |
the location of the source code for the Rust dependencies, for example, |
| 125 |
in order to patch one of the Rust crates that librsvg uses internally. |