Compiling the GtkGLExt librariesCompiling the GtkGLExt Libraries — How to compile GtkGLExt |
This chapter covers building and installing GtkGLExt on UNIX and UNIX-like systems such as Linux. Compiling GtkGLExt 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.
On UNIX-like systems GtkGLExt uses the standard GNU build system, using autoconf for package configuration and resolving portability issues, automake for building makefiles that comply with the GNU Coding Standards, and libtool for building shared libraries on multiple platforms.
If you are building GtkGLExt from the distributed source packages,
then 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
tar.gz
or tar.bz2
file
which you unpack into a directory full of the source files as follows:
tar zxvf gtkglext-x.y.z.tar.gz tar jxvf gtkglext-x.y.z.tar.bz2
In the toplevel of the directory that is created, there will be
a shell script called configure
which
you then run to take the template makefiles called
Makefile.in
in the package and create
makefiles customized for your operating system. The configure
script can be passed various command line arguments to determine how
the package is built and installed. The most commonly useful
argument is the --prefix
argument which
determines where the package is installed. To install a package
in /opt/gtk
you would run configure as:
./configure --prefix=/opt/gtk
A full list of options can be found by running
configure
with the
--help
argument. In general, the defaults are
right and should be trusted. After you've run
configure
, you then run the
make command to build the package and install
it.
make make install
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 make install
. Also, if you are
installing in a system directory, on some systems (such as
Linux), you will need to run ldconfig after
make install
so that the newly installed
libraries will be found.
If you want to compile example programs shipped with the source package, run the following command.
make examples
Several environment variables are useful to pass to set before
running configure. CPPFLAGS
contains options to
pass to the C compiler, and is used to tell the compiler where
to look for include files. The LDFLAGS
variable
is used in a similar fashion for the linker. Finally the
PKG_CONFIG_PATH
environment variable contains
a search path that pkg-config (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 /opt/gtk
,
you might want to set these variables as:
CPPFLAGS="-I/opt/gtk/include" LDFLAGS="-L/opt/gtk/lib" PKG_CONFIG_PATH="/opt/gtk/lib/pkgconfig" export CPPFLAGS LDFLAGS PKG_CONFIG_PATH
You may also need to set the LD_LIBRARY_PATH
environment variable so the systems dynamic linker can find
the newly installed libraries, and the PATH
environment program so that utility binaries installed by
the various libraries will be found.
LD_LIBRARY_PATH="/opt/gtk/lib" PATH="/opt/gtk/bin:$PATH" export LD_LIBRARY_PATH PATH
Before you can compile the GtkGLExt library, 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 autoconf) are pkg-config and GNU make.
pkg-config
is a tool for tracking the compilation flags needed for
libraries that is used by the GTK+ libraries. (For each
library, a small .pc
text file is
installed in a standard location that contains the
compilation flags needed for that library along with version
number information.)
The GtkGLExt makefiles will mostly work with different versions of make, however, there tends to be a few incompatibilities, so we recommend installing GNU make if you don't already have it on your system and using it. (It may be called gmake rather than make.)
GTK+ -- The GIMP Toolkit -- version 2.0 or above.
OpenGL or Mesa.
In addition to the normal options, the configure script for the GtkGLExt supports the following additional arguments.
configure
[[--with-gl-prefix=DIR]] [[--with-gl-includedir=DIR]] [[--with-gl-libdir=DIR]] [[--enable-debug=[no|minimum|yes]]] [[--disable-gtk-doc] | [--enable-gtk-doc]] [[--with-html-dir=PATH]] [[--with-gdktarget=[x11|win32]]]
--with-gl-prefix=DIR
.
Directory where OpenGL (Mesa) is installed.
The default is 'auto'.
--with-gl-includedir=DIR
.
Directory where OpenGL (Mesa) header files are installed.
The default is 'auto'.
--with-gl-libdir=DIR
.
Directory where OpenGL (Mesa) libraries are installed.
The default is 'auto'.
--enable-debug
.
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
runtime debugging.
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
--enable-debug=no
should not
be used for stable releases of GtkGLExt.
--disable-gtk-doc
and
--enable-gtk-doc
.
The gtk-doc package is
used to generate the reference documentation included
with GtkGLExt. By default support for
gtk-doc
is disabled because it requires various extra dependencies
to be installed. If you have
gtk-doc installed and
are modifying GtkGLExt, you may want to enable
gtk-doc support by passing
in --enable-gtk-doc
. If not
enabled, pre-generated HTML files distributed with GtkGLExt
will be installed.
--with-html-dir
.
Path to installed the reference documentation. The default is
${datadir}/gtk-doc/html
.
--with-gdktarget
.
Toggles between the supported backends for GdkGLExt.
The default is x11, unless the platform is Windows, in which
case the default is win32.