September 3rd, 2010


Empathy hacking setup

Edit: Good News, Everyone! Sjoerd pointed out that the D-Bus fiddling in this post is unnecessary (as I'd hoped, but hadn't been able to manage). I mistook bgo#628738 for misconfiguration on my system.

So, this "guide" can be shortened to:

  1. create a new user (empathy-dev)

  2. install jhbuild

  3. jhbuild build empathy

  4. echo "export PATH=/opt/gnome/sbin:/opt/gnome/bin:$PATH" >> /home/empathy-dev/.bashrc

  5. echo "export XDG_DATA_DIRS=/opt/gnome/share:/usr/share:$XDG_DATA_DIRS" >> /home/empathy-dev/.bashrc

  6. slogin -X empathy-dev@localhost

  7. empathy

In order to do development on Empathy, I've created another user on my system (creatively named "empathy-dev") and run my development versions of programs, libraries, and services through this user. This has a couple major benefits:

  • zero downtime - I frequently restart Empathy during development. Running the default system version of Empathy as my regular user means I can stay online as I develop.
  • fault isolation - if I horribly break my development environment (eg, the bleeding-edge libraries I depend upon introduce major bugs), it doesn't affect my system stability

It was somewhat non-trivial to create a good setup, so I thought other people might find this handy.

Throughout this short guide, I use references to /opt/gnome, which is the standard jhbuild $PREFIX. So substitute your development $PREFIX as necessary. I make a point to not use the standard Unix development $PREFIX (/usr/local) so that my regular user doesn't run the development programs or libraries (for stability and sanity; see below).

Skip the remaining steps this guide - it's needlessly complicated

First, we need to set up a few bits and pieces so your shell and D-Bus know where to find the development programs and config. I use a fairly standard D-Bus local session config file.

The important (and only non-standard, I think) part is:


This allows the programs installed in our $PREFIX to launch necessary services (eg, Mission Control, the Telepathy Connection Managers) through D-Bus activation.

Download this file, adjust it as necessary, and put it in /home/empathy-dev/.dbus-1

Add this to the end of your development user's .bashrc:

export PATH=/opt/gnome/sbin:/opt/gnome/bin:$PATH

# let programs find any new icons, default config files, etc.
export XDG_DATA_DIRS=/opt/gnome/share:/usr/share:$XDG_DATA_DIRS

# automatically start a D-Bus session bus
alias dbus-setup="dbus-launch --config-file=$HOME/.dbus-1/session-local.conf"
if [ $? -eq 0 ]; then
echo "\nSet up D-Bus session for $USER:";
echo $session_setup
eval export $session_setup
echo "\nFAILED setting up D-Bus session for $USER";

Once you've got that set up, it's easy to launch the development version of Empathy as a different user:

slogin -X empathy-dev@localhost

Then, just run empathy and marvel at its independence from your main user's instance. However, if you haven't installed a newer version of empathy in $PREFIX/bin, this will just fall back to your system-installed version.

Fix this by setting up jhbuild and running "jhbuild build empathy". Find something to do for about 20 minutes. When you come back, if our dependencies haven't failed to build, you'll be able to run the latest version of Empathy as empathy-dev, without getting in the way of your system user.

Happy hacking!

dbus-launch will keep the dbus-daemon (and anything it activates) running by default after your development user logs out. There's a --exit-with-session option, but for some reason, if I use it here, about 30% of my keystrokes at the shell don't arrive. I'm flabbergasted, but it seemed completely tied to this dbus-launch option (I tried several times each way).