glib/docs/reference/gio/glib-compile-resources.xml
Christian Persch 8998e77b8f docs: Fix formatting in glib-compile-resource man page
Fixup the formatting in the example rule for --generate-dependencies.
2012-01-26 15:23:16 +01:00

155 lines
5.0 KiB
XML

<refentry id="glib-compile-resources" lang="en">
<refmeta>
<refentrytitle>glib-compile-resources</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>glib-compile-resources</refname>
<refpurpose>GLib resource compiler</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>glib-compile-resources</command>
<arg choice="opt" rep="repeat">option</arg>
<arg choice="req">file</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para><command>glib-compile-resources</command> reads the resource description from
<replaceable>file</replaceable> and the files that it references
and creates a binary resource bundle that is suitable for use with the
<link linkend="GResource"><type>GResource</type></link> API.
The resulting bundle is then written out as-is, or as C source for linking into
an application.
</para>
<para>
The XML resource files normally have the filename extension <filename>.gresource.xml</filename>.
For a detailed description of the XML file format, see the
<link linkend="GResource"><type>GResource</type></link> documentation.
</para>
<refsect2><title>Options</title>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>
Print help and exit
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--target=<replaceable>TARGETFILE</replaceable></option></term>
<listitem><para>
Store the compiled resources in <replaceable>TARGETFILE</replaceable>. If not specified a filename based
on the <replaceable>file</replaceable> basename is used.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--sourcedir</option></term>
<listitem><para>
The files references in <replaceable>file</replaceable> are loaded from this directory. If
not specified the current directory is used.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--generate</option></term>
<listitem><para>
Write the output file in the format selected for by its filename extension:
<variablelist>
<varlistentry>
<term><literal>.c</literal></term>
<listitem><para>C source</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>.h</literal></term>
<listitem><para>C header</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>.gresource</literal></term>
<listitem><para>resource bundle</para></listitem>
</varlistentry>
</variablelist>
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--generate-source</option></term>
<listitem><para>
Instead of a writing the resource bundle in binary form create a C source file that contains the
resource bundle. This can then be compiled into an application for easy access.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--generate-header</option></term>
<listitem><para>
Generate a header file for use with C code generated by <option>--generate-source</option>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--generate-dependencies</option></term>
<listitem><para>
Prints the list of files that the resource bundle references to standard output.
This can be used to track dependencies in the build system. For example, the following
make rule would mark <replaceable>test.gresource</replaceable> as depending on all the
files that <replaceable>test.gresource.xm</replaceable> includes, so that is is automatically
rebuilt if any of them change:
<programlisting>
test.gresource: test.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies test.gresource.xml)
</programlisting>
Note that this may or may not be portable to non-GNU <command>make</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--c-name</option></term>
<listitem><para>
Specify the prefix used for the C identifiers in the code generated by
<option>--generate-source</option> and <option>--generate-headers</option>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--manual-register</option></term>
<listitem><para>
By default code generated by <option>--generate-source</option> uses automatic initialization
of the resource. This works on most systems by using the compiler support for constructors.
However, some (uncommon) compilers may not support this, you can then specify <option>--manual-register</option>,
which will generate custom register and unregister functions that your code can manually call
at initialization and uninitialization time.
</para></listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2><title>Environment Variables</title>
<variablelist>
<varlistentry>
<term><envar>XMLLINT</envar></term>
<listitem><para>
The full path to the xmllint executable. This is used to preprocess resources with the
<literal>xml-stripblanks</literal> preprocessing option. If this environment variable is not
set, xmllint is searched in the <envar>PATH</envar>.
</para></listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<refsect1><title>See also</title>
</refsect1>
</refentry>