Compiling the Hildon libraries
3
Hildon Library
Compiling the Hildon Libraries
How to compile Hildon itself
Building Hildon on UNIX-like systems
This chapter covers building and installing Hildon on UNIX and
UNIX-like systems such as GNU/Linux.
On UNIX-like systems Hildon 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.
The first thing to do before start building Hildon widgets is to
uncompress the source tarball packages. For example:
$ tar xvzf hildon-widgets-2.2.0.tar.gz
$ tar xvjf hildon-widgets-2.2.0.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/hildon you would run configure as:
$ ./configure --prefix=/opt/hildon
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 and make install commands
to build the package and install it, respectively.
$ 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 you will need
to run ldconfig after make
install so that the newly installed libraries will be
found.
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 Hildon
and its dependencies into /opt/hildon, you
might want to set these variables as:
$ CPPFLAGS="-I/opt/hildon/include"
$ LDFLAGS="-L/opt/hildon/lib"
$ PKG_CONFIG_PATH="/opt/hildon/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/hildon/lib"
$ PATH="/opt/hildon/bin:$PATH"
$ export LD_LIBRARY_PATH PATH
Dependencies
Before you can compile the Hildon widget toolkit, you need to have
various other tools and libraries installed on your
system. The two tools needed during the build process (apart from
the tools 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 are used by the Hildon 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 Hildon makefiles will mostly work with different versions
of make, however, there tends to be
a few incompatibilities, so the Hildon team recommends
installing GNU
make if you don't already have it on your system
and using it.
GTK+
Canberra