MaemoWithJhbuild

  1. Building Maemo with Jhbuild
    1. Introduction
    2. Setup
      1. Install jhbuild
      2. Configure jhbuild
    3. Starting a Jhbuild Build
      1. Avoiding the ssh passphrase prompt
    4. Starting a Jhbuild shell

Building Maemo with Jhbuild

Introduction

Jhbuild builds multiple source modules, automatically building them in the correct order because it knows about the dependencies of each module. It does not require any changes to the source modules themselves. It can check the software out from cvs, svn, or tarballs. Jhbuild installs the software in a separate prefix, so there is no risk of damaging the software installed in /usr by your package management system.

When everything works perfectly, you just need to do

jhbuild build

to build the whole set of software.

In addition, jhbuild makes it very easy to use the software in that separate prefix. Just do

jhbuild shell

to change your terminal environment. It will have all the necessary (and often obscure) environment variables that you need to build or run the software.

The first version of this page was written by Murray Cumming. Please feel free to make corrections, if you have tested them.

Setup

To use jhbuild, you must

Install jhbuild

[sbox-SDK_PC: ~] > mkdir -p ~/checkouts/maemo
[sbox-SDK_PC: ~] > cd ~/checkouts/maemo
[sbox-SDK_PC: ~/checkouts/maemo] > svn checkout http://svn.gnome.org/svn/jhbuild/trunk jhbuild
...
[sbox-SDK_PC: ~/checkouts/maemo] > cd jhbuild
[sbox-SDK_PC: ~/checkouts/maemo/jhbuild] > make -f Makefile.plain CFLAGS='-O2 -DWITH_INSTALL=\""/scratchbox/tools/bin/install"\"' install
...

Use your GNOME svn login instead, if you have one.

Configure jhbuild

You need a .jhbuildrc file in your home directory to tell jhbuild what to build, where to check it out, and where to install it. For Maemo, you might create the file with the following contents. Don't forget the . at the start of .jhbuildrc:

# -*- mode: python -*-

# edit this file to match your settings and copy it to ~/.jhbuildrc

# if you have a GNOME svn account, uncomment this line
#repos['svn.gnome.org'] = 'svn+ssh://user@svn.gnome.org/svn/'
#repos['svn.gnomemm'] = 'svn+ssh://user@svn.gnome.org/svn/gnomemm/'

# what module set should be used.  The default at the moment is 'gnome26',
# but it can be any of the files in the modulesets directory, or even
# the URL of a module set file on a web server.
moduleset = 'https://stage.maemo.org/svn/maemo/projects/haf/jhbuild_modules/maemo.modules'

# A list of the modules to build.  Defaults to the Gnome Desktop and
# developer platform.
modules = [ 'meta-maemo' ]

# what directory should the source be checked out to?
checkoutroot = os.path.expanduser('~/checkouts/maemo')

# the prefix to configure/install modules to (must have write access)
prefix = '/usr/local'

# extra arguments to pass to all autogen.sh scripts
autogenargs = '--disable-static --disable-gtk-doc'

# set CFLAGS:
#cflags = '-g -O2'

# An alternative install program to use.
# The included install-check program won't update timestamps if the
# header hasn't changed
os.environ['INSTALL'] = os.path.expanduser('~/bin/install-check')

module_autogenargs['glibmm'] = '--disable-static --disable-fulldocs --enable-warnings=maximum'
module_autogenargs['gtkmm'] = '--disable-static --disable-fulldocs --enable-warnings=hardcore'

# Use existing packages even inside jhbuild:
# Note that add_path knows that ACLOCAL_FLAGS needs -I, and that it doesn't need : separators:
addpath('PKG_CONFIG_PATH', '/usr/local/lib/pkgconfig')
addpath('PKG_CONFIG_PATH', '/usr/lib/pkgconfig')
addpath('ACLOCAL_FLAGS', '/usr/local/share/aclocal')
addpath('ACLOCAL_FLAGS', '/usr/share/aclocal')
addpath('ACLOCAL_FLAGS', '/scratchbox/tools/share/aclocal')

# This should be the default already, when XML_CATALOG_FILES is not exported, but somehow 
addpath('XML_CATALOG_FILES', '/etc/xml/catalog')

You might want to comment-out that "os.environ['INSTALL']" line if you see this error, although it should work just fine if you defined WITH_INSTALL when building jhbuild as shown above:

scratchbox [install-binSCRIPTS] Error 255

To make jhbuild available in your path, and to set some other useful environment variables, you might you create an env_jhbuild_maemo file in your home directory with the following contents:

#Make jhbuild available:
export PATH=$HOME/bin:$PATH

# You might have these in your bash profile already:

# Make applications start in the xephyr window:
export DISPLAY=:2

export LANG=en_US

Starting a Jhbuild Build

The first time you do a jhbuild, you need to run the boostrap, to install various versions of the build utilities such as autoconf and automake. Assuming that you have just logged into Scratchbox:

[sbox-SDK_PC: ~] > . env_jhbuild_maemo
[sbox-SDK_PC: ~] > jhbuild bootstrap

After the bootstrap has run, you can do a build. If something goes wrong then it will offer you some choices, such as starting a shell so you can fix the problem.

Assuming that you have just logged into Scratchbox:

[sbox-SDK_PC: ~] > . env_jhbuild_maemo
[sbox-SDK_PC: ~] > jhbuild build

jhbuild will then checkout the source code, build it, and install it in your prefix. If something goes wrong then it will offer you some choices, such as starting a shell so you can fix the problem.

Notice that jhbuild gets the moduleset from a http location. If it doesn't seem to be using the latest version, you might need to delete its cache, like so:

[sbox-SDK_PC: ~] > rm -fr ~/.jhbuild/cache

If you using more than one scratchbox target, you might need multiple build prefixes and therefore multiple .jhbuildrc files. You can do this by, for instance, having a .jhbuildrc_maemo file and always specifying it to jhbuild commands, like so:

[sbox-SDK_PC: ~] > . env_jhbuild_maemo
[sbox-SDK_PC: ~] > jhbuild --file=~/.jhbuildrc_maemo build

Here are some suggested solutions for Problems that you might encounter.

If you know what you are doing, and if you have access, you might need to correct the maemo.modules file in svn. For instance, you might need to add a new dependency to a library.

Avoiding the ssh passphrase prompt

If you are using your own cvs login, you might want to avoid the repeated ssh passphrase prompt, so that jhbuild can build many modules without your attention. In a regular session, you would use ssh-add, but you need to do some extra magic when logging in to scratchbox to make this work. For instance:

murrayc@ubuntumurrayc:~$ /scratchbox/login env SSH_AUTH_SOCK=$SSH_AUTH_SOCK bash -l
[sbox-SDK_maemo_686: ~] > ssh-add
Enter passphrase for /home/murrayc/.ssh/id_rsa:
Identity added: /home/murrayc/.ssh/id_rsa (/home/murrayc/.ssh/id_rsa)

Starting a Jhbuild shell

To use the software or, for instance, to run autogen or make manually, do this to get an appropriate environment:

[sbox-SDK_PC: ~] > jhbuild shell