## Environment Setup

This section provides information on how to configure a proper environment for building Grilo, as well building and running Grilo based programs.

### Building Grilo

#### Building and installing Grilo

You can check the basics of how to build and install Grilo from the source code repositories in the Quick start guide.

#### Compilation options

This is a reference of the most useful compilation switches available:

- --enable-gtk-doc: Build documentation tutorials and API reference. Check doc/ directory for the generated documentation. Only in grilo core.
- --enable-debug: Build with debug information.
- --enable-uninstalled: Prepare for uninstalled use. Only in grilo-plugins.

For more options please run './configure --help'.

### Compiling Grilo based programs

You can check how to compile Grilo based apps by checking the Quick start guide.

### Running Grilo based programs

If you have installed the Grilo libraries in your system make sure they have been installed in a path that is included in the dynamic linker search path, otherwise export the environment variable LD_LIBRARY_PATH to include them, for example:

    $ export LD_LIBRARY_PATH=/usr/local/lib

For plugins to be visible to application they must be stored in the default plugin search path. This should be the case if you are not running Grilo in uninstalled form. If you are running Grilo uninstalled, or for some reason you have plugins available in directories other than the default plugin path, export the GRL_PLUGIN_PATH to point to the list of directories containing Grilo plugins, for example:

    $ export GRL_PLUGIN_PATH=/usr/local/lib/grilo-0.3

### Debugging with Grilo

If you want to debug Grilo itself, make sure you have built it with --enable-debug (both the framework and the plugins).

You can also control logging by setting the environment variable GRL_DEBUG. Here are some examples:

    # Disable logging for all modules
    $ export GRL_DEBUG=*:-

    # Enable full logging for all modules
    $ export GRL_DEBUG=*:*

    # Enable logging of messages of level WARNING or higher  for all modules
    $ export GRL_DEBUG=*:warning

    # Enable logging of messages of level INFO or higher for all modules
    $ export GRL_DEBUG=*:info

    # Enable full logging for the plugin registry module
    $ export GRL_DEBUG=registry:*

    # Enable full logging for the plugin registry module
    # and WARNING or higher for the Youtube plugin
    $ export GRL_DEBUG=registry:*,youtube:warning

Programs can also control logging programatically. See the GrlLog API reference for details.

Plugins can be ranked. Ranks can be used to sort plugins by rank and also in case of conflict when two plugins offer the same feature, to decide on the one to use. By default, all the plugins have the same rank (0). Higher ranks give plugins more relevance / priority.

Ranks can be controlled with the environment variable GRL_PLUGIN_RANKS. Here is one example:

    # Set the rank of the Youtube plugin to 5 and the Bookmarks plugin to -4
    $ export GRL_PLUGIN_RANKS=youtube:5,bookmarks:-4