Blame docs/reference/gio/glib-compile-resources.xml

Packit ae235b
<refentry id="glib-compile-resources" lang="en">
Packit ae235b
Packit ae235b
<refentryinfo>
Packit ae235b
  <title>glib-compile-schemas</title>
Packit ae235b
  <productname>GIO</productname>
Packit ae235b
  <authorgroup>
Packit ae235b
    <author>
Packit ae235b
      <contrib>Developer</contrib>
Packit ae235b
      <firstname>Alexander</firstname>
Packit ae235b
      <surname>Larsson</surname>
Packit ae235b
    </author>
Packit ae235b
  </authorgroup>
Packit ae235b
</refentryinfo>
Packit ae235b
Packit ae235b
<refmeta>
Packit ae235b
  <refentrytitle>glib-compile-resources</refentrytitle>
Packit ae235b
  <manvolnum>1</manvolnum>
Packit ae235b
  <refmiscinfo class="manual">User Commands</refmiscinfo>
Packit ae235b
</refmeta>
Packit ae235b
Packit ae235b
<refnamediv>
Packit ae235b
  <refname>glib-compile-resources</refname>
Packit ae235b
  <refpurpose>GLib resource compiler</refpurpose>
Packit ae235b
</refnamediv>
Packit ae235b
Packit ae235b
<refsynopsisdiv>
Packit ae235b
  <cmdsynopsis>
Packit ae235b
    <command>glib-compile-resources</command>
Packit ae235b
    <arg choice="opt" rep="repeat">OPTION</arg>
Packit ae235b
    <arg choice="req">FILE</arg>
Packit ae235b
  </cmdsynopsis>
Packit ae235b
</refsynopsisdiv>
Packit ae235b
Packit ae235b
<refsect1><title>Description</title>
Packit ae235b
<para><command>glib-compile-resources</command> reads the resource description from
Packit ae235b
<replaceable>FILE</replaceable> and the files that it references
Packit ae235b
and creates a binary resource bundle that is suitable for use with the
Packit ae235b
<link linkend="GResource"><type>GResource</type></link> API.
Packit ae235b
The resulting bundle is then written out as-is, or as C source for linking into
Packit ae235b
an application.
Packit ae235b
</para>
Packit ae235b
<para>
Packit ae235b
The XML resource files normally have the filename extension <filename>.gresource.xml</filename>.
Packit ae235b
For a detailed description of the XML file format, see the
Packit ae235b
<link linkend="GResource"><type>GResource</type></link> documentation.
Packit ae235b
</para>
Packit ae235b
</refsect1>
Packit ae235b
Packit ae235b
<refsect1><title>Options</title>
Packit ae235b
<variablelist>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>-h</option>, <option>--help</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Print help and exit
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--version</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Print program version and exit
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--target=<replaceable>TARGET</replaceable></option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Store the compiled resources in the file <replaceable>TARGET</replaceable>.
Packit ae235b
If not specified a filename based on the <replaceable>FILE</replaceable>
Packit ae235b
basename is used.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--sourcedir=<replaceable>DIRECTORY</replaceable></option></term>
Packit ae235b
<listitem><para>
Packit ae235b
The files referenced in <replaceable>FILE</replaceable> are loaded from
Packit ae235b
this directory. If not specified, the current directory is used.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--generate</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Write the output file in the format selected for by its filename extension:
Packit ae235b
<variablelist>
Packit ae235b
<varlistentry>
Packit ae235b
<term><literal>.c</literal></term>
Packit ae235b
<listitem><para>C source</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
<varlistentry>
Packit ae235b
<term><literal>.h</literal></term>
Packit ae235b
<listitem><para>C header</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
<varlistentry>
Packit ae235b
<term><literal>.gresource</literal></term>
Packit ae235b
<listitem><para>resource bundle</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
</variablelist>
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--generate-source</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Instead of a writing the resource bundle in binary form create a C source file
Packit ae235b
that contains the resource bundle. This can then be compiled into an
Packit ae235b
application for easy access.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--generate-header</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Generate a header file for use with C code generated by
Packit ae235b
<option>--generate-source</option>.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--generate-dependencies</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Prints the list of files that the resource bundle references to standard output.
Packit ae235b
This can be used to track dependencies in the build system. For example, the
Packit ae235b
following make rule would mark <replaceable>test.gresource</replaceable> as
Packit ae235b
depending on all the files that <replaceable>test.gresource.xml</replaceable>
Packit ae235b
includes, so that is is automatically rebuilt if any of them change:
Packit ae235b
<programlisting>
Packit ae235b
test.gresource: test.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies test.gresource.xml)
Packit ae235b
</programlisting>
Packit ae235b
Note that this may or may not be portable to non-GNU <command>make</command>.
Packit ae235b
</para>
Packit ae235b
<para>
Packit ae235b
Also see <option>--dependency-file</option>.
Packit ae235b
</para>
Packit ae235b
</listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--c-name</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Specify the prefix used for the C identifiers in the code generated by
Packit ae235b
<option>--generate-source</option> and <option>--generate-header</option>.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--manual-register</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
By default code generated by <option>--generate-source</option> uses automatic
Packit ae235b
initialization of the resource. This works on most systems by using the
Packit ae235b
compiler support for constructors. However, some (uncommon) compilers may not
Packit ae235b
support this, you can then specify <option>--manual-register</option>,
Packit ae235b
which will generate custom register and unregister functions that your code
Packit ae235b
can manually call at initialization and uninitialization time.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--internal</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
By default code generated by <option>--generate-source</option> declares all
Packit ae235b
initialization functions as <type>extern</type>.  So they are exported
Packit ae235b
unless this is prevented by a link script or other means.  Since libraries
Packit ae235b
usually want to use the functions only internally it can be more useful to
Packit ae235b
declare them as
Packit ae235b
<link linkend="G-GNUC-INTERNAL:CAPS"><literal>G_GNUC_INTERNAL</literal></link>
Packit ae235b
which is what <option>--internal</option> does.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--dependency-file=<replaceable>FILE</replaceable></option></term>
Packit ae235b
<listitem><para>
Packit ae235b
Write dependencies in the same style as gcc -M -MF to the given file.
Packit ae235b
If <option>FILE</option> is -, the dependencies are written to the standard
Packit ae235b
output. Unlike <option>--generate-dependencies</option>, this option can be
Packit ae235b
combined with other <option>--generate</option> options to generate dependencies
Packit ae235b
as a side-effect of generating sources.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><option>--generate-phony-targets</option></term>
Packit ae235b
<listitem><para>
Packit ae235b
When creating a dependency file with <option>--dependency-file</option>
Packit ae235b
include phony targets in the same style as gcc -MP. This would typically
Packit ae235b
be used with <literal>make</literal>.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
</variablelist>
Packit ae235b
</refsect1>
Packit ae235b
Packit ae235b
<refsect1><title>Environment</title>
Packit ae235b
<variablelist>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><envar>XMLLINT</envar></term>
Packit ae235b
<listitem><para>
Packit ae235b
The full path to the xmllint executable. This is used to preprocess resources
Packit ae235b
with the <literal>xml-stripblanks</literal> preprocessing option. If this
Packit ae235b
environment variable is not set, xmllint is searched in the
Packit ae235b
<envar>PATH</envar>.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
<varlistentry>
Packit ae235b
<term><envar>GDK_PIXBUF_PIXDATA</envar></term>
Packit ae235b
<listitem><para>
Packit ae235b
The full path to the gdk-pixbuf-pixdata executable. This is used to preprocess
Packit ae235b
resources with the <literal>to-pixdata</literal> preprocessing option. If this
Packit ae235b
environment variable is not set, gdk-pixbuf-pixdata is searched in the
Packit ae235b
<envar>PATH</envar>.
Packit ae235b
</para></listitem>
Packit ae235b
</varlistentry>
Packit ae235b
Packit ae235b
</variablelist>
Packit ae235b
</refsect1>
Packit ae235b
</refentry>