jhbuild

What is it?

According to the introduction on the jhbuild website:

Jhbuild is a program that can be used to pull a number of modules from CVS and build them in the correct order. Unlike some build scripts, jhbuild lets you specify what modules you want built and it will then go and build those modules plus dependencies.

Although jhbuild was originally developed to build [WWW]Gnome, it is now able to build a number of the modules in freedesktop.org CVS. Extending it to handle new modules is usually trivial (assuming the build infrastructure matches the other modules it handles).

In additional to retrieving source code from various SCM's (CVS, SVN, arch, etc.), jhbuild has the ability to download tarballs via HTTP or FTP.

jhbuild has been adopted as an official freedesktop.org project. You can find more information on the project's homepage. Bugs can be filed in the Gnome Bugzilla.

There is also a local copy of the complete jhbuild manual.

Where to get it

It was necessary to slightly modify jhbuild for use with IPP software. Therefore; You must checkout the jhbuild module from the Pan-STARRS CVS tree. Please see the Pan-STARRS CVS Guide for help on setting up and using CVS. jhbuild will need to be able to find it's own source tree even after installation so you should choose a checkout path that can be permanent. Something along the lines of $HOME/src is recommended.

cd
mkdir -p src
cd src
cvs co jhbuild

After running CVS you should see something like this:

$ cvs co jhbuild
cvs checkout: Updating jhbuild
U jhbuild/.cvsignore
U jhbuild/COPYING
U jhbuild/ChangeLog
U jhbuild/HACKING
U jhbuild/Makefile
U jhbuild/README
U jhbuild/install-check.c
.
.

Installing jhbuild into your home directory

jhbuild should be installed locally under your home directory. This will require that you modify the PATH environment variable so that you can run jhbuild after it has been installed.

cd jhbuild
make
make install

Which should look something like this:

$ make
gcc -Wall -O2 -o install-check install-check.c
Run "make install" to install.
$ make install
Creating /home/moanui/jhoblitt/bin/jhbuild
Creating /home/moanui/jhoblitt/.gnome2/vfolders/applications/jhbuild.desktop
install -m755 install-check /home/moanui/jhoblitt/bin/install-check
install -m755 config.guess /home/moanui/jhoblitt/bin/config.guess

That will install the jhbuild executable under $HOME/bin. You are responsible for including this path in your "PATH" environment variable. It is highly recommended that you add this to your .bashrc or equivalent shell login script.

For the bash shell, place this line in your .bashrc.

export PATH=${HOME}/bin:${PATH}

For the tcsh shell, place this line in your .tschrc.

setenv PATH ${HOME}/bin:${PATH}

Configuring jhbuild

jhbuild is configured via an rc file that lives at ${HOME}/.jhbuildrc. Please note that this rc file is executed as Python code; be careful.

Example .jhbuildrc.

Here is an example rc file suitable for cut'n'paste.

# what profile to build?
moduleset = 'http://pan-starrs.ifa.hawaii.edu/project/IPP/software/modulesets/ipp12.modules'

# modules to build by default
modules = [ 'pslib', 'psmodules' ]

# where should working copies go?
jhroot = os.environ['HOME'] + '/jhroot'

# where should tarballs be kept?
tarballdir = jhroot + '/src'

# in what prefix should things be installed? (must be writable)
target = os.popen('config.guess').read().rstrip()
prefix = jhroot + '/' + target
checkoutroot = prefix + '/build'

# extra arguments to pass to the autogen.sh script?
autogenargs = '--enable-maintainer-mode --disable-static'

# use an alternative install program that preserves the
# mtime on header files if they haven't changed.  Speeds
# up rebuilds.
os.environ['INSTALL'] = os.environ['HOME'] + '/bin/install-check'

# don't try to use /usr/ucb/cc on Solaris
import sys
if sys.platform == 'sunos5':
    os.environ['CC'] = 'gcc'

Running jhbuild

Jhbuild can be executed as jhbuild build [modulename]. Just jhbuild will build the packages specified in the 'modules' variable from your rc file.

jhbuild

[or]

jhbuild build pslib

Run jhbuild list to get a list of the packages the jhbuild knows how to build.

$ jhbuild list
cfitsio
gsl
fftw
libxml2
mysql
pslib
psmodules

jhbuild supports many other commands. Please see jhbuild --help for a complete list of options.

$ jhbuild --help
usage: jhbuild [ -f config ] command [ options ... ]
Build a set of CVS modules (such as GNOME).

Global options:
  -f, --file=CONFIG            use a non default configuration file
  -m, --moduleset=URI          use a non default module set
      --no-interact            do not prompt for input

Commands:
  gui                          build targets from a gui app
  update                       update from cvs
  updateone modules            update a fixed set of modules
  build [ opts... ] [modules]  update and compile (the default)
  buildone [ opts... ] modules build a single module
  tinderbox [ opts... ]        build non-interactively with logging
  run program [ args... ]      run a command in the build environment
  shell                        start a shell in the build environment
  sanitycheck                  check that required support tools exists
  bootstrap                    build required support tools
  list [ opts ... ] [modules]  list what modules would be built
  dot [ modules ]              output a dot file of dependencies suitable
                               for processing with graphviz
  info modules...              prints information about modules

Options valid for the build, buildone, tinderbox and update commands:
  -s, --skip=MODULES           treat the given modules as up to date
  -t, --start-at=MODULE        start building at the given module
  -D date_spec                 set a sticky date when checking out modules

Options valid for the build, buildone and tinderbox commands:
  -a, --autogen                always run autogen.sh
  -c, --clean                  run make clean before make
  -n, --no-network             skip cvs update

Options valid for the tinderbox command:
  -o, --output=DIR             directory to save build logs in

Options valid for the list command:
  -r, --show-revision          show which revision will be built

Dependancies

jhbuild has a fairly minimal set of dependencies. Far less then what may be required to actually compile and install any packages. However; if your system can meet the base requirements, jhbuild should be able to bootstrap your build environment.

  • A working C compiler (eg. gcc)
  • A working libc (eg. glibc)
  • Perl 5 with the XML::Parser module (needed by libtool)
  • Python 2.?
  • Either wget or curl
  • GNU M4 1.4
  • tar
  • gzip
  • bzip2

Bootstrapping

jhbuild has a limited ability to install some of the necessary tools for maintaining software that configure it's build environment with the GNU autotools.

This step is probably required on OSX and Solaris. Your mileage will vary per Linux distribution but you can probably skip this step if your distribution is less then two years old (ie. RedHat 9 or newer).

jhbuild bootstrap

jhbuild will then will begin to build a series of packages.

Using the jhbuild enviroment

As you've already seen, jhbuild is capable of setting up an independent build environment under the [configurable] directory of your choice. In order to link non-jhbuild management software against this build environment a number of your shell's environment variable have to be modified. jhbuild is capable of doing this for you. The syntax for this is jhbuild shell, which as the syntax implies, spawns a new shell with the proper environment variables.

This example demonstrates jhbuild setting up the dynamic linkers default search path for you.

$ echo $LD_LIBRARY_PATH

$ jhbuild shell
$ echo $LD_LIBRARY_PATH
/home/moanui/jhoblitt/jhroot/i686-pc-linux-gnu/lib

A fair number of other variables are also adjusted for you. Enough so that most (all?) autoconf configured software will be able to find it's dependencies.