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 Extra Configuration Options In addition to the normal options, the configure script for the Hildon library supports a number of additional arguments. configure --disable-gtk-doc --enable-gtk-doc --enable-deprecated=[no|yes] --with-examples=[no|yes] --with-html-dir=PATH --with-maemo-gtk=[no|yes] --with-asserts=[no|yes] <systemitem>--disable-gtk-doc</systemitem> and <systemitem>--enable-gtk-doc</systemitem> The gtk-doc package is used to generate the reference documentation included with Hildon. By default, support for gtk-doc is disabled because it requires several extra dependencies to be installed. If you have gtk-doc installed and are modifying Hildon, you may want to enable gtk-doc support by passing in --enable-gtk-doc. If not enabled, pre-generated HTML files distributed with Hildon will be installed. <systemitem>--enable-deprecated</systemitem> This option allows you to specify whether deprecated widgets included in the package will be built or not. <systemitem>--with-examples</systemitem> This option allows you to specify whether examples included in the package will be built or not. <systemitem>--with-html-dir</systemitem> This option allows you to specify the directory to install the generated documentation. <systemitem>--with-maemo-gtk</systemitem> Use Maemo GTK+ API (enabled by default). <systemitem>--with-asserts</systemitem> Build with the assertion checks