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 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>
Installing Support Files
</title>
<meta name="GENERATOR" content=
"Modular DocBook HTML Stylesheet Version 1.45">
<link rel="HOME" title="GTK+ / Gnome Application Development"
href="ggad.html">
<link rel="UP" title="Creating Your Source Tree" href=
"cha-source.html">
<link rel="PREVIOUS" title="Relevant GNU Documentation" href=
"z71.html">
<link rel="NEXT" title="Gnome Application Basics" href=
"cha-startup.html">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink=
"#840084" alink="#0000FF">
<div class="NAVHEADER">
<table width="100%" border="0" bgcolor="#ffffff" cellpadding=
"1" cellspacing="0">
<tr>
<th colspan="4" align="center">
<font color="#000000" size="2">GTK+ / Gnome Application
Development</font>
</th>
</tr>
<tr>
<td width="25%" bgcolor="#ffffff" align="left">
<a href="z71.html"><font color="#0000ff" size="2"><b>
<<< Previous</b></font></a>
</td>
<td width="25%" colspan="2" bgcolor="#ffffff" align=
"center">
<font color="#0000ff" size="2"><b><a href="ggad.html">
<font color="#0000ff" size="2"><b>
Home</b></font></a></b></font>
</td>
<td width="25%" bgcolor="#ffffff" align="right">
<a href="cha-startup.html"><font color="#0000ff" size=
"2"><b>Next >>></b></font></a>
</td>
</tr>
</table>
</div>
<div class="SECT1">
<h1 class="SECT1">
<a name="Z72">Installing Support Files</a>
</h1>
<p>
Complete Gnome applications consist of more than just code.
They have online help, are listed on the Gnome panel's
menu, have translations, and have a desktop icon. They
might come with pixmaps as well: a logo for the "about"
dialog, a graphic for a "wizard," or a small icons to help
the user rapidly distinguish menu items or list elements.
This section tells you how to ship some of these files.
</p>
<div class="SECT2">
<h2 class="SECT2">
<a name="Z73">Installing Datafiles: Documentation and
Pixmaps</a>
</h2>
<p>
Documentation and pixmaps are installed in much the same
way; <tt class="APPLICATION">automake</tt> allows you to
install datafiles to arbitrary locations, and you can use
variables defined by <tt class="FILENAME">configure</tt>
to decide where they should go.
</p>
<div class="SECT3">
<h3 class="SECT3">
<a name="Z74">Pixmaps</a>
</h3>
<p>
To install datafiles from your <tt class="FILENAME">
Makefile.am</tt> you simply come up with a name for the
install target---<tt class="APPLICATION">pixmap</tt>
seems good---then create a variable for the directory
and a corresponding variable for the files to install
there. For example:
</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
EXTRA_DIST = gnome-hello-logo.png
pixmapdir = $(datadir)/pixmaps
pixmap_DATA = gnome-hello-logo.png
</pre>
</td>
</tr>
</table>
<p>
The "<tt class="APPLICATION">pixmap</tt>" string
connects the <tt class="APPLICATION">pixmapdir</tt>
variable with the <tt class="APPLICATION">
pixmap_DATA</tt> variable. <tt class="APPLICATION">
automake</tt> interprets the <tt class="APPLICATION">
_DATA</tt> suffix and generates appropriate rules in
<tt class="FILENAME">Makefile.in</tt>. This <tt class=
"FILENAME">Makefile.am</tt> segment installs <tt class=
"APPLICATION">gnome-hello-logo.png</tt> into <tt class=
"APPLICATION">$(datadir)/pixmaps</tt>; <tt class=
"APPLICATION">$(datadir)</tt> is a variable filled in
by <tt class="FILENAME">configure</tt>. Typically <tt
class="APPLICATION">$(datadir)</tt> is <tt class=
"APPLICATION">/usr/local/share</tt> (more precisely,
<tt class="APPLICATION">$(prefix)/share</tt>), which is
the standard location for architecture-independent data
files (that is, files which can be shared between
several systems with different binary file formats).
</p>
<p>
<a href="z72.html#SEC-EXTRADIST">the section called <i>
<tt class="APPLICATION">EXTRA_DIST</tt></i></a>
describes the <tt class="APPLICATION">EXTRA_DIST</tt>
variable.
</p>
<p>
The standard location for Gnome pixmaps is <tt class=
"APPLICATION">$(datadir)/pixmaps</tt>, so we used that
in the example. The Gnome Project encourages the use of
PNG format for all pixmaps; this format is supported by
<tt class="APPLICATION">gdk_imlib</tt>, the Gnome
image-loading library. It is also small, fast, and
unencumbered by patents.
</p>
</div>
<div class="SECT3">
<h3 class="SECT3">
<a name="SEC-INSTALLDOCS">Documentation</a>
</h3>
<p>
Installing documentation uses the same principles, with
a little more complication. Gnome documentation is
typically written in DocBook. DocBook is an SGML DTD
("Document Type Definition") just as HTML is. However,
DocBook's tags are designed for technical
documentation. Documentation written in DocBook can be
converted to several other formats, including
PostScript and HTML. Standardly, you want to install
the HTML format so users can read it with their web
browser or the Gnome help browser.
</p>
<p>
The Gnome libraries and help browser understand a file
called <tt class="FILENAME">topic.dat</tt>, which is
simply a list of help topics with corresponding URLs.
It serves as an index of help topics for your
application. Here's an example, with only two entries:
</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
gnome-hello.html GnomeHello manual
advanced.html Advanced Topics
</pre>
</td>
</tr>
</table>
<p>
URLs are relative to the directory where you install
your help files.
</p>
<p>
You should consider in advance that your documentation
will be translated into other languages. It is nice to
make a subdirectory in your source tree for each
locale; for example, the default <tt class=
"APPLICATION">C</tt> locale or the <tt class=
"APPLICATION">es</tt> (Spanish) locale. That way
translations don't cause clutter. Gnome expects help to
be installed in a directory named after the locale, so
this arrangement is convenient from that point of view
as well. Your documentation directory might look like
this one from the <tt class="APPLICATION">
GnomeHello</tt> example application:
</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
doc/
Makefile.am
C/
Makefile.am
gnome-hello.sgml
topic.dat
es/
Makefile.am
gnome-hello.sgml
topic.dat
</pre>
</td>
</tr>
</table>
<p>
Here is <tt class="FILENAME">doc/C/Makefile.am</tt>:
</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
gnome_hello_helpdir = $(datadir)/gnome/help/gnome-hello/C
gnome_hello_help_DATA = \
gnome-hello.html \
topic.dat
SGML_FILES = \
gnome-hello.sgml
# files that aren't in a binary/data/library target have to be listed here
# to be included in the tarball when you 'make dist'
EXTRA_DIST = \
topic.dat \
$(SGML_FILES)
## The - before the command means to ignore it if it fails. that way
## people can still build the software without the docbook tools
all:
gnome-hello.html: gnome-hello/gnome-hello.html
-cp gnome-hello/gnome-hello.html .
gnome-hello/gnome-hello.html: $(SGML_FILES)
-db2html gnome-hello.sgml
## when we make dist, we include the generated HTML so people don't
## have to have the docbook tools
dist-hook:
mkdir $(distdir)/gnome-hello
-cp gnome-hello/*.html gnome-hello/*.css $(distdir)/gnome-hello
-cp gnome-hello.html $(distdir)
install-data-local: gnome-hello.html
$(mkinstalldirs) $(gnome_hello_helpdir)/images
-for file in $(srcdir)/gnome-hello/*.html $(srcdir)/gnome-hello/*.css; do \
basefile=`basename $$file`; \
$(INSTALL_DATA) $(srcdir)/$$file $(gnome_hello_helpdir)/$$basefile; \
done
gnome-hello.ps: gnome-hello.sgml
-db2ps $<
gnome-hello.rtf: gnome-hello.sgml
-db2rtf $<
</pre>
</td>
</tr>
</table>
<p>
In particular notice the install directory for the
generated HTML files: <tt class="APPLICATION">
$(datadir)/gnome/help/gnome-hello/C</tt>. The Gnome
libraries look for help here. Each application's help
goes in its own directory under <tt class=
"APPLICATION">$(datadir)/gnome/help</tt>. Each locale's
documentation is installed in its own subdirectory of
the application directory. Other rules in <tt class=
"FILENAME">Makefile.am</tt> run the DocBook-to-HTML
converter, include HTML in the distribution tarball,
and create PostScript and Rich Text Format targets.
(Users can create PostScript by typing <tt class=
"APPLICATION">make gnome-hello.ps</tt> explicitly.)
</p>
</div>
</div>
<div class="SECT2">
<h2 class="SECT2">
<a name="SEC-.DESKTOP"><tt class="APPLICATION">
.desktop</tt> Entries</a>
</h2>
<p>
Gnome programs come with "<tt class=
"APPLICATION">.desktop</tt> entries," which are simply
small files describing how the application should appear
in menus. Installing a <tt class="APPLICATION">
.desktop</tt> entry causes your application to show up in
the Gnome panel menu. Here is <tt class="FILENAME">
gnome-hello.desktop</tt>:
</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
[Desktop Entry]
Name=Gnome Hello
Name[es]=Gnome Hola
Name[fi]=GNOME-hei
Name[gl]=Ola GNOME
Name[no]=Gnome hallo
Name[sv]=Gnome Hej
Name[pl]=Halo GNOME
Comment=Hello World
Comment[es]=Hola Mundo
Comment[fi]=Hei, maailma
Comment[gl]=Ola Mundo
Comment[sv]=Hej Världen
Comment[no]=Hallo verden
Comment[pl]=Witaj ¶wiecie
Exec=gnome-hello
Icon=gnome-hello-logo.png
Terminal=0
Type=Application
</pre>
</td>
</tr>
</table>
<p>
The file consists of key-value pairs. The <tt class=
"APPLICATION">Name</tt> key specifies the name of your
application in the default (<tt class=
"APPLICATION">C</tt>) locale; any key can have
translations with a locale appended in brackets, such as
<tt class="APPLICATION">Name[es]</tt>. The <tt class=
"APPLICATION">Comment</tt> key is a "tooltip" or hint
describing the application in more detail. <tt class=
"APPLICATION">Exec</tt> is the command line to use to
execute the program. <tt class="APPLICATION">
Terminal</tt> is a boolean value; if non-zero, the
program will be run inside a terminal. <tt class=
"APPLICATION">Type</tt> should always be "Application" in
this context.
</p>
<p>
Installing a <tt class="APPLICATION">.desktop</tt> entry
is simple; here is the toplevel <tt class="FILENAME">
Makefile.am</tt> from GnomeHello again:
</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
SUBDIRS = macros po intl src pixmaps doc
## We dist autogen.sh since this is an example program
## Real-world programs do not need to distribute autogen.sh
EXTRA_DIST = \
gnome-hello.desktop \
autogen.sh
Applicationsdir = $(datadir)/gnome/apps/Applications
Applications_DATA = gnome-hello.desktop
</pre>
</td>
</tr>
</table>
<p>
Notice that there is a directory tree under <tt class=
"APPLICATION">$(datadir)/gnome/apps/</tt> with
subdirectories that arrange programs into categories.
GnomeHello installs itself in the "Applications"
category; other programs might choose "Games,"
"Graphics," "Internet," or whatever is appropriate. Try
to choose a category that already exists, rather than
inventing your own.
</p>
</div>
<div class="SECT2">
<h2 class="SECT2">
<a name="SEC-EXTRADIST"><tt class="APPLICATION">
EXTRA_DIST</tt></a>
</h2>
<p>
The <tt class="APPLICATION">EXTRA_DIST</tt> variable in a
<tt class="FILENAME">Makefile.am</tt> lists files to be
included in the distribution (tarball). Most important
files are automatically included; for example, all files
listed as source files for binaries or libraries.
However, <tt class="APPLICATION">automake</tt> does not
know about <tt class="APPLICATION">.desktop</tt> files,
or SGML documentation; so these files must be listed in
<tt class="APPLICATION">EXTRA_DIST</tt>. <tt class=
"APPLICATION">make distcheck</tt>'s attempt to build the
distribution will normally fail if you leave files out of
<tt class="APPLICATION">EXTRA_DIST</tt>.
</p>
</div>
</div>
<div class="NAVFOOTER">
<br>
<br>
<table width="100%" border="0" bgcolor="#ffffff" cellpadding=
"1" cellspacing="0">
<tr>
<td width="25%" bgcolor="#ffffff" align="left">
<a href="z71.html"><font color="#0000ff" size="2"><b>
<<< Previous</b></font></a>
</td>
<td width="25%" colspan="2" bgcolor="#ffffff" align=
"center">
<font color="#0000ff" size="2"><b><a href="ggad.html">
<font color="#0000ff" size="2"><b>
Home</b></font></a></b></font>
</td>
<td width="25%" bgcolor="#ffffff" align="right">
<a href="cha-startup.html"><font color="#0000ff" size=
"2"><b>Next >>></b></font></a>
</td>
</tr>
<tr>
<td colspan="2" align="left">
<font color="#000000" size="2"><b>Relevant GNU
Documentation</b></font>
</td>
<td colspan="2" align="right">
<font color="#000000" size="2"><b>Gnome Application
Basics</b></font>
</td>
</tr>
</table>
</div>
</body>
</html>
|