Appendix F. Working with gtkmm's Source Code

Table of Contents

If you are interested in helping out with the development of gtkmm, or fixing a bug in gtkmm, you'll probably need to build the development version of gtkmm. However, you should not install a development version over your stable version. Instead, you should install it alongside your existing gtkmm installation, in a separate path.

The easiest way to do this is using jhbuild. jhbuild is a program that makes building GNOME software much easier by calculating dependencies and building things in the correct order. This section will give a brief explanation of how to set up jhbuild to build and install gtkmm from the source repository (git). For up-to-date information on jhbuild, please refer to the jhbuild manual.

[Note] Note

Note that to build gtkmm from git, you'll often need to build many of its dependencies from git as well. jhbuild makes this easier than it would normally be, but it will take quite a while to build and install them all. You will probably encounter build problems, though these will usually be corrected quickly if you report them.

gnome-build-meta is an alternative to jhbuild. It is described at the Building system components wiki page, but here we concentrate on jhbuild.

Setting up jhbuild

To set up jhbuild, follow the basic installation instructions from the jhbuild manual. After you have installed jhbuild, you should copy the sample jhbuild configuration file into your home directory by executing the following command from the jhbuild directory:

$ cp examples/sample.jhbuildrc ~/.config/jhbuildrc

The gtkmm module is defined in the gnome-suites-core-deps-latest.modules moduleset. So edit your jhbuildrc file and set your moduleset setting like so:

moduleset = 'gnome-suites-core-deps-latest'

After setting the correct moduleset, you need to tell jhbuild which module or modules to build. To build gtkmm and all of its dependencies, set modules like so:

modules = [ 'gtkmm' ]

You can build several modules by setting the modules variable to a meta-package, e.g. meta-gnome-core, or listing more than one module name. The modules variable specifies which modules will be built when you don't explicitly specify anything on the command line. You can always build a different moduleset later by specifying it on the commandline (e.g. jhbuild build gtkmm).

[Important] Setting a prefix

By default, jhbuild's configuration is configured to install all software built with jhbuild under the ~/jhbuild/install prefix. You can choose a different prefix, but it is recommended that you keep this prefix different from other software that you've installed (don't set it to /usr!) If you've followed the jhbuild instructions then this prefix belongs to your user, so you don't need to run jhbuild as root.

You should also set buildroot in jhbuildrc. jhbuild builds gtkmm and many of its dependencies with Meson. Meson does not allow building in the source tree. jhbuild's default action is to build in a build directory directly below the source root directory. Some modules have a build directory with files used when building with Autotools. Those files can be destroyed if you let jhbuild build in that directory.

When you downloaded jhbuild from the git repository, you got a number of .modules files, specifying dependencies between modules. By default jhbuild does not use the downloaded versions of these files, but reads the latest versions in the git repository. This is usually what you want. If you don't want it, use the use_local_modulesets variable in jhbuildrc.