/usr/share/doc/libgtk-3-doc/gtk3/gtk-building.html is in libgtk-3-doc 3.4.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Compiling the GTK+ libraries</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="gtk.html" title="Part I. GTK+ Overview">
<link rel="prev" href="gtk-getting-started.html" title="Getting Started with GTK+">
<link rel="next" href="gtk-compiling.html" title="Compiling GTK+ Applications">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="gtk-getting-started.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="gtk.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 3 Reference Manual</th>
<td><a accesskey="n" href="gtk-compiling.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gtk-building"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">Compiling the GTK+ libraries</span></h2>
<p>Compiling the GTK+ Libraries —
How to compile GTK+ itself
</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="overview"></a><h2>Building GTK+ on UNIX-like systems</h2>
<p>
This chapter covers building and installing GTK+ on UNIX and
UNIX-like systems such as Linux. Compiling GTK+ on Microsoft
Windows is different in detail and somewhat more difficult to
get going since the necessary tools aren't included with
the operating system.
</p>
<p>
Before we get into the details of how to compile GTK+, we should
mention that in many cases, binary packages of GTK+ prebuilt for
your operating system will be available, either from your
operating system vendor or from independent sources. If such a
set of packages is available, installing it will get you
programming with GTK+ much faster than building it yourself. In
fact, you may well already have GTK+ installed on your system
already.
</p>
<p>
On UNIX-like systems GTK+ uses the standard GNU build system,
using <span class="application">autoconf</span> for package
configuration and resolving portability issues,
<span class="application">automake</span> for building makefiles that
comply with the GNU Coding Standards, and
<span class="application">libtool</span> for building shared libraries
on multiple platforms.
</p>
<p>
If you are building GTK+ from the distributed source packages,
then you won't need these tools installed; the necessary pieces
of the tools are already included in the source packages. But
it's useful to know a bit about how packages that use these
tools work. A source package is distributed as a
<code class="literal">tar.bz2</code> or <code class="literal">tar.xz</code> file
which you unpack into a directory full of the source files as follows:
</p>
<pre class="programlisting">
tar xvfj gtk+-3.2.0.tar.bz2
tar xvfJ gtk+-3.2.0.tar.xz
</pre>
<p>
In the toplevel directory that is created, there will be
a shell script called <code class="filename">configure</code> which
you then run to take the template makefiles called
<code class="filename">Makefile.in</code> in the package and create
makefiles customized for your operating system.
The <code class="filename">configure</code> script can be passed
various command line arguments to determine how the package
is built and installed. The most commonly useful argument is
the <code class="systemitem">--prefix</code> argument which
determines where the package is installed. To install a package
in <code class="filename">/opt/gtk</code> you would run configure as:
</p>
<pre class="programlisting">
./configure --prefix=/opt/gtk
</pre>
<p>
A full list of options can be found by running
<code class="filename">configure</code> with the
<code class="systemitem">--help</code> argument. In general, the defaults are
right and should be trusted. After you've run
<code class="filename">configure</code>, you then run the
<span class="command"><strong>make</strong></span> command to build the package and install
it.
</p>
<pre class="programlisting">
make
make install
</pre>
<p>
If you don't have permission to write to the directory you are
installing in, you may have to change to root temporarily before
running <code class="literal">make install</code>. Also, if you are
installing in a system directory, on some systems (such as
Linux), you will need to run <span class="command"><strong>ldconfig</strong></span> after
<code class="literal">make install</code> so that the newly installed
libraries will be found.
</p>
<p>
Several environment variables are useful to pass to set before
running configure. <code class="envar">CPPFLAGS</code> contains options to
pass to the C compiler, and is used to tell the compiler where
to look for include files. The <code class="envar">LDFLAGS</code> variable
is used in a similar fashion for the linker. Finally the
<code class="envar">PKG_CONFIG_PATH</code> environment variable contains
a search path that <span class="command"><strong>pkg-config</strong></span> (see below)
uses when looking for for file describing how to compile
programs using different libraries. If you were installing GTK+
and it's dependencies into <code class="filename">/opt/gtk</code>, you
might want to set these variables as:
</p>
<pre class="programlisting">
CPPFLAGS="-I/opt/gtk/include"
LDFLAGS="-L/opt/gtk/lib"
PKG_CONFIG_PATH="/opt/gtk/lib/pkgconfig"
export CPPFLAGS LDFLAGS PKG_CONFIG_PATH
</pre>
<p>
You may also need to set the <code class="envar">LD_LIBRARY_PATH</code>
environment variable so the systems dynamic linker can find
the newly installed libraries, and the <code class="envar">PATH</code>
environment program so that utility binaries installed by
the various libraries will be found.
</p>
<pre class="programlisting">
LD_LIBRARY_PATH="/opt/gtk/lib"
PATH="/opt/gtk/bin:$PATH"
export LD_LIBRARY_PATH PATH
</pre>
</div>
<div class="refsect1">
<a name="dependencies"></a><h2>Dependencies</h2>
<p>
Before you can compile the GTK+ widget toolkit, you need to have
various other tools and libraries installed on your
system. The two tools needed during the build process (as
differentiated from the tools used in when creating GTK+
mentioned above such as <span class="application">autoconf</span>)
are <span class="command"><strong>pkg-config</strong></span> and GNU make.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
<a class="ulink" href="http://pkg-config.freedesktop.org" target="_top">pkg-config</a>
is a tool for tracking the compilation flags needed for
libraries that are used by the GTK+ libraries. (For each
library, a small <code class="literal">.pc</code> text file is installed
in a standard location that contains the compilation flags
needed for that library along with version number information.)
</p></li>
<li class="listitem"><p>
The GTK+ makefiles will mostly work with different versions
of <span class="command"><strong>make</strong></span>, however, there tends to be
a few incompatibilities, so the GTK+ team recommends
installing <a class="ulink" href="http://www.gnu.org/software/make" target="_top">GNU
make</a> if you don't already have it on your system
and using it. (It may be called <span class="command"><strong>gmake</strong></span>
rather than <span class="command"><strong>make</strong></span>.)
</p></li>
</ul></div>
<p>
Some of the libraries that GTK+ depends on are maintained by
by the GTK+ team: GLib, GdkPixbuf, Pango, ATK and GObject Introspection.
Other libraries are maintained separately.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The GLib library provides core non-graphical functionality
such as high level data types, Unicode manipulation, and
an object and type system to C programs. It is available
from the <a class="ulink" href="http://ftp.gtk.org/pub/glib/" target="_top">GTK+
FTP site</a> or
<a class="ulink" href="http://download.gnome.org/sources/glib/" target="_top">here</a>.
</p></li>
<li class="listitem"><p>
The <a class="ulink" href="http://git.gnome.org/browse/gdk-pixbuf/" target="_top">GdkPixbuf library</a>
provides facilities for loading images in a variety of file formats.
It is available
<a class="ulink" href="http://download.gnome.org/sources/gdk-pixbuf/" target="_top">here</a>.
</p></li>
<li class="listitem"><p>
<a class="ulink" href="http://www.pango.org" target="_top">Pango</a> is a library
for internationalized text handling. It is available
<a class="ulink" href="http://download.gnome.org/sources/pango/" target="_top">here</a>.
</p></li>
<li class="listitem"><p>
ATK is the Accessibility Toolkit. It provides a set of generic
interfaces allowing accessibility technologies such as
screen readers to interact with a graphical user interface.
It is available
<a class="ulink" href="http://download.gnome.org/sources/atk/" target="_top">here</a>.
</p></li>
<li class="listitem"><p>
<a class="ulink" href="http://live.gnome.org/GObjectIntrospection" target="_top">Gobject Introspection</a>
is a framework for making introspection data available to
language bindings. It is available
<a class="ulink" href="http://download.gnome.org/sources/gobject-introspection/" target="_top">here</a>.
</p></li>
</ul></div>
<div class="itemizedlist">
<p class="title"><b>External dependencies</b></p>
<ul class="itemizedlist" type="disc">
<li class="listitem"><p>
The <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">GNU
libiconv library</a> is needed to build GLib if your
system doesn't have the <code class="function">iconv()</code>
function for doing conversion between character
encodings. Most modern systems should have
<code class="function">iconv()</code>.
</p></li>
<li class="listitem"><p>
The libintl library from the <a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">GNU gettext
package</a> is needed if your system doesn't have the
<code class="function">gettext()</code> functionality for handling
message translation databases.
</p></li>
<li class="listitem"><p>
The libraries from the X window system are needed to build
Pango and GTK+. You should already have these installed on
your system, but it's possible that you'll need to install
the development environment for these libraries that your
operating system vendor provides.
</p></li>
<li class="listitem"><p>
The <a class="ulink" href="http://www.fontconfig.org" target="_top">fontconfig</a>
library provides Pango with a standard way of locating
fonts and matching them against font names.
</p></li>
<li class="listitem"><p>
<a class="ulink" href="http://www.cairographics.org" target="_top">Cairo</a>
is a graphics library that supports vector graphics and image
compositing. Both Pango and GTK+ use cairo for all of their
drawing.
</p></li>
<li class="listitem"><p>
The <a class="ulink" href="http://www.freedesktop.org/wiki/Software/shared-mime-info" target="_top">shared-mime-info</a>
package is not a hard dependency of GTK+, but it contains definitions
for mime types that are used by GIO and, indirectly, by GTK+.
gdk-pixbuf will use GIO for mime type detection if possible. For this
to work, shared-mime-info needs to be installed and
<code class="envar">XDG_DATA_DIRS</code> set accordingly at configure time.
Otherwise, gdk-pixbuf falls back to its built-in mime type detection.
</p></li>
</ul>
</div>
</div>
<div class="refsect1">
<a name="building"></a><h2>Building and testing GTK+</h2>
<p>
First make sure that you have the necessary external
dependencies installed: <span class="command"><strong>pkg-config</strong></span>, GNU make,
the JPEG, PNG, and TIFF libraries, FreeType, and, if necessary,
libiconv and libintl. To get detailed information about building
these packages, see the documentation provided with the
individual packages.
On a Linux system, it's quite likely you'll have all of these
installed already except for <span class="command"><strong>pkg-config</strong></span>.
</p>
<p>
Then build and install the GTK+ libraries in the order:
GLib, Pango, ATK, then GTK+. For each library, follow the
steps of <code class="literal">configure</code>, <code class="literal">make</code>,
<code class="literal">make install</code> mentioned above. If you're
lucky, this will all go smoothly, and you'll be ready to
<a class="link" href="gtk-compiling.html" title="Compiling GTK+ Applications">start compiling your own GTK+
applications</a>. You can test your GTK+ installation
by running the <span class="command"><strong>gtk3-demo</strong></span> program that
GTK+ installs.
</p>
<p>
If one of the <code class="filename">configure</code> scripts fails or running
<span class="command"><strong>make</strong></span> fails, look closely at the error
messages printed; these will often provide useful information
as to what went wrong. When <code class="filename">configure</code>
fails, extra information, such as errors that a test compilation
ran into, is found in the file <code class="filename">config.log</code>.
Looking at the last couple of hundred lines in this file will
frequently make clear what went wrong. If all else fails, you
can ask for help on the gtk-list mailing list.
See <a class="xref" href="gtk-resources.html" title="Mailing lists and bug reports"><span class="refentrytitle">Mailing lists and bug reports</span>(3)</a> for more information.
</p>
</div>
<div class="refsect1">
<a name="extra-configuration-options"></a><h2>Extra Configuration Options</h2>
<p>
In addition to the normal options, the
<span class="command"><strong>configure</strong></span> script for the GTK+ library
supports a number of additional arguments. (Command line
arguments for the other GTK+ libraries are described in
the documentation distributed with the those libraries.)
</p>
<div class="cmdsynopsis"><p><code class="command">configure</code> <br> [[--disable-modules] | [--enable-modules]]<br> [[--with-included-immodules=MODULE1,MODULE2,...]]<br> [[--enable-debug=[no/minimum/yes]]]<br> [[--disable-Bsymbolic] | [--enable-Bsymbolic]]<br> [[--disable-xkb] | [--enable-xkb]]<br> [[--disable-xinerama] | [--enable-xinerama]]<br> [[--disable-gtk-doc] | [--enable-gtk-doc]]<br> [[--disable-cups] | [--enable-cups]]<br> [[--disable-papi] | [--enable-papi]]<br> [[--enable-xinput] | [--disable-xinput]]<br> [[--enable-packagekit] | [--disable-packagekit]]<br> [[--enable-x11-backend] | [--disable-x11-backend] | [--enable-win32-backend] | [--disable-win32-backend] | [--enable-quartz-backend] | [--disable-quartz-backend]]<br> [[--enable-introspection=[no/auto/yes]]]<br> [[--enable-gtk2-dependency] | [--disable-gtk2-dependency]]</p></div>
<p>
</p>
<p><b><code class="systemitem">--disable-modules</code> and
<code class="systemitem">--enable-modules</code>. </b>
Normally GTK+ will try to build the input method modules
as little shared libraries that are loaded on demand.
The <code class="systemitem">--disable-modules</code> argument
indicates that they should all be built statically
into the GTK+ library instead. This is useful for
people who need to produce statically-linked binaries.
If neither <code class="systemitem">--disable-modules</code> nor
<code class="systemitem">--enable-modules</code> is specified,
then the <span class="command"><strong>configure</strong></span> script will try to
auto-detect whether shared modules work on your system.
</p>
<p><b><code class="systemitem">--with-included-immodules</code>. </b>
This option allows you to specify which input method modules you
want to include directly into the GTK+ shared library, as opposed
to building them as loadable modules.
</p>
<p><b><code class="systemitem">--enable-debug</code>. </b>
Turns on various amounts of debugging support. Setting this to
'no' disables g_assert(), g_return_if_fail(), g_return_val_if_fail() and all cast checks between different object types. Setting it
to 'minimum' disables only cast checks. Setting it to 'yes' enables
<a class="link" href="gtk-running.html#GTK-Debug-Options" title="GTK_DEBUG">runtime debugging</a>.
The default is 'minimum'.
Note that 'no' is fast, but dangerous as it tends to destabilize
even mostly bug-free software by changing the effect of many bugs
from simple warnings into fatal crashes. Thus
<code class="option">--enable-debug=no</code> should <span class="emphasis"><em>not</em></span>
be used for stable releases of GTK+.
</p>
<p><b><code class="systemitem">--disable-Bsymbolic</code> and
<code class="systemitem">--enable-Bsymbolic</code>. </b>
The option <code class="systemitem">--disable-Bsymbolic</code>
turns off the use of the -Bsymbolic-functions linker flag.
This is only necessary if you want to override GTK+ functions
by using <code class="envar">LD_PRELOAD</code>.
</p>
<p><b><code class="systemitem">--enable-explicit-deps</code> and
<code class="systemitem">--disable-explicit-deps</code>. </b>
If <code class="systemitem">--enable-explicit-deps</code> is
specified then GTK+ will write the full set of libraries
that GTK+ depends upon into its <code class="literal">.pc</code> files to be used when
programs depending on GTK+ are linked. Otherwise, GTK+
only will include the GTK+ libraries themselves, and
will depend on system library dependency facilities to
bring in the other libraries.
By default GTK+ will disable explicit dependencies unless
it detects that they are needed on the system. (If you
specify <code class="systemitem">--enable-static</code> to force
building of static libraries, then explicit dependencies
will be written since library dependencies don't work
for static libraries.) Specifying
<code class="systemitem">--enable-explicit-deps</code> or
<code class="systemitem">--enable-static</code> can cause
compatibility
problems when libraries that GTK+ depends upon change
their versions, and should be avoided if possible.
</p>
<p><b><code class="systemitem">--disable-xkb</code> and
<code class="systemitem">--enable-xkb</code>. </b>
By default the <span class="command"><strong>configure</strong></span> script will try
to auto-detect whether the XKB extension is supported by
the X libraries GTK+ is linked with.
These options can be used to explicitly control whether
GTK+ will support the XKB extension.
</p>
<p><b><code class="systemitem">--disable-xinerama</code> and
<code class="systemitem">--enable-xinerama</code>. </b>
By default the <span class="command"><strong>configure</strong></span> script will try
to link against the Xinerama libraries if they are found.
These options can be used to explicitly control whether
Xinerama should be used.
</p>
<p><b><code class="systemitem">--disable-xinput</code> and
<code class="systemitem">--enable-xinput</code>. </b>
Controls whether GTK+ is built with support for the XInput
or XInput2 extension. These extensions provide an extended
interface to input devices such as graphics tablets.
When this support is compiled in, specially written
GTK+ programs can get access to subpixel positions,
multiple simultaneous input devices, and extra "axes"
provided by the device such as pressure and tilt
information.
</p>
<p><b><code class="systemitem">--disable-gtk-doc</code> and
<code class="systemitem">--enable-gtk-doc</code>. </b>
The <span class="application">gtk-doc</span> package is
used to generate the reference documentation included
with GTK+. By default support for <span class="application">gtk-doc</span>
is disabled because it requires various extra dependencies
to be installed. If you have
<span class="application">gtk-doc</span> installed and
are modifying GTK+, you may want to enable
<span class="application">gtk-doc</span> support by passing
in <code class="systemitem">--enable-gtk-doc</code>. If not
enabled, pre-generated HTML files distributed with GTK+
will be installed.
</p>
<p><b><code class="systemitem">--disable-cups</code> and
<code class="systemitem">--enable-cups</code>. </b>
By default the <span class="command"><strong>configure</strong></span> script will try
to build the cups print backend if the cups libraries are found.
These options can be used to explicitly control whether
the cups print backend should be built.
</p>
<p><b><code class="systemitem">--disable-papi</code> and
<code class="systemitem">--enable-papi</code>. </b>
By default the <span class="command"><strong>configure</strong></span> script will try
to build the papi print backend if the papi libraries are found.
These options can be used to explicitly control whether
the papi print backend should be built.
</p>
<p><b><code class="systemitem">--disable-packagekit</code> and
<code class="systemitem">--enable-packagekit</code>. </b>
By default the <span class="command"><strong>configure</strong></span> script will try
to build the PackageKit support for the open-with dialog if
the PackageKit libraries are found.
These options can be used to explicitly control whether
PackageKit support should be built.
</p>
<p><b><code class="systemitem">--enable-x11-backend</code>,
<code class="systemitem">--disable-x11-backend</code>,
<code class="systemitem">--enable-win32-backend</code>,
<code class="systemitem">--disable-win32-backend</code>,
<code class="systemitem">--enable-quartz-backend</code>,
and <code class="systemitem">--disable-quartz-backend</code>. </b>
Enables specific backends for GDK. If none of these options
are given, the x11 backend will be enabled by default,
unless the platform is Windows, in which case the default is
win32. If any backend is explicitly enabled or disabled, no
other platform will be enabled automatically. Other
supported backends are the quartz backend for OS X.
</p>
<p><b><code class="systemitem">--enable-introspection</code>. </b>
Build with or without introspection support.
The default is 'auto'.
</p>
<p><b><code class="systemitem">--enable-gtk2-dependency</code> or
<code class="systemitem">--disable-gtk2-dependency</code>. </b>
Whether to rely on an exiting gtk-update-icon-cache utility
instead of building our own. Distributions which are shipping
both GTK+ 2.x and GTK+ 3 may want to use this option to
avoid file conflicts between these packages.
The default is to build gtk-update-icon-cache.
</p>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.18</div>
</body>
</html>
|