GUADEC presentation preview: compiling GNOME apps with the Meson build system

If you talk with software developers, sooner or later the topic drifts to tools. The most obvious one is the editor. People really love their editors and are happy to talk about the wonderful features they have and how they increase productivity. The second tool is the compiler, which also receive a lot of praise. The compilers we have today are massively better, faster and more powerful than ones from just 10 years ago. And then there’s the build systems, which are, well…

Sort of tolerated. Maybe. Ish.

The time has come to change that. Meson is a new build system that has been designed from the ground up for one purpose: to increase programmer productivity. The basic tenet is that every second spent writing build definitions is a second wasted, because that time and energy could instead have been spent on code. Every second spent waiting for the build system to do its work is likewise wasted. To demonstrate how Meson tackles this issue, here’s the full definition for building an executable with an external dependency:

project('sampleproject', 'c')
glib = dependency('glib-2.0')
executable('prog', 'prog.c', dependencies : glib)

This is all the developer needs to write. The build system takes care of the grunt work such as debug flags, cross compilation, dependency tracking and so on.

In addition to general features, Meson also has special support for tools used in GNOME development. These include GResources, GObject introspection and the like. This simplicity does not come at the expense of power, as compile times with Meson can be an order of magnitude less than with the Leading Brand build system.

If this has piqued your interest then do come to GUADEC presentation on Sunday, or, if you can’t wait that long, learn about the project yourself at mesonbuild.com.

See you in a few weeks,
Jussi

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments are closed.

  1. Carlos says:

    Hey,

    I was thinking how to generate the gresources, gschemas, gir, translations, etc we use at GNOME? I can’t find them in the docs.
    If that is easy, looks promising =)

  2. Niklas says:

    Can Meson be used to also build Gjs projects or is it only for C/C++? Are there any samples/templates for a GNOME Gjs project?

    • JussI Pakkanen says:

      Meson does not have native support for gjs, but it does have primitive operations that you can use to define your own build targets. If there’s need, we can consider adding support for gjs (patches are also welcome, as usual).

      • Niklas says:

        Ok, I guess I figured that it would be since your presenting it at Guadec and Gjs is marketed as the preferred programming language for the GNOME platform. How much work would it be to integrate native support and where would you begin?

        • JussI Pakkanen says:

          I haven’t looked deeply into gjs but if you just want to write some js files and install them, you can declare install_data declarations for your js and desktop files without needing to do anything else. If you want to build C extensions and use them in your program, then you can use the gobject-introspection support that is already available.

          • All js files goes to gresource and then one binary (also js) loads them. so I think it would become simple. Not sure if we need to do something from current state.

          • Niklas says:

            Would be awesome if a sample could be added to the documentation or if you guys would be kind enough to throw together a script and post to a pastebin service? It would be greatly appreciated!

css.php