JHBuild
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, etc.) 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.
Contents
Installation
Install the jhbuildAUR package, which usually provides the stable version.
Alternatively, you may want to install jhbuild-gitAUR for latest JHBuild version in GNOME repository.
Configuration
JHBuild gets its configuration from a system-wide configuration file installed with the package, the defaults.jhbuildrc
, and from an optional user configuration file jhbuildrc, in ~/.config/jhbuildrc
(if it exists).
These files use Python syntax to set configuration variables.
The variables currently accepted can be found in JHBuild Manual.
Default JHBuild configuration
It can be found at /usr/lib/python2.7/site-packages/jhbuild/defaults.jhbuildrc
.
defaults.jhbuildrc
provides default values for many configuration options, e.g. moduleset, modules, autoargs, module_autoargs, and others.
It is provided with the package, so please avoid modifying it.
The values set in defaults.jhbuildrc
should be enough for JHBuild to work. Nevertheless, take a look at its value to decide what you want to use the default, and what you want to customize in a personal jhbuild configuration file.
User configuration
~/.config/jhbuildrc
is very useful for setting personal values in order to overlap what is currently set in defaults.jhbuildrc
(e.g.: want to set a different moduleset), or to set values not already set in defaults.jhbuildrc
(e.g.: your own module_autoargs for a specific module).
You may find a very extended sample of a configuration file in /usr/share/jhbuild/examples/sample.jhbuildrc
See below a few examples for ~/.config/jhbuildrc
contents:
- Enable a wide-most moduleset, and also force GTK3 for modules that would use GTK2 by default
moduleset = ['gnome-world'] autogenargs = '--with-gtk3'
- Or you may want to enable documentation build, even though it will slowdown module compilation
autogenargs = '--enable-gtk-doc'
- Or you want some debug output from make command
makeargs = 'V=1'
- Or you found out that a module needs a specific setting (this is just an example; itstool is already specified)
module_autogenargs = { 'itstool': autogenargs + ' PYTHON=/usr/bin/python2' }
Usage
This topic provides some information and examples on how to use some JHBuild commands, but without intending to exhaust the subject. For a detailed information on each of JHBuild commands, please refer to JHBuild Manual, learn from each command's help output or even read JHBuild's source code.
JHBuild provides a general --help
which lists all the commands available, and also a help message for each sub-command, e.g. jhbuild sysdeps --help
.
Checking and installing prerequisites
sysdeps can be used to get a detailed list of which dependencies you have installed and which ones you should install. In order to get this information, just run:
$ jhbuild sysdeps
Alternatively, sanitycheck may also be used to report missing tools that are required (e.g. mozjs38). If nothing is reported (and exit code is 0), then you're good to go! Similiar to the above command, just run:
$ jhbuild sanitycheck
If some tools are reported to be missing, you can — besides installing correspondent packages with pacman, if available — run bootstrap command, which will download, build and install the named module inside your jhbuild tree:
$ jhbuild bootstrap
Updating modules
It is possible to simply update the source code of the modules without building them, making it possible build another time without having to wait fetching the source code. There are three ways of simply updating modules:
update, without any arguments, will update all modules available in the moduleset/modules set in configuration file
$ jhbuild update
update, with one or more modules as arguments, will update all modules that the named modules depends on. e.g.:
$ jhbuild update gedit
updateone, with one or more modules, will update only the named module(s). e.g.:
$ jhbuild updateonly gedit
Building modules
This action will run the whole build process: it will update the source code (unless it is already up-to-date), configure & build, and install it in the proper directory.
Just like update, There are three ways of building modules in JHBuild:
build, without any arguments, will build all modules available in the moduleset/modules set in configuration file
$ jhbuild build
build, with one or more modules as arguments, will build all modules that the named modules depends on. e.g.:
$ jhbuild build gedit
buildone, with one or more modules, will build only the named module(s). e.g.:
$ jhbuild buildone gedit
Running modules
After a successfully installed application in JHBuild, use run to start the module you just built. e.g.:
$ jhbuild run gedit
Creating dependency graph
JHBuild can output graph contents which can by piped into graphviz in order to generate e.g. a PNG or PostScript file.
To generate a PNG file of e.g. gedit, run:
$ jhbuild dot gedit | dot -Tpng > dependencies.png
Troubleshooting
Python issues
A module that depends on python2 may fail to build as softwares usually expect the binary filename of python 2.x to be /usr/bin/python
and python 3.x to be /usr/bin/python3
, which is not the case in Arch Linux: python 2.x is /usr/bin/python2
and python 3.x is /usr/bin/python
.
For cases like that, force the modules to run /usr/bin/python2
using the one or more methods below:
- set module_autoargs with PYTHON=/usr/bin/python2 for this specific module in
~/.config/jhbuildrc
, as mentioned in the above Configuration section — this will run autogen.sh or configure with this value for variable PYTHON
- if the configure or Makefile doesn't parse PYTHON variable, one approach is to manually find all lines in configure/Makefile that run python binary and rename python -> python2 — this will hard code python2 in the module's source code.
- if only the above workarounds still don't work for you, consider editing module's .py files in order to replace python with python2 when the first line matches #!/usr/bin/env python or #!/usr/bin/python
Modules known to require python2 exclusively
jhbuildAUR is already patched to use python2 for modules that exclusively require this Python version, and therefore no action is required if you're using packaged JHBuild.
They are:
- itstool
- telepathy-mission-control
- WebKit
pkg-config issues
If you have a malformatted .pc file on your PKG_CONFIG_PATH, JHBuild will not be able to detect all the (valid) .pc files you have installed and will complain that the .pc files are missing. Look at the output of jhbuild sysdeps
—there should be a message about the problematic .pc files.
Packages needed to build specific modules
- gitg requires gtkspell3
- gtk-vnc requires perl-text-csv
- latexila requires lcovAUR
- pango requires libpthread-stubsAUR
- totem-pl-parser requires libgcrypt15
- xf86-video-intel requires xorg-server-devel
- xwayland requires xtrans, xcmiscproto, and bigreqsproto
- zeitgeist requires python2-rdflib
- wireless-tools requires wireless_tools
- xorg-macros requires xorg-util-macros
Building JHBuild from scratch
If you do not want to use the jhbuildAUR package, and instead you want build JHBuild from scratch on your own, there are a few things you should pay attention too.
- Make sure to install all the dependencies required by JHBuild and its target modules. Refer to list of dependencies for Arch Linux;
- JHBuild itself depends on Python version 2, so make sure to run JHBuild's autogen.sh with the following command line:
$ PYTHON=/usr/bin/python2 ./autogen.sh
- Likewise, some modules may still depend on python2. Make sure to read the above topic 'Python issues'.
- For detailed information downloading and building the source code of JHBuild, check How Do I at GNOME wiki.