JHBuild is a tool that allows you to automatically download and compile "modules" (i.e. source code packages). It can pull modules from a variety of sources (CVS, Subversion, Git, Bazaar, tarballs...) and handle dependencies. You can also choose which specific modules you want to build, instead of building the whole project.
JHBuild was originally written for building GNOME, but has since been extended to be usable with other projects.
JHBuild is available in the Arch User Repository. Install either AUR or AUR, the development version.
The configuration file for JHBuild is
~/.jhbuildrc. It uses Python syntax to set configuration variables. Here is the sample file provided for building GNOME:
# -*- mode: python -*- # -*- coding: utf-8 -*- # edit this file to match your settings and copy it to ~/.jhbuildrc # if you have a GNOME git account, uncomment this line # repos['git.gnome.org'] = 'ssh://firstname.lastname@example.org/git/' # what module set should be used. The default can be found in # jhbuild/defaults.jhbuildrc, but can be any file in the modulesets directory # or a URL of a module set file on a web server. # moduleset = 'gnome-apps-3.2' # # A list of the modules to build. Defaults to the GNOME core and tested apps. # modules = [ 'meta-gnome-core', 'meta-gnome-apps-tested' ] # Or to build the old GNOME 2.32: # moduleset = 'gnome2/gnome-2.32' # modules = ['meta-gnome-desktop'] # what directory should the source be checked out to? checkoutroot = os.path.expanduser('~/checkout/gnome') # the prefix to configure/install modules to (must have write access) prefix = '/opt/gnome' # custom CFLAGS / environment pieces for the build # os.environ['CFLAGS'] = '-Wall -g -O0' # extra arguments to pass to all autogen.sh scripts # to speed up builds of GNOME, try '--disable-static --disable-gtk-doc' #autogenargs= # On multiprocessor systems setting makeargs to '-j2' may improve compilation # time. Be aware that not all modules compile correctly with '-j2'. # Set makeargs to 'V=1' for verbose build output. #makeargs = '-j2'
You should edit at least modules to the desired modules to be built. A reference for most configuration variables is available at GNOME JHBuild Manual.
JHBuild can check if the required tools are installed by running sanitycheck:
$ jhbuild sanitycheck
If any errors are shown, missing packages may be installed from repositories or running the bootstrap command, which tries to download, build and install the build prerequisites:
$ jhbuild bootstrap
To build all the modules selected in the configuration file, just run the build command:
$ jhbuild build
JHBuild will download, configure, compile and install each of the modules.
If an error occurs at any stage, JHBuild will present a menu asking what to do. The choices include dropping to a shell to fix the error, rerunning the build from various stages, giving up on the module, or ignore the error and continue. Often, dropping to a shell and checking makefiles and configuration files can be helpful. If you face a build error, for example, you can try to manually
make and check errors on the shell.
Giving up on a module will cause any modules depending on it to fail.
Projects which use Python 2 may encounter errors when building, because they refer to paths like
/usr/bin/python, which points to Python 3 on Arch. Building GNOME with a default configuration may cause this error.
To fix this issue, you can point the correct Python 2 path to JHBuild by appending the following to
Packages will then be configured to use Python 2 instead of Python 3.
If you are building from scratch on your own, it may be necessary to run autogen.sh with the following:
It was also necessary for me to update the shebang line in ~/.local/bin/jhbuild
Once that is finished, run
That will tell you what dependencies you need. In my case, I had to:
pacman -S docbook-xsl pacman -S cvs
I had to switch the symlink "/usr/bin/python" to point to python2.7 to get "jhbuild build" to run correctly. If there is a better way to do this, please update this to reflect that. It was difficult for me to track down Arch Users that had built jhbuild from scratch so I figure these notes are better than none and may save some time. The folks in #gnome-shell on irc.gnome.org will help in any way they can.