Menu

GettingStarted

Kevin Ollivier

Gattai works by reading and processing JSON formatted files known as 'recipes'. These recipes contain the data needed for Gattai to download, build and install all the pieces of whatever software it is that you're building. Gattai recipes are a JSON dictionary with two main sections, a 'settings' section that is used to specify any settings you'd like to apply to all packages you're building, and 'packages', which contains a list of specific packages to build along with any specific instructions that package needs.

Let's look at an example file, a Gattai recipe for building wxWebKit dependencies, which we'll proceed to break down.

 {
    'settings' : {
        'darwin' : {
            'archs': ['ppc', 'i386'],
            'min-version': '10.5',
        },
        'install_dir': '%(RECIPEDIR)s/../../WebKitLibraries/%(PLATFORM)s',
    },
    'packages' : [
    {
        'name': 'icu',
        'version': '3.4.1',
        'source_dir': 'icu',
        'build_dir': 'source',
        'prebuild_cmds': [
            "chmod +x '%(BLDDIR)s/configure' '%(BLDDIR)s/install-sh'",
        ],
        'configure_args': ['--disable-extras'],
        'win32': {
            'prebuild_cmds': [],
        },
        'source': 'ftp://ftp.software.ibm.com/software/globalization/icu/3.4.1/icu-3.4.1.tgz',
    },
    {
        'name': 'libjpeg',
        'version':'v8d',
        'source_dir': 'jpeg-8d',
        'source': 'http://www.ijg.org/files/jpegsrc.v8d.tar.gz',
    },
    {
        'name': 'libpng',
        'version': '1.5.9',
        'source': 'http://sourceforge.net/projects/libpng/files/libpng15/1.5.9/libpng-1.5.9.tar.gz/download',
    },
    {
        'name': 'curl',
        'version': '7.19.6',
        'source': 'http://curl.haxx.se/download/curl-7.19.6.tar.gz',
    },

    ],
}

In settings, we specific specific architectures and a min version of OS X to use when building on Mac. Notice that all settings specific to one platform should be placed inside a key with the platform name. We also set an installation directory. These settings are applied to all packages. Any setting you can specify in 'settings' can also be specified for a specific package, and always package-specific settings will override global settings.

In our packages section, we define the specific packages we want to build. Notice that for many packages, all we need to do is define the package's name, version, and the location of the source tar ball. So long as the package adheres to common conventions for directory names, makefile names, etc., Gattai will not need any extra information to build.

When there are exceptions, like in the cases of icu and libjpeg above, you simply need to provide Gattai with the information needed to build. For both packages, we need to tell it the source_dir, as it doesn't follow the typical <name>-<version> convention most packages use. With icu, we must also tell it the subdirectory to build, as we do not build from the source directory as we do with other packages. We can also, as shown above, pass configure arguments, specify prebuild/postinstall_cmds, and other properties.</version></name>


MongoDB Logo MongoDB