# Part II. Building Clutter

### Emmanuele Bassi

`<ebassi`openedhand.com`>`

## Clutter Dependencies

GLib | A general-purpose utility library, not specific to graphical user interfaces. GLib provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on.
GObject | The GLib Object System provides the required implementations of a flexible, extensible and intentionally easy to map (into other languages) object-oriented framework for C.
Pango | Pango is a library for laying out and rendering text, with an emphasis on internationalization.
Backend Windowing System Library | GLX, EGL (1.1), SDL, Cocoa (OS X) and WGL (Windows)
Graphics Rendering | Open GL (1.4+) or Open GL ES (1.1 or 2.0)

## Platform-specific instructions

### Linux

If you are using Debian or Ubuntu, you can install pre-compiled binary packages the normal Debian way following the instructions at http://debian.o-hand.com/.

To build Clutter clutter from sources, get the latest source archives from http://www.clutter-project.org/sources/. Once you have extracted the sources from the archive execute the following commands in the top-level directory:

$ ./configure
$ make
# make install

You can configure the build with number of additional arguments passed to the configure script, the full list of which can be obtained by running ./configure --help. The following arguments are specific to Clutter:

--enable-debug=[no/minimum/yes]

Controls the Clutter debugging level. Possible values are: yes (all GLib asserts, checks and runtime debug messages); minimum - just GLib cast checks and runtime debug messages; no (no GLib asserts or checks and no runtime debug messages). The default is yes for development cycles, and minimum for stable releases. You should not use no, unless the only performance critical paths are the GLib type system checks.

--enable-cogl-debug=[no/minimum/yes] | Controls the COGL debugging level, similarly to --enable-debug.
--enable-maintainer-flags=[no/yes] | Use strict compiler flags; default=no.
--enable-gtk-doc | Use gtk-doc to build documentation; default=no.
--enable-manual=[no/yes] | Build application developers manual; requires jw and xmlto binaries; default=no.
--with-flavour=[glx/eglx/eglnative/sdl/win32/osx/fruity] | Select the Clutter backend; default=glx.
--with-imagebackend=[gdk-pixbuf/quartz/internal] | Select the image loading backend; default is set to gdk-pixbuf on Linux and Windows, and to quartz on OS X. The internal image loading backend should only be used when porting to a new platform or for testing purposes, and its stability or functionality are not guaranteed.
--with-gles=[1.1/2.0] | Select the version of GLES to support in COGL; default is 1.1.
--with-json=[internal/check] | Select whether to use the internal copy of JSON-GLib to parse the ClutterScript UI definition files, or to check for the system installed library; default is internal.
--enable-xinput=[no/yes] | Whether to enable XInput 1 support; default is no.
--enable-introspection=[no/auto/yes] | Whether to generate GObject Introspection data at build time; default is auto.

### Windows

The recommended way of building Clutter for Windows is using the mingw tool chain. One option is to cross-compile Clutter under Linux -- you can use the script found in the `build/mingw/` directory to simplify the process (the script takes care of setting up the necessary dependencies).

If you wish to build Clutter using mingw direcly under Windows, you can do so the normal *nix way (described above) using the mingw POSIX shell. Should you prefer to use Microsoft Visual Studio, a project file for MSVC 2005 is located in the `build/msvc_2k5/` directory. In either case, you will need to first install the required dependencies.

There are currently two backends that are supported on Windows. One uses the Win32 and WGL APIs directly and the other is built on top of SDL. You must choose one of the backends when running the configure script using the following argument:

--with-flavour=[win32/sdl] | Select the Clutter backend; default=glx.

### OSX

Currently the only way to install Clutter for developing applications, or hacking on Clutter itself, is to build it yourself. The recommended route is to install the dependencies with the MacPorts project, by simply invoking:

                $ sudo port install pango libpixman-devel cairo-devel

on a terminal, after installing and updating MacPorts. This should give you all of the required dependencies for building Clutter 1.0.

XCode should also be installed, either from the OSX installation disk or downloading it from the Apple website.

The Clutter Quartz backend is built by passing the `--with-flavour=osx` command line argument to the configure script. If not passed, the GLX backend will be built. By default, the Quartz backend depends on CoreGraphics in order to load images into textures, but it can also depend on GDK-Pixbuf or an internal, highly experimental PNG and JPEG loader.

GTK-Doc is not working on OSX, so API reference generation should also be disabled when building Clutter, by using the `--disable-docs` and `--disable-gtk-doc` command line argument to the configure script.

GTK introspection and shave support are untested on OSX so it is also recommended that you disable these with the `--disable-shave` and `--disable-introspection`.

If building on top of MacPorts, as recommended, the following configure command should suffice:

    	    ./configure --disable-gtk-doc --disable-docs --disable-shave
    	    --with-flavour=osx --disable-introspection --prefix=/opt