Linux Client Development Setup

From Mugshot Developer Wiki

Jump to: navigation, search

See also Windows Client Development Setup, Server Development Setup, Client Code Overview, C Style Guide.

To work on the Linux Client, nothing special is required; whatever normal way you edit C programs on Linux should work, automake/autoconf are used in the normal way, and the libraries involved are all commonly available.

Grab the source from Subversion and proceed...

But if you want more details read on.

Contents

Prerequisites

  • GTK+ 2.6, though we will likely require 2.8 for Cairo real soon now
  • There may be issues building with GTK+ 2.9/2.10 since we have some cut-and-paste from those; there are some preprocessor hacks to make this work but they aren't really tested
  • Loudmouth 1.0.x
  • D-BUS 0.61 (note that the one in Fedora Core 4 is too old. It's probably not that hard to #ifdef things up to work with older D-BUS but nobody has done it yet.)
  • libcurl any remotely recent version
  • GConf any remotely recent version
  • Firefox development environment (see below)

For Fedora:

 yum groupinstall 'GNOME Software Development'
 yum groupinstall 'X Software Development'
 yum install libjpeg-devel loudmouth-devel libcurl-devel firefox-devel pcre-devel

Getting a Firefox Development Environment

This describes how to get the Firefox pieces you need to build the Linux Client. See also Firefox Development Setup which discusses how to set up your firefox environment to hack on the Firefox extension. To build the Linux you need Firefox headers, idl files, and the idl compiler 'xpidl'. There are basically three paths you can take to get these things:

Use a packaged version for your distro

Your distribution may come with a firefox-devel or firefox-dev package, which will have the necessary pieces. For example, with Ubuntu, if you install the firefox-dev package, you can use the following configure options when building the client:

 --with-xpidl=/usr/lib/firefox/xpidl
 --with-gecko-headers=/usr/include/firefox
 --with-gecko-idl=/usr/share/idl/firefox

Install the prebuilt SDK

Prebuilt version of the Gecko SDK for a small number of platforms (linux-i686, OS X, Win32) can be found at, e.g., ftp://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.0.4/sdk. If one of those matches your system, you can drop it into place at /opt/gecko-sdk, or if you put it somewhere else, use the configure option:

 --with-gecko-sdk=<place where the SDK is installed>

(If it's somewhere else, you won't be able to distcheck, but that only matters if you are making a release tarball)

Compile firefox from source

The SDK is also built when you build firefox from source. (The easy way to do this if you are on a linux distribution without a firefox-devel package is probably to rebuild your distribution's package, with, e.g., rpm -bc firefox.spec.) In this case, you should use:

 --with-gecko-sdk=<built firefox sources>/dist/sdk

Build Instructions

From Subversion, I usually do something like:

   cd trunk/client/linux
   mkdir build
   cd build
   ../autogen.sh --prefix=$HOME/mugshot --config-cache <firefox source options>
   make

which should give you an executable called trunk/client/linux/build/mugshot. You can change the prefix if you like, though it doesn't matter much if you're just running the client uninstalled (which is recommended for development).

You can skip the srcdir != builddir stuff if you want to keep it simple, too.

Tips and Gotchas

  • We usually build srcdir != builddir since there's a single Makefile.am rather than recursive ones, and the srcdir gets pretty cluttered if you build there.
  • The client adds srcdir/icons to the icon theme path when running with --debug against a debug instance but not otherwise, so you might have to either hack main.c or install the icons or in some other way address this if you're missing icons.
  • The client only installs GConf schemas on "make install," right now this means no protocol handler will be installed for Firefox and Epiphany if you don't install - if you want you can manually set up a protocol handler for mugshot: that points to your build directory. Without a protocol handler, "Join Chat" links won't work.
  • Loudmouth 1.0.3 and earlier have reentrancy issues, so for example can crash on disconnect. The Fedora Extras 5 package 1.0.3-3 and above have a backported patch to fix this problem.

Running Against a Debug Instance

If you have your own server following the instructions in Server Development Setup, you can run the client and point it to your debug server with this command:

 HIPPO_DEBUG_SERVER=localinstance.mugshot.org build/mugshot --debug

Replace localinstace.mugshot.org with the address of your test server.

There's no requirement to run a debug server to test the client; you can just test it against mugshot.org, as long as you don't break the server. If you make a habit of bugs like "while (TRUE) { send us an XMPP message; }" we might get grumpy ;-)

Making a Release

DO NOT DO THIS AND PUT IT ANYWHERE PUBLIC, UNLESS YOU ARE MAKING THE OFFICIAL PACKAGES, OR YOU WILL CONFUSE EVERYONE ...

  1. Increment the version in configure.ac
  2. autoreconf as in the build instructions above
  3. "make distcheck" to get a tarball
  4. Increment the version and add changelog entry to mugshot.spec
  5. Build the RPM
  6. Commit the new configure.ac and spec file to Subversion
  7. Upload the tarball, i386.rpm, SRPM to to the server and increment the versions in base.conf
Personal tools