File: glib-compile-resources.rst

package info (click to toggle)
glib2.0 2.84.1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 66,144 kB
  • sloc: ansic: 538,877; python: 9,624; sh: 1,572; xml: 1,482; perl: 1,222; cpp: 535; makefile: 316; javascript: 11
file content (182 lines) | stat: -rw-r--r-- 6,245 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
.. _glib-compile-resources(1):
.. meta::
   :copyright: Copyright 2012, 2016 Red Hat, Inc.
   :copyright: Copyright 2012 Christian Persch
   :copyright: Copyright 2016 Sam Thursfield
   :copyright: Copyright 2016 Patrick Griffis
   :copyright: Copyright 2018 Ninja-Koala
   :copyright: Copyright 2018, 2021 Emmanuele Bassi
   :copyright: Copyright 2020 Endless OS Foundation, LLC
   :license: LGPL-2.1-or-later
..
   This has to be duplicated from above to make it machine-readable by `reuse`:
   SPDX-FileCopyrightText: 2012, 2016 Red Hat, Inc.
   SPDX-FileCopyrightText: 2012 Christian Persch
   SPDX-FileCopyrightText: 2016 Sam Thursfield
   SPDX-FileCopyrightText: 2016 Patrick Griffis
   SPDX-FileCopyrightText: 2018 Ninja-Koala
   SPDX-FileCopyrightText: 2018, 2021 Emmanuele Bassi
   SPDX-FileCopyrightText: 2020 Endless OS Foundation, LLC
   SPDX-License-Identifier: LGPL-2.1-or-later

======================
glib-compile-resources
======================

----------------------
GLib resource compiler
----------------------

SYNOPSIS
--------

|  **glib-compile-resources** [*OPTION*…] *FILE*

DESCRIPTION
-----------

``glib-compile-resources`` reads the resource description from ``FILE`` and the
files that it references and creates a binary resource bundle that is suitable
for use with the ``GResource`` API. The resulting bundle is then written out
as-is, or as C source for linking into an application.

The XML resource files normally have the filename extension ``.gresource.xml``.
For a detailed description of the XML file format, see the
``GResource`` `documentation <https://docs.gtk.org/gio/struct.Resource.html>`_.

OPTIONS
-------

``-h``, ``--help``

  Print help and exit.

``--version``

  Print program version and exit.

``--target <TARGET>``

  Store the compiled resources in the file ``TARGET``. If not specified a
  filename based on the ``FILE`` basename is used.

``--sourcedir <DIRECTORY>``

  The files referenced in ``FILE`` are loaded from this directory. If not
  specified, the current directory is used. If ``--sourcedir`` is used more
  than once, the specified directories are searched in order.

``--generate``

  Write the output file in the format selected for by its filename extension:

  ``.c``

    C source

  ``.h``

    C header

  ``.gresource``

    resource bundle

``--generate-source``

  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.

``--generate-header``

  Generate a header file for use with C code generated by ``--generate-source``.

``--generate-dependencies``

  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 ``test.gresource`` as depending on
  all the files that ``test.gresource.xml`` includes, so that it is
  automatically rebuilt if any of them change::

     test.gresource: test.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies test.gresource.xml)

  Note that this may or may not be portable to non-GNU ``make``.

  Also see ``--dependency-file``.

``--c-name``

  Specify the prefix used for the C identifiers in the code generated by
  ``--generate-source`` and ``--generate-header``.

``--manual-register``

  By default, code generated by ``--generate-source`` 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 ``--manual-register``,
  which will generate custom register and unregister functions that your code
  can manually call at initialization and uninitialization time.

``--internal``

  By default, code generated by ``--generate-source`` declares all
  initialization functions as ``extern``.  So they are exported unless this is
  prevented by a link script or other means.  Since libraries usually want to
  use the functions only internally it can be more useful to declare them as
  ``G_GNUC_INTERNAL`` which is what ``--internal`` does.

``--external-data``

  By default, code generated by ``--generate-source`` embeds the resource data
  as a string literal. When ``--external-data`` is given, the data is only
  declared in the generated C file, and the data has to be linked externally.

``--dependency-file <FILE>``

  Write dependencies in the same style as ``gcc -M -MF`` to the given file. If
  ``FILE`` is ``-``, the dependencies are written to the standard output. Unlike
  ``--generate-dependencies``, this option can be combined with other
  ``--generate`` options to generate dependencies as a side-effect of generating
  sources.

``--generate-phony-targets``

  When creating a dependency file with ``--dependency-file`` include phony
  targets in the same style as ``gcc -MP``. This would typically be used with
  ``make``.

``--compiler <NAME>``

  Generate code that is going to target the given compiler ``NAME``. The current
  two compiler modes are ``gcc``, for all GCC-compatible toolchains; and
  ``msvc``, for the Microsoft Visual C Compiler. If this option isn’t set, then
  the default will be taken from the ``CC`` environment variable.

ENVIRONMENT
-----------

``XMLLINT``

  The full path to the ``xmllint`` executable. This is used to preprocess
  resources with the ``xml-stripblanks`` preprocessing option. If this
  environment variable is not set, ``xmllint`` is searched for in the ``PATH``.

``GDK_PIXBUF_PIXDATA``

  Deprecated since gdk-pixbuf 2.32, as ``GResource`` supports embedding
  modern image formats without conversion.

  The full path to the ``gdk-pixbuf-pixdata`` executable. This is used to
  preprocess resources with the ``to-pixdata`` preprocessing option. If this
  environment variable is not set, ``gdk-pixbuf-pixdata`` is searched for in the
  ``PATH``.

``JSON_GLIB_FORMAT``

  The full path to the ``json-glib-format`` executable. This is used to
  preprocess resources with the ``json-stripblanks`` preprocessing option. If
  this environment variable is not set, ``json-glib-format`` is searched for in
  the ``PATH``.