Building GNOME from CVS on Ubuntu using Jhbuild

General Notes

  1. This is an Unofficial and Practical Guide to Gnome Development with Ubuntu 6.10. It is not associated with Ubuntu and Canonical Ltd.
  2. This guide is tested on a full installation of the Ubuntu 6.10 x86 Install CD (Edgy Eft)
  3. If you see box, it means you have to execute the commands in Terminal mode (Applications -> System Tools -> Terminal)

  4. To reduce typos, copy and paste the commands into Terminal mode (right click on the commands -> "Copy" or "Paste")

  5. "sudo" means superuser do. "sudo" will prompt for "Password:". Specify your user password
  6. If you are tired of typing "sudo" all the time, switch to root user by issuing "sudo -s -H" followed by user password
  7. "apt-get" requires Internet connection to install / update / download programs
  8. Please add to this wiki and help others
  9. May the humanity to others spirit be always with you ... ;-)

Guide Prepared by- MarcinAntczak

Editing and wikification by- BaishampayanGhose

Added part about starting DBUS, 2006-01-20 - BrentSmith

Updated after cvs2svn switch, 2007-01-08 - LucaFerretti

Topics

Getting Started

What is Ubuntu?

Ubuntu is a free, open source operating system that starts with the breadth of Debian and adds regular releases (every six months), a clear focus on the user and usability (it should "Just Work", TM) and a commitment to security updates with 18 months of support for every release. Ubuntu ships with the latest Gnome release as well as a selection of server and desktop software that makes for a comfortable desktop experience off a single installation CD.

Where to view Ubuntu screenshots?

Where to find a list of all the programs/libraries that comes with Ubuntu?

Where to download Ubuntu?

Where to find help for Ubuntu?

How to start Gnome development?

How to prepare your system for development?

How to get and install Jhbuild?

Install needed packages for jhbuild and bootstrap

Use the following command to install software needed to build jhbuild itself, the bootstrap modules and all other modules:

sudo apt-get install automake build-essential docbook docbook-utils docbook-xsl docbook2x doxygen bison flex libpopt-dev cvs subversion git-core jade texinfo libgdbm-dev libgmp3-dev libltdl3-dev libreadline5-dev libbz2-dev libx11-dev libssl-dev libxt6

Create the installation folder and setup permissions

A full install will occupy on the order of 750 MB (gnome-2.14).

sudo mkdir -p /opt/gnome2
sudo chown `whoami`:`whoami` /opt/gnome2

Create the build folder

A complete build will require around 3.5 GB (gnome-2.14).

mkdir -p ~/svn/gnome2
cd ~/svn/gnome2

Checkout jhbuild module

svn checkout http://svn.gnome.org/svn/jhbuild/trunk jhbuild

Install jhbuild (just creates some stuff in ~/bin)

cd jhbuild
./autogen.sh
make -f Makefile.plain install

Configure jhbuild

cp sample.jhbuildrc ~/.jhbuildrc

and then you need to read comments and manually adjust variables to your preferences.

gedit ~/.jhbuildrc

An example jhbuild config file that you can refer to is

# -*- mode: python -*-

# if you have a GNOME svn account, you can uncomment this line
# and specify your username
#repos['svn.gnome.org'] = 'svn+ssh://username@svn.gnome.org/svn/'

# what module set should be used. 
# The default is the latest development version, so keep it uncommented
# unless you don't want a previous stable version.
# 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 = 'gnome-2.18'

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

# A list of the modules to skip
skip = [ 'NetworkManager' ]

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

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

# if you do not want to use system-installed libraries for your builds, comment
# out the lines below
addpath('PKG_CONFIG_PATH', os.path.join(os.sep, 'usr', 'lib', 'pkgconfig'))
addpath('PKG_CONFIG_PATH', os.path.join(os.sep, 'usr', 'share', 'pkgconfig'))

# extra arguments to pass to all autogen.sh scripts
# to speed up builds of gnome2, try '--disable-static --disable-gtk-doc'
autogenargs='--enable-maintainer-mode --disable-static --disable-gtk-doc'

# you can define diffent sets of extra argument
# this enables the gtk-doc creation, and it's used only on core GTK+ modules
autogenargs_docs='--enable-maintainer-mode --disable-static --enable-gtk-doc'

module_autogenargs['glib'] = autogenargs_docs
module_autogenargs['atk'] = autogenargs_docs
module_autogenargs['pango'] = autogenargs_docs
module_autogenargs['gtk+'] = autogenargs_docs

# those are modules that could need some custom extra arguments
# in order to build in a proper way or to build extra features
module_autogenargs['dbus'] = autogenargs  \
                             + ' --with-system-socket=/var/run/dbus/system_bus_socket' \
                             + ' --with-system-pid-file=/var/run/dbus/pid '
module_autogenargs['hal'] = autogenargs  \
                            + ' --with-socket-dir=/var/run/hal' \
                            + ' --with-pid-file=/var/run/hal/hald.pid '

module_autogenargs['evolution-data-server'] = autogenargs \
                            + ' --with-krb5=/usr' + ' --with-openldap=/usr'

module_autogenargs['evolution'] = autogenargs \
                            + ' --with-krb5=/usr' + ' --with-openldap=/usr'

module_autogenargs['vinagre'] = autogenargs \
                            + ' --enable-avahi'
module_autogenargs['vino'] = autogenargs \
                             + ' --enable-gnome-keyring=yes' \
                             + ' --enable-session-support=yes' \
                             + ' --enable-avahi'

# set CFLAGS: -g to enable debug
os.environ['CFLAGS'] = '-g -O2'

# On SMP systems you may use something like this to improve compilation time:
# be aware that not all modules compile correctly with make -j2
#os.environ['MAKEFLAGS'] = '-j2'

# a 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')

In stead of the os.environ variables, you can also add these lines in more recent versions of jhbuild

addpath('ACLOCAL_FLAGS', '/usr/share/aclocal')
addpath('PKG_CONFIG_PATH', '/usr/lib/pkgconfig', '/usr/share/pkgconfig')

Another jhbuildrc file that you can learn from is from MicroTinder: http://cvs.gnome.org/viewcvs/microtinder/jhbuildrc?view=log

Do remember to change it to suit your needs.

How to build Gnome with Jhbuild?

The bootstrap process installs about 10 different programs to make sure you have all the appropriate build tools and new enough versions of the programs. Note the bootstrap step is not necessary if you installed packages listed under "needed packages for jhbuild and bootstrap", run jhbuild saniytycheck to check this. Run jhbuild bootstrap if you want to run this step.

Once your build environment is ready, you can start building GNOME:

jhbuild build

How to build a single application using jhbuild

jhbuild buildone $APPLICATION_NAME

Keep in mind that the dependencies for $APPLICATION_NAME will not be resolved if you use buildone. If you want to build and install the dependencies of a module, use the build option instead.

How to build mozilla using jhbuild

apt-get install libxt-dev
jhbuild buildone mozilla

How to create Jhbuild Gnome session?

First, create the /etc/jhbuild.conf file. It just needs to set 'prefix' to the same value as the ~/.jhbuildrc file. Note that if you want to use simultaneous X sessions (see below), you can't use os.environ['HOME'] (it will change depending on the current user).

prefix = '/opt/gnome2'

Then create the /usr/bin/jhbuild-sesison file.

sudo gedit /usr/bin/jhbuild-session

with the following content:

exec jhbuild --file=/etc/jhbuild.conf run gnome-session

sudo chmod a+x /usr/bin/jhbuild-session

sudo gedit /usr/share/xsessions/jhbuild.desktop

[Desktop Entry]
Encoding=UTF-8
Name=Jhbuild GNOME
Comment=This session logs you into Jhbuild GNOME
Exec=/usr/bin/jhbuild-session
Icon=
Type=Application

How to log into Jhbuild Gnome?
  1. You really shouldn't log into your new Gnome with your main account. You should add new a user account and use this account for tests.
  2. Read How to add/edit/delete system users?

  3. Add new user. Let's call him 'betatester'.
  4. Close your current session and log into new session as new 'betatester' user.

How to develop Jhbuild Gnome in effective and secure way?

See "How to run multiple X sessions simultaneously" below.

  1. In order to develop Gnome in effective and secure way you should run two (or more) Xsessions simultaneously.
  2. You should run your stable Gnome on first session and your unstable Jhbuild Gnome on another. In this way you can develop with your stable Gnome and test your efforts on Jhbuild Gnome.
  3. To start another Xsession manually you need to swith to Console mode. Read How to switch to Console mode in GNOME? log in as 'betatester' user and if you log for first time or just want to ensure that you'll log into Jhbuild session then

echo 'exec jhbuild --file=/etc/jhbuild.conf run gnome-session' > .xinitrc

startx -- :1 &
  1. You also can configure GDM to run two Xsessions permanently. Read How to configure GDM to run two Xsessions simultaneously? and log as 'betatester' into jhbuild Gnome on 8-th console and on your regular account on 7-th console

  2. Now you can hack on your stable desktop with your favourite tools and test your code on unstable session. And switch between stable and unstable sessions with:

Press 'Ctrl + Alt + F7

Press 'Ctrl + Alt + F8

Users Administration

How to add/edit/delete system users?

  1. System -> Administration -> Users and Groups

  2. Users and Groups

Users Tab -> Add User.../Properties/Delete

Tips & Tricks

==== How to run the jhbuild software

(cribbed from Federico's http://primates.ximian.com/~federico/docs/jhbuild-nld/)

The following is the quickest and dirtiest way to run a single command in the current Gnome environment. It has many problems, such as requiring the the currently running gconfd, gnome-vfs-daemon, etc to be compatible with the new software. It also uses, and therefore might ruin, your gconf settings, possibly rendering your account unusable. Yes, it's easy, but be careful!

$ jhbuild shell
$ ./gnome-foo       # The program you want to run

Another way is to run the program in its own environment but have it display its windows on your desktop. This is much safer than above but is still open to subtle problems (sharing root window, etc). You will need to run "ln -sf /etc/jhbuild.conf ~/.jhbuildrc" once as the test user before running "jhbuild shell"

$ ssh -X test@localhost
Last login: Mon Jan 16 12:13:49 2006 from localhost
$ jhbuild shell
$ ./gnome-foo

You can automate the previous step using the jhrun script. Change USER to be the user you'd like to log in as, then save this script somewhare in your $PATH (~/bin/jhrun or /usr/local/bin/jhrun). Make sure to "chmod a+x jhrun". If you're annoyed at having to type your password all the time, run "sudo cat ~/.ssh/id_rsa.pub >> ~test/.ssh/authorized_keys". If you don't have an id_rsa.pub file, then run "ssh-keygen -t rsa" and hit <return> when it asks for a passphrase.

use File::Spec;
my $USER = 'test@localhost';
exec "ssh", "-X", $USER, "jhbuild", "run", File::Spec->rel2abs($ARGV[0]);

With all that set up, running a program in the test user's environment but displaying on your screen simply requires:

$ jhrun ./gnome-foo

Or, safest of all, you can run the "two simultaneous X sessions technique" as detailed below.

How to restart GNOME without rebooting computer?

Press 'Ctrl + Alt + Backspace'

sudo /etc/init.d/gdm restart

How to switch to Console mode in GNOME?

Press 'Ctrl + Alt + F1' (F2 - F6)

Press 'Ctrl + Alt + F7'

How to configure GDM to run two Xsessions simultaneously?

Dapper includes fast-user-switch-applet which allows you to log in as the test user without logging out of your existing account. Just create the JHBuild Gnome Session as detailed above, then create a new user. Use FUSA to switch to the new user, making sure to specify the JHBuild Gnome Session.

If you don't have access to FUSA, you can get GDM to always launch two X sessions.

sudo gedit /etc/gdm/gdm.conf

[servers]
# These are the standard servers.  You can add as many you want here
# and they will always be started.  Each line must start with a unique
# number and that will be the display number of that server.  Usually just
# the 0 server is used.
0=Standard

# 1=Standard

sudo /etc/init.d/gdm stop

sudo /etc/init.d/gdm start

Press 'Ctrl + Alt + F7

Press 'Ctrl + Alt + F8

How to get dbus support

Some applications require access to dbus in order to start such as epiphany and evince.

To get access to dbus, you need to modify your .xinitrc slightly to run dbus-launch.

echo 'exec jhbuild --file=/etc/jhbuild.conf run dbus-launch gnome-session' > .xinitrc

This basically starts a per-session dbus-daemon and then launches gnome-session with the DBUS_SESSION_BUS_ADDRESS environment variable set. This allows all the applications that gnome-session spawns to have access to dbus.

Note that this will not use the latest version of dbus included with jhbuild. To do that, you will need to stop the system-wide message bus (requires root privileges via sudo). Before you startx, you should perform the following commands: (Make sure you have modified your .xinitrc as shown above)

sudo /etc/init.d/dbus-1 stop
sudo /opt/gnome/bin/dbus-daemon --system
sudo /opt/gnome/sbin/hald --daemon=yes --retain-privileges
startx -- :1 &

DBus support - alternative

An alternative approach to dbus is to use the already-running system dbus. This means you don't have to use .xinitrc and can just lauch a jhbuild session from gdm using a jhbuild.desktop file. To use the system dbus:

mkdir -p $prefix/var/run
cd $prefix/var/run
ln -s /var/run/dbus dbus


JhbuildOnUbuntu (last edited 2008-05-01 17:56:10 by FredericPeters)