Introduction

The goal of this tutorial is to teach you how to package xulrunner applications for Ubuntu, using tools such as bzr, cdbs and quilt. This could be a difficult topic as each xulapp is different but we will go through the basics in order to bring the foundations on which you should be able to move forward.

We will work with fennec, the Mobile Browser from Mozilla.

Prerequisites

FIXME: we need xulruner-1.9-dev (>= 1.9+nobinonly-0ubuntu3~)and mozilla-devscripts (>= 0.09~) from ~fta PPA for this to work. See https://edge.launchpad.net/~fta/+archive/
FIXME2: some of these packages are just needed to please configure (mostly lib* and pkg-config), we should think about patching configure to make those tests not fatal when using --with-libxul-sdk)

Before you package a xulrunner application

Packaging Procedure

The structure of the tarball we need to create the package is important. Everything must be contained into a toplevel directory with a precise name. What you get from upstream will have to be tweaked if the toplevel is either missing or wrong. Here is how, using our example.

fennec is the name of the application. It is maintained by upstream within a Mercurial (hg) tree. In that tree, the branch is called mobile-browser. Move to your working directory, then clone the branch:

You now have a directory called mobile-browser. Look inside, there is a file called build.mk.

Inside this file, you see that installer is supposed to be in a directory called mobile.

Rename mobile-browser into mobile

We also need the version of this application, it's somewhere into the sources. In our example, it's in confvars.sh

We will continue with 0.3~hg in order to remember it's a snapshot (not a final release). We will also exclude VCS data from our tarball, here, it's .hg but also CVS (probably a left-over). Now, we have all we need to create the tarball:

we are done with the tarball.

For this, we need to create the structure:

The minimum set is changelog, compat, copyright, control and rules.

For debian/control, we need some hints about what the package really needs, but also what the build-system expects. For now, use this:

The last file is debian/rules. This is where the magic from cdbs and mozilla-devscripts kicks in.

See the --enable-application=mobile ? Remember I said that name will be useful later ? This is it.

From here, the package should already build. Let's try:

If it went well, you should have your debs inside ../build-area.

If it failed like this:

you have to install the necessary build-deps. Hint: apt-get build-dep xulrunner-1.9 should do the trick in one shot, otherwise, apt-get install libx11-dev x y z will sure do.

You can retry with just:

Our example builds fine but fails at the install stage. I said earlier there was a bad sign, here it is.

Let's create our first patch, using quilt:

now edit mobile/build.mk to:

1. add this just after the license block:

2. replace the install:: rules by this:

then:

should show:

if it's okay, commit the patch:

Here we can rebuild the package with:

if it's fine, it ends like this:

Do not forget to migrate your patch back to the bzr branch:

the last line should show this:

It's time to commit your first revision to your bzr branch and push it to launchpad:

Now, you have the foundations to start a project on your own. Please give it a try, and come visit us at #ubuntu-mozillateam on freenode to let us know your feedbacks about this tutorial.

Note: at this stage, the deb contains a full copy of xulrunner. This is not really needed in Ubuntu. If you want to fix this, you could borrow the patch from prism: http://bazaar.launchpad.net/~mozillateam/prism/prism/annotate/head:/debian/patches/installer_shouldnt_copy_xulrunner.patch

Enjoy.


CategoryMozillaTeam

MozillaTeam/XulApps/Packaging (last edited 2008-08-06 17:00:29 by localhost)