Imported Upstream version 2.50.2
[platform/upstream/glib.git] / docs / reference / gio / glib-compile-resources.1
1 '\" t
2 .\"     Title: glib-compile-resources
3 .\"    Author: Alexander Larsson
4 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
5 .\"      Date: 11/07/2016
6 .\"    Manual: User Commands
7 .\"    Source: GIO
8 .\"  Language: English
9 .\"
10 .TH "GLIB\-COMPILE\-RESOU" "1" "" "GIO" "User Commands"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 glib-compile-resources \- GLib resource compiler
32 .SH "SYNOPSIS"
33 .HP \w'\fBglib\-compile\-resources\fR\ 'u
34 \fBglib\-compile\-resources\fR [OPTION...] {FILE}
35 .SH "DESCRIPTION"
36 .PP
37 \fBglib\-compile\-resources\fR
38 reads the resource description from
39 \fIFILE\fR
40 and the files that it references and creates a binary resource bundle that is suitable for use with the
41 \fBGResource\fR
42 API\&. The resulting bundle is then written out as\-is, or as C source for linking into an application\&.
43 .PP
44 The XML resource files normally have the filename extension
45 \&.gresource\&.xml\&. For a detailed description of the XML file format, see the
46 \fBGResource\fR
47 documentation\&.
48 .SH "OPTIONS"
49 .PP
50 \fB\-h\fR, \fB\-\-help\fR
51 .RS 4
52 Print help and exit
53 .RE
54 .PP
55 \fB\-\-version\fR
56 .RS 4
57 Print program version and exit
58 .RE
59 .PP
60 \fB\-\-target=\fR\fB\fITARGET\fR\fR
61 .RS 4
62 Store the compiled resources in the file
63 \fITARGET\fR\&. If not specified a filename based on the
64 \fIFILE\fR
65 basename is used\&.
66 .RE
67 .PP
68 \fB\-\-sourcedir=\fR\fB\fIDIRECTORY\fR\fR
69 .RS 4
70 The files referenced in
71 \fIFILE\fR
72 are loaded from this directory\&. If not specified, the current directory is used\&.
73 .RE
74 .PP
75 \fB\-\-generate\fR
76 .RS 4
77 Write the output file in the format selected for by its filename extension:
78 .PP
79 \&.c
80 .RS 4
81 C source
82 .RE
83 .PP
84 \&.h
85 .RS 4
86 C header
87 .RE
88 .PP
89 \&.gresource
90 .RS 4
91 resource bundle
92 .RE
93 .sp
94 .RE
95 .PP
96 \fB\-\-generate\-source\fR
97 .RS 4
98 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\&.
99 .RE
100 .PP
101 \fB\-\-generate\-header\fR
102 .RS 4
103 Generate a header file for use with C code generated by
104 \fB\-\-generate\-source\fR\&.
105 .RE
106 .PP
107 \fB\-\-generate\-dependencies\fR
108 .RS 4
109 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
110 \fItest\&.gresource\fR
111 as depending on all the files that
112 \fItest\&.gresource\&.xml\fR
113 includes, so that is is automatically rebuilt if any of them change:
114 .sp
115 .if n \{\
116 .RS 4
117 .\}
118 .nf
119 test\&.gresource: test\&.gresource\&.xml $(shell $(GLIB_COMPILE_RESOURCES) \-\-generate\-dependencies test\&.gresource\&.xml)
120 .fi
121 .if n \{\
122 .RE
123 .\}
124 .sp
125 Note that this may or may not be portable to non\-GNU
126 \fBmake\fR\&.
127 .sp
128 Also see
129 \fB\-\-dependency\-file\fR\&.
130 .RE
131 .PP
132 \fB\-\-c\-name\fR
133 .RS 4
134 Specify the prefix used for the C identifiers in the code generated by
135 \fB\-\-generate\-source\fR
136 and
137 \fB\-\-generate\-header\fR\&.
138 .RE
139 .PP
140 \fB\-\-manual\-register\fR
141 .RS 4
142 By default code generated by
143 \fB\-\-generate\-source\fR
144 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
145 \fB\-\-manual\-register\fR, which will generate custom register and unregister functions that your code can manually call at initialization and uninitialization time\&.
146 .RE
147 .PP
148 \fB\-\-internal\fR
149 .RS 4
150 By default code generated by
151 \fB\-\-generate\-source\fR
152 declares all initialization functions as
153 \fBextern\fR\&. 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
154 G_GNUC_INTERNAL
155 which is what
156 \fB\-\-internal\fR
157 does\&.
158 .RE
159 .PP
160 \fB\-\-dependency\-file=\fR\fB\fIFILE\fR\fR
161 .RS 4
162 Write dependencies in the same style as gcc \-M \-MF to the given file\&. If
163 \fBFILE\fR
164 is \-, the dependencies are written to the standard output\&. Unlike
165 \fB\-\-generate\-dependencies\fR, this option can be combined with other
166 \fB\-\-generate\fR
167 options to generate dependencies as a side\-effect of generating sources\&.
168 .RE
169 .SH "ENVIRONMENT"
170 .PP
171 \fBXMLLINT\fR
172 .RS 4
173 The full path to the xmllint executable\&. This is used to preprocess resources with the
174 xml\-stripblanks
175 preprocessing option\&. If this environment variable is not set, xmllint is searched in the
176 \fBPATH\fR\&.
177 .RE
178 .PP
179 \fBGDK_PIXBUF_PIXDATA\fR
180 .RS 4
181 The full path to the gdk\-pixbuf\-pixdata executable\&. This is used to preprocess resources with the
182 to\-pixdata
183 preprocessing option\&. If this environment variable is not set, gdk\-pixbuf\-pixdata is searched in the
184 \fBPATH\fR\&.
185 .RE