Building on Ubuntu 12.04

Ubuntu 12.04 does not have all the dependencies in its repository needed to build the development version of Geary. It takes a bit of work, but you can install all the libraries you need and build Geary. Here's one way to do it. It's certainly not the only way, and may not be the best way, but it works.

Before you start, make sure you have at least version 0.20.1 of Vala. If not, add ppa:vala-team/ppa to your repository sources, and upgrade your vala. See the main page for details.

Installing dependencies

You will need to install new versions of glib, glib-networking, libsoup, libgee, atk, gtk+, and webkitgtk. To keep from messing up other parts of your system, I recommend installing them locally in your home directory, instead of system wide. Make a directory, for example ~/geary-deps/, to hold these installations. You can choose another location, but you will have to adjust the instructions below.

glib

You will need glib >= 2.33 for other dependencies. Download the source. I chose version 2.33.14. cd to the source directory and build and install it with

./configure --prefix=$HOME/geary-deps
make
make install

Take a look in ~/geary-deps to see that files were installed.

glib-networking

From here. My guess is you probably want the same version as for glib, so I chose 2.33.14. To make sure this is built with the new version of glib, build and install with

PKG_CONFIG_PATH=$HOME/geary-deps/lib/pkgconfig/ LD_LIBRARY_PATH=$HOME/geary-deps/lib/ ./configure --prefix=$HOME/geary-deps
make
make install

libsoup

From here. You'll need at least version 2.40; I chose 2.40.3. You can probably guess what's next:

PKG_CONFIG_PATH=$HOME/geary-deps/lib/pkgconfig/ LD_LIBRARY_PATH=$HOME/geary-deps/lib/ ./configure --prefix=$HOME/geary-deps
make
make install

libgee

From here. You'll need at least version 0.8; I chose 0.8.6. The configure step is slightly different:

PKG_CONFIG_PATH=$HOME/geary-deps/lib/pkgconfig/ LD_LIBRARY_PATH=$HOME/geary-deps/lib/ ./configure --prefix=$HOME/geary-deps --enable-introspection
make
make install

This will give an error, since it doesn't respect the prefix for the introspection bindings for some reason. You can rescue it with

/usr/bin/install -c -m 644 gee/Gee-0.8.gir ~/geary-deps/share/gir-1.0
cp gee-0.8.pc ~/geary-deps/lib/pkgconfig/

atk

From here. You'll need at least verion 2.5.3; I chose 2.6.0. Once again, the standard

PKG_CONFIG_PATH=$HOME/geary-deps/lib/pkgconfig/ LD_LIBRARY_PATH=$HOME/geary-deps/lib/ ./configure --prefix=$HOME/geary-deps
make
make install

gtk+

From here. You'll need at least version 3.6.0; I chose 3.6.4. In addition to the above dependencies, you also need "atk-bridge". I couldn't figure out where the source is, but I did see that it's provided by the libatk-bridge2.0-0 package, but only from Ubuntu 12.10 onward. As it happens, these packages install on 12.04, as there isn't another version for them to conflict with. I've installed the library and the dev package without any ill effect. Once that’s installed, you can

PKG_CONFIG_PATH=$HOME/geary-deps/lib/pkgconfig/ LD_LIBRARY_PATH=$HOME/geary-deps/lib/ ./configure --prefix=$HOME/geary-deps
make
make install

webkitgtk

This is the big one. The dependencies other than what we just installed can be fetched from the repositories

sudo apt-get build-dep webkit

During the install you may get errors about missing GL header or libraries. What you install to fix those may depend on your graphics driver; I got it to work with

sudo apt-get install mesa-common-dev libgl1-mesa-dev

Download the source from the webkitgtk site, not the main WebKit site. You'll need at least version 1.10; I chose 1.10.2. Note that the 1.11 series is development. I’m not sure if the API changed for version 2.0; choose that at your own risk. Configure:

PKG_CONFIG_PATH=$HOME/geary-deps/lib/pkgconfig/ LD_LIBRARY_PATH=$HOME/geary-deps/lib/ ./configure --prefix=$HOME/geary-deps --disable-video --disable-xslt --disable-webkit2 --enable-introspection

You may be able to disable more features with options, but chances are you'll waste more time figuring out a combination that works than you'll save in compilation. I know I did.

N.B. I'm not 100% sure that this will work. I had installed the libsoup dependency another way (which turned out to be a mistake) when I installed webkit, so I didn't need to set the PATH variables. I've checked that it configures this way, but I haven't checked that it compiles properly.

make

This will take an hour or so.

make install

dconf

dconf is needed only for storing your settings between sessions. Everything will compile and install without it. You don't need a newer version of it, but you do need the dconf libraries to be in ~/geary-deps for some reason. You can just symlink in your existing libraries:

ln -s /usr/lib/x86_64-linux-gnu/libdconf* ~/geary-deps/lib/
ln -s /usr/lib/x86_64-linux-gnu/gio/modules/libdconfsettings.so ~/geary-deps/lib/gio/modules/

Those on 32-bit systems will presumably have different paths.

N.B. It may be necessary to recompile glib after linking in the dconf libraries. I don't think it should be, but in trying to figure this out, I ended up doing that.

Configuring Geary

Finally, we're ready to configure and build geary itself. We need to tweak src/CMakeLists.txt as follows:

  • Add to VALAC_OPTIONS (line 582)

--vapidir=$ENV{HOME}/geary-deps/share/vala/vapi
--girdir=$ENV{HOME}/geary-deps/share/gir-1.0
  • Change the vapigen command (line 620) to

vapigen --pkg=gio-2.0 --pkg=gtk+-3.0 --pkg=libsoup-2.4 --metadatadir=. --metadatadir=${WEBKITGTK_METADATA_DIR} --library=webkitgtk-3.0 --directory=${CMAKE_BINARY_DIR}/src ${WEBKITGTK_CUSTOM_VALA} $ENV{HOME}/geary-deps/share/gir-1.0/WebKit-3.0.gir
  • Change target_link_libraries (line 639) to

target_link_libraries(geary m ${DEPS_LIBRARIES} gthread-2.0 geary-static $ENV{HOME}/geary-deps/lib/libwebkitgtk-3.0.so $ENV{HOME}/geary-deps/lib/libsoup-2.4.so $ENV{HOME}/geary-deps/lib/libgio-2.0.so)

The attached patch includes these changes.

Now configure

PKG_CONFIG_PATH=$HOME/geary-deps/lib/pkgconfig/ LD_LIBRARY_PATH=$HOME/geary-deps/lib/ ./configure

Of course, add --prefix if you want a non-standard prefix.

make

If all goes well, you'll have a shiny new version of Geary.

Installing Themes

Your shiny new version won't look so shiny, though, because GTK will be looking for themes in ~/geary-deps/share/themes, where there aren't any. One way to fix this is to delete this directory and symlink /usr/share/themes in its place. This will likely be imperfect, since the 3.4 themes on your system may not be quite what GTK+ 3.6 is expecting. The alternative is to download the 3.6 version of whatever theme you're using and place it in this folder. If you’re using Ambiance or Radiance, this package is what you need. You can open the .deb file with file-roller and extract the folers in usr/share/themes to ~/geary-deps/share/themes.

Now everything should be shiny. If it isn't, send an email to the mailing list, and we'll do our best to help out.

Apps/Geary/BuildingOnUbuntu12.04 (last edited 2014-01-02 02:03:28 by RobertSchroll)