Tuesday, June 8, 2010

JHBuild and .jhbuildrc

I am building GNOME using JHBuild. I've set-up a .jhbuildrc as per the manual. Here is my .jhbuildrc. It shows how I use JHBuild and how I work around some problems.

I am attempting to build the next development version, GNOME 3.0.
moduleset = ['gnome-3.0']

I checkout and build the sources within the gnome2 directory.
checkoutroot = os.path.expanduser('~/gnome2')

I build using 'jhbuild tinderbox'. With the following setting, all build output will be stored within the output directory. I then browse the results in a web browser starting at ~/output/index.html. With tinderbox output, I can easily copy and paste output into bug reports.
tinderbox_outputdir = os.path.expanduser('~/output')

I set nopoison. I don't want an erroneous commit to stop my build. The dependent packages will use the last JHBuild installed version. If there is no installed version, the package will fail but that's ok.
nopoison = True

I adjust and make fixes to the moduleset files. Ask JHBuild to use local modulessets.
use_local_modulesets = True

This causes verbose output when building. This allows me to see if CFLAGS or other environment variables that may cause the build to fail.
makeargs='V=1'

Install GNOME to /opt/gnome2
prefix = '/opt/gnome2'

Turn off compiler optimisation with -O0. It makes debugging easier. Sometimes with high optimisation settings, the current executed line jumps about in unexpected ways. Also enable debug symbols with -g.
os.environ['CFLAGS'] = '-O0 -g'

After a successful build, there will be two versions of libraries on my system. The distribution provided libraries in /usr and JHBuild libraries in /opt/gnome2. Two common ways to set which libraries to use are:
  1. LD_LIBRARY_PATH. Set the environment variable LD_LIBRARY_PATH. JHBuild sets LD_LIBRARY_PATH automatically when building and for the 'jhbuild shell' and 'jhbuild run' commands.
  2. rpath. With the rpath setting, the library path at /opt/gnome2 is hardcoded into executables. As JHBuild sets LD_LIBRARY_PATH, rpath isn't necessary but I use rpath to ensure the right libraries are used regardless of the environment. Sometimes I start executables from the debugger or via gnome-session so managing LD_LIBRARY_PATH isn't always simple.
os.environ['LDFLAGS'] = '-Wl,-rpath -Wl,' + prefix + '/lib64'

I don't build the documentation to speed up the build a little bit. I enable introspection as it is becoming an important part of GNOME 3.0 and language bindings.
autogenargs='--disable-static --disable-gtk-doc --disable-documentation ' + \
            '--disable-docs --enable-introspection'

The modules I don't build. I don't build Mozilla because GNOME is moving towards WebKit. I don't build mono as it's only used by Tomboy and I like gnote much better. I don't build nss nor nspr as they are a big pain - bug596385, bug618499, bug619000 etc. I use the distribution versions - package nspr-devel and nss-devel on Fedora. I don't build UPower, hal, polkit, PolicyKit, DeviceKit because they are system-level components. JHBuild versions won't work according to bug581515.
skip = ['mozilla', 'mono', 'gtk-sharp', 'gnome-sharp', 'gnome-desktop-sharp'
       'samba4', 'libmapi', 'evolution-mapi', 'ndesk-dbus',
       'ndesk-dbus-glib',
       'mono-addins', 'tomboy', 'sabayon', 'gnome-desktop-sharp', 'ptlib', 
       'opal', 'ekiga', 'evolution-exchange', 
       'gdm', 'libgnomecups', 'nspr', 'nss',
       'gtk-vnc', 'vinagre',
       'speex', 'libsndfile', 'pulseaudio',
       'UPower', 'libvolume_id', 'hal', 'polkit', 'PolicyKit',
       'DeviceKit-power']

My module autogen arguments. Important ones are gtk+ with --with-xinput=yes. Some modules will not compile if gtk+ is built without xinput. The LDFLAGS=-ldl should no longer be necessary due to the fixed bug620741. OpenGL modules need args for /usr/include/nvidia and /usr/lib64/nvidia for my Nvidia based Fedora system.
module_autogenargs['clutter'] = 'CPPFLAGS=-I/usr/include/nvidia ' + \
 'LDFLAGS=-L/usr/lib64/nvidia ' + autogenargs
module_autogenargs['clutter-gtk'] = 'CPPFLAGS=-I/usr/include/nvidia ' + \
 'LDFLAGS=-L/usr/lib64/nvidia ' + autogenargs
module_autogenargs['dbus'] = autogenargs + \
 ' --with-dbus-user=dbus --enable-verbose-mode'
module_autogenargs['ekiga'] = autogenargs + ' --disable-ldap'
module_autogenargs['empathy'] = 'CPPFLAGS=-I/usr/include/nvidia ' + \
 'LDFLAGS=-L/usr/lib64/nvidia ' + autogenargs
module_autogenargs['evolution'] = autogenargs + \
 ' --disable-nm --disable-exchange --disable-pst-import'
module_autogenargs['gnome-games'] = 'CPPFLAGS=-I/usr/include/nvidia ' + \
 'LDFLAGS=-L/usr/lib64/nvidia ' + autogenargs + \
 ' --disable-tests ' + \
        ' --enable-omitgames=aisleriot'
module_autogenargs['gtk+'] = autogenargs + ' --with-xinput=yes'
module_autogenargs['libcanberra'] = autogenargs + ' --disable-oss'
module_autogenargs['libchamplain'] = 'CPPFLAGS=-I/usr/include/nvidia ' + \
 'LDFLAGS=-L/usr/lib64/nvidia ' + autogenargs
module_autogenargs['libsndfile'] = 'LDFLAGS=-ldl ' + autogenargs
module_autogenargs['NetworkManager'] = autogenargs + \
 ' --with-dbus-sys-dir=' + prefix + '/etc/dbus-1/system.d' + \
 ' --with-udev-dir=' + prefix + '/lib/udev'
module_autogenargs['PackageKit'] = autogenargs + ' --enable-yum'
module_autogenargs['ptlib'] = autogenargs + ' --enable-samples'
module_autogenargs['sqlite3'] = 'LDFLAGS=-ldl ' + autogenargs
module_autogenargs['tracker'] = autogenargs + \
 ' --enable-evolution-miner=no '

Suggestions or improvements welcome.

2 comments:

  1. Very useful, thanks. Is it still the case though? You mind posting an update?

    ReplyDelete
  2. why moduleset = ['gnome-3.0'] and prefix = '/opt/gnome2'?

    ReplyDelete