This document in not ready yet

Below you will find my experience about builing evolution on Ubuntu 7.04. This guide is based on Evolution/Compiling Evolution from CVS

[gibrovacco] after reading:

 http://mail.gnome.org/archives/evolution-list/2008-December/msg00092.html

I added some comments about how to get this nice guide working with ubuntu 8.10 intrepid ibex and MAPI.

Why?

I noted that a lot easy-to-fix bugs exist, which involve altering the source of Evolution. In order to do that, you will need to get that beast compiled from source of course. I assume a lot people have been scared away cause of that first task. However, if you know what and how, building it ain't really hard at all. So thats why I've setup this little guide.

So this document is for development purposes. Normal users (who aren't planning to start developing Evolution) shouldn't be reading this. Really. I'm serious about this! You will probably not understand a single thing about this documentation if you don't have a strong Linux-development background!

First!

Go to this URL, and read all of it. (Yes all of it.) This is the Evolution: Developer Information page. You can skip "Building Evolution". It explains how to build Evolution using jhbuild. The jhbuild tool is nice but a.t.m. I find the current version of that documentation rather clumsy. Once you have read the linked page entirely, return here and continue.

The Developer Information page provides good background information, but the instructions on the current page should be sufficient to get you going with a bleeding-edge build of the products. If you want to follow the instructions provided, consider reading the Developer Information page for reference only.

Okay

okay, lets go

Platforms we have tried (feel free to add comments about the same procedures for your platform to this document)

 Ubuntu 7.04
 Ubuntu 8.10

Prerequisites

(Optional) sudo make install magic

For the 'sudo make install'-magic, put the following in your /etc/sudoers file. But don't do this on a system with multiple users or where security is of any importance.

 username   ALL = NOPASSWD:/usr/bin/make

Note: It should not be necessary to run something as root, as long as you configure all things with "--disable-scrollkeeper --disable-gtk-doc"

(Optional) distcc

Recommended if you have multiple hosts. Install ccache and distcc. If you do, add -j# as a parameter to each make-command. A good value for # is the amount of CPU's that will do the job multiplied by two.

 export CC="ccache distcc"
 export DISTCC_HOSTS="host1withdistcc host2withdistcc localhost"

If you copy-paste from this wiki-page, you can use the $CPUS variable for this

 export CPUS="-j6"

Important note: You'll need to rebuild the modules from scratch (redo the configure/autogen.sh steps) you want to switch from using distcc (with optionally ccache) to using a normal C-compiler like gcc. Also note that you need the same version of compiler on each host, or follow the steps about using different compilers (checkout the webpages of distcc for more about this). You can't mix (link them) for example gcc 3.3 object files with gcc 3.2 ones or gcc 3.3 ones with gcc 4.0 ones. It will fail.

On Ubuntu

Simply run the following command(s):

 sudo apt-get install gtk-doc-tools subversion gnome-core-devel libgail-gnome-dev \
 libldap2-dev evolution libnss-dev libnspr-dev flex bison build-essential

If you are on Ubuntu gutsy, you might want to install

  libxt-dev texinfo libgdbm-dev texi2html libnss3-dev libnspr4-dev

On Ubuntu intrepid execute the following (maybe some packages aren't needed. Please remove them if you find any)

  sudo apt-get install gtk-doc-tools subversion gnome-core-devel libgail-gnome-dev libldap2-dev \
  evolution flex bison build-essential python-dev libtalloc-dev flex autoconf \
  tdb-dev bison libxt-dev texinfo libgdbm-dev texi2html libnss3-dev libnspr4-dev \
  gnome-common gtk-doc-tools libxml2-dev libgconf2-dev libsqlite3-dev libgail-gnome-dev \
  libgnomeui-dev libenchant-dev

Building

Before the actual build takes place

Prepare a build-directory

 mkdir -p ~/svn/gnome
 cd ~/svn/gnome

You should take a look at this page and get all development modules http://www.gnome.org/projects/evolution/svn.shtml

The general command is:

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

If you have a svn account on gnome (If you hack on Evolution, they will give you one sooner or later) use this

 svn checkout svn+ssh://yourlogin@svn.gnome.org/svn/MODULE_NAME/trunk MODULE_NAME

Getting the sources

 svn checkout http://svn.gnome.org/svn/evolution/trunk evolution
 svn checkout http://svn.gnome.org/svn/evolution-data-server/trunk evolution-data-server
 svn checkout http://svn.gnome.org/svn/gtkhtml/trunk gtkhtml
 svn checkout http://svn.gnome.org/svn/libsoup/trunk libsoup
 svn checkout http://svn.gnome.org/svn/evolution-exchange/trunk evolution-exchange    ''(optional)''
 svn checkout http://svn.gnome.org/svn/evolution-webcal/trunk evolution-webcal        ''(optional)''

On intrepid, if you want compatibility with the MAPI protocol (used i.e. in Exchange server 2007), you'll need a fresh version of ical, samba4, openchange and evolution-mapi. At this very moment the versions of the three first .deb packages arent't compatible with the evolution-mapi plugin.

 wget http://garr.dl.sourceforge.net/sourceforge/freeassociation/libical-0.43.tar.gz  
 tar xvfz libical-0.43.tar.gz
 svn co https://websvn.openchange.org/openchange/trunk openchange
 svn co http://svn.gnome.org/svn/evolution-mapi/trunk evolution-mapi
 wget http://www.samba.org/samba/ftp/samba4/samba-4.0.0alpha6.tar.gz
 tar xvfz samba-4.0.0alpha6.tar.gz

Doing libsoup

 pushd libsoup
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2
 make $CPUS
 make install
 popd

Doing gtkhtml

 pushd gtkhtml
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2
 make $CPUS
 make install
 popd

Optionally: Doing libical (only for intrepid-MAPI)

 pushd libical-0.43
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2
 make $CPUS
 make install
 popd
 export CFLAGS="-I/opt/gnome2/include"
 export LDFLAGS="-L/opt/gnome2/lib"

Note: during the process you could receive errors such as

 ../../libtool: line 764: X--tag=CC: command not found

This is most probably due to a difference between the version of libtoolize on your pc and the one used when packaging ical. To solve this simply execute:

 rm libtool ltmain.sh
 libtoolize -f

and restart from "Doing libical".

Doing evolution-data-server

 pushd evolution-data-server
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --with-openldap=yes --enable-gnome-keyring=yes
 --prefix=/opt/gnome2
 make $CPUS
 make install
 popd

Note: On my Feisty install I had to give the path to nspr and install flex for this build to work. Here were my steps:

 pushd evolution-data-server
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --with-openldap=yes --enable-gnome-keyring=yes
 --prefix=/opt/gnome2 --with-nspr-includes=/usr/include/firefox/nspr
 make $CPUS
 make install
 popd

Doing evolution

 pushd evolution
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2 \
 --with-openldap=yes \
 --enable-nntp=yes --enable-ipv6=yes --enable-test-component=yes \
 --enable-nss=yes --enable-smime=yes --enable-plugins=all
 make $CPUS
 make install
 popd

Note: On my Feisty install I had to add the path to the nspr and nss includes as well as include the new evolution related libs in ldconfig, here were my steps:

 vi /etc/ld.so.conf.d/evolution.conf
  /opt/gnome2/lib
  /opt/gnome2/lib/evolution/2.12
 ldconfig
 pushd evolution
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2 \
 --with-openldap=yes \
 --enable-nntp=yes --enable-ipv6=yes --enable-test-component=yes \
 --enable-nss=yes --enable-smime=yes --enable-plugins=all \
 --with-nspr-includes=/usr/include/firefox/nspr --with-nss-includes=/usr/include/firefox/nss
 make $CPUS
 make install
 popd

[mbarnes] You can also use an environment variable to tell the linker where to look for libraries:

 export LD_LIBRARY_PATH=/opt/gnome2/lib:/opt/gnome2/lib/evolution/2.12

After make install completed, you're done with the builds, but you still have to configure the bonobo activation server as described below before you can run Evolution.

Optionally: Doing evolution-exchange

 pushd evolution-exchange
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2
 make $CPUS
 make install
 popd

Optionally: Doing evolution-webcal

 pushd evolution-webcal
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2
 make $CPUS
 sudo make install
 popd

Optionally: Doing evolution-mapi

samba4

 pushd samba-4.0.0alpha6/source4
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./configure --prefix=/opt/gnome2
 make
 make install

openchange

 pushd openchange
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh
 PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./configure --prefix=/opt/gnome2 --with-samba=/opt/gnome2
 make $CPUS
 sudo make install
 popd

evolution-mapi

  pushd evolution-mapi/
  PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2
  make
  make install
  popd

Update bonobo-activation-config.xml

Search for the file bonobo-activation-config.xml. Usually it's installed at /etc/bonobo-activation/bonobo-activation-config.xml. You'll need to add the location where your evolution-data-server binary is installed.

 <?xml version="1.0"?>
 <oafconfig>
   <searchpath>
        ''< ! - - Don't remove existing items - - >''
        <item>/opt/gnome2/lib/bonobo/servers/</item>
   </searchpath>
 </oafconfig>

[mbarnes] Or you can just set an environment variable:

 export BONOBO_ACTIVATION_PATH=/opt/gnome2/lib/bonobo/servers

After this, kill the process "bonobo-activation-server".

 killall bonobo-activation-server

This process will be restarted next time Evolution is run.

Create a small wrapper-script

Copy it to, for example, /usr/local/bin/evolution-cvs or in /opt/evo/bin and put that path in your PATH environment variable.

You'll need GNU versions of tools like ps, pidof, bash or a sh that will do these scripts correctly, gdb, ddd, grep and cut. To use these scripts, it's important that you've succesfully build evolution from source. Also note that I did hardcoded some source-code filelocations in the scripts. For example $HOME/cvs/gnome/evolution/evolution-plugin.pc. If your checkout from cvs is differently located, you'll need to adjust these paths in all scripts you'll find here.

 #! /bin/sh
 prefix=`grep "^prefix=" $HOME/cvs/gnome/evolution/evolution-plugin.pc | cut -d "=" -f 2`
 version=`grep "BASE_VERSION=" $HOME/cvs/gnome/evolution/configure.in | cut -d "=" -f 2`
 
 function strstr () {
    [ ${#2} -eq 0 ] && { echo "$1" ; return 0; }
    case "$1" in
    *$2*) ;;
    *) return 1;;
    esac
    first=${1/$2*/}
    echo "${1##$first}"
 }
  
 substr=`strstr "$prefix/lib/bonobo/servers" $BONOBO_ACTIVATION_PATH`
 if test x"$substr" != x"$prefix/lib/bonobo/servers"
 then
        killall -9 bonobo-activation-server
        # in case the file bonobo-activation-config.xml is incorrect
        export BONOBO_ACTIVATION_PATH=$prefix/lib/bonobo/servers:$BONOBO_ACTIVATION_PATH
 fi
 
 substr=`strstr "$prefix/lib" $LD_LIBRARY_PATH`
 if test x"$substr" != x"$prefix/lib"
 then
         export LD_LIBRARY_PATH=$prefix/lib:/usr/lib/evolution/$version/:/usr/lib/mozilla-firefox/:$LD_LIBRARY_PATH
 fi
 substr=`strstr "$prefix/bin/:$prefix/libexec/" $PATH`
 if test x"$substr" != x"$prefixbin/:$prefix/libexec/"
 then
        export PATH=$prefix/bin/:$prefix/libexec/:$PATH
 fi
 
 $prefix/bin/evolution-$version $1 $2 $3 $4 $5

ps. You can download it here.

Upgrading

When upgrading your build I'm assuming you want to get the very latest version thats available in SVN. Beware that it will be very unlikely that it compiles and if it does it will be unstable. But then again, real developers like it unstable for then they can fix those bugs. Right? No?

The rule of thumb is that if new files are added and/or if configure.in or configure.ac is modified, you'll probably need to make distclean the module and start building it from scratch. But it highly depends. An experienced GNOME programmer knows when there's a need to recompile a module from scratch.

 cd ~/svn/gnome/

Upgrading libsoup

Upgrading libsoup is hardly ever needed

  pushd libsoup
  svn update
  make $CPUS && sudo make install || (make distclean; PKG_CONFIG_PATH=/opt/evo/lib/pkgconfig/ ./autogen.sh --prefix=/opt/evo/; make $CPUS && make install)
  popd

Upgrading gtkhtml

Upgrading gtkhtml is sometimes interesting. Not always. And updating it might make your Evolution look very unstable. Often it's a simple bug in gtkhtml.

  pushd gtkhtml
  svn update
  make $CPUS && sudo make install || (make distclean; PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2/; make $CPUS && make install)
  popd

Upgrading evolution-data-server

You want to check for upgrades on evolution-data-server each time you're going to upgrade. As time moves on, lots of the functionality is actually implemented in evolution-data-server and simply being called by evolution using ORBit-2. Most of the times it's functionality that happens in the background or non userinterface related functionality. But there are plans to put some userinterface related things in e-d-s.

The desktop-integration efforts of the last few years caused that a few applications are also using e-d-s. Examples are recent versions of gnomemeeting and the panelapplet Clock. Note that if you make your e-d-s unstable, by installing a bleeding edge SVN version, you're also making other parts of your desktop unstable. But then again, and I repeat myself, thats the way developers like it!

  pushd evolution-data-server
  svn update
  make $CPUS && make install || (make distclean; PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ ./autogen.sh --prefix=/opt/gnome2; make $CPUS && make install)
  popd

Upgrade evolution

Since you're going to upgrade, I'm guessing you want to upgrade evolution itself.

  pushd evolution
  svn update
  make $CPUS && make install || (make distclean; PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ \
  ./autogen.sh --prefix=/opt/evo/ --with-openldap=yes \
  --enable-nntp=yes --enable-ipv6=yes --enable-test-component=yes \
  --enable-nss=yes --enable-smime=yes --enable-plugins=all; make $CPUS && make install)
  popd

Optionally: Upgrade evolution-exchange

  pushd evolution-exchange
  svn update
  make $CPUS && sudo make install || (make distclean; PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ \
  ./autogen.sh --prefix=/opt/gnome2; make $CPUS && make install)
  popd

Optionally: Upgrade evolution-webcal

  pushd evolution-webcal
  svn update
  make $CPUS && make install || (make distclean; PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig/ \
  ./autogen.sh --prefix=/opt/gnome2; make $CPUS && make install)
  popd

Applying Patches

You might want to try out and test some patches from bugzilla.

[https://bugzilla.gnome.org/show_bug.cgi?id =201167 Complete implementation of category syncing]

In order to successfully apply this patch you have to configure pilot-link with --enable-libusb

Running

Normal operation

To run your own Evolution, you probably have to change your bonobo activation config (see list below) to search in your building prefix as well. So just add something like <item>/opt/gnome2/lib/bonobo/servers</item> to the <searchpath> section of your config.

[mbarnes] Or set the environment variable BONOBO_ACTIVATION_PATH. See above for an example.

Then you can run evolution out of your prefix with

  /opt/gnome2/bin/evolution

If you just changed a line of code and want to run evolution with your new changes, but don't want to wait until the make install has finished, then you can try to run Evolution from your SVN top directory

  cd ~/svn/gnome2/evolution/;
  ./shell/.libs/evolution

But note that if you change libraries code (determinable from the Makefile) it's likely that you have to make isntall in order to get the changes active.

Bonobo activation config files are for example

  On Gentoo:        /etc/bonobo-activation/bonobo-activation-config.xml 
  On Ubuntu feisty: /etc/bonobo-activation/bonobo-activation-config.xml

Debugging

In order to debug Evolution or it's components works just as expected. You can easily attach a running process with e.g. gdb.

Note, that you need to compile Evolution with a debug flag like "-g3" in order to debug it.

Debugging a running Evolution process

  gdb -p `pidof evolution`

Debugging a running evolution-data-server process

  gdb -p `pidof evolution-data-server`

Create launchers on your panel

I probably don't have to explain how to do this. Nevertheless it's a great idea to force yourself to actually sometimes do a debugging session when that fscking Evolution from cvs is crashing and being very unstable.

 ~/.gnome2/panel2.d/default/launchers $ cat moe-005712dd25.desktop
 [Desktop Entry]
 Encoding=UTF-8
 Version=1.0
 Type=Application
 Exec=gnome-terminal -x /opt/gnome2/bin/evolution
 TryExec=
 Icon=gnome-spider.png
 X-GNOME-DocPath=
 Terminal=false
 Name=Debug evolution
 GenericName=Debug evolution
 Comment=Debug evolution
 ~/.gnome2/panel2.d/default/launchers $

After starting the debugging session

gdb

If you've set the debugger-variable in the scripts to gdb, you'll have to type "cont" on the prompt in the new terminal. You can press CTRL+C at any time to interrupt the process you're debugging. Once interrupted you can set new breakpoints using "break functionname". You might want to teach yourself how to use gdb from the commandline.

ddd

A graphical userinterface for gdb is ddd. Ddd will show you the sourcecode and you can in the text-viewer set breakpoints and study whats currently in the stack in a graphically fasion.

Others

There's other debuggers that can be used. A very good example, when you're seeking memory problems and memory-leaks, is valgrind.

Note: Since the evolution-data-server is called via bonobo, it's not that easily valgrindable. If anyone knows how to profile the e-d-s it would be nice to write it here.

Making it your default E-mail client

 gconftool-2 --set --type string /desktop/gnome/url-handlers/mailto/command "/opt/gnome2/bin/evolution %s"

Apps/Evolution/Compiling_Evolution_from_SVN (last edited 2013-08-08 22:50:06 by WilliamJonMcCann)