Makefile for Firefox extensions

This program is a small program dedicated to people writing extensions for Firefox, Thunderbird, XULRunner and other Mozilla applications. The latest release is version 0.7, released on December 19, 2007, and which you may grab here.

This program is a Makefile which should make your life easier, by simplifying your “modify/build/test” cycle, specially if you are writing XPCOM components. It understands both JavaScript and C++ components. The program has been used under Linux and BSD and should work with MacOS X and Windows/Cygwin.

The problem

If you intend to write an extension for Firefox, Thunderbird, XULRunner, or any other Mozilla application, the first step is to create the appropriate directory structure, the appropriate installer files, a script to compress everything under the correct name, etc. Once you have all this, your development cycle is the following

  1. Modify your extension.
  2. Run your script.
  3. (Re)start Firefox (or whichever application you’re using).
  4. Uninstall the previous version of your extension.
  5. Restart Firefox.
  6. Install the new version of your extension.
  7. Restart Firefox.
  8. Test.
  9. Back to point 1.

Sure, there are also ways to do that without uninstalling and reinstalling, but they’re quite fragile.

Now, one thing can make your life much worse : having native components. If that’s the case, instead of running your script, you must trigger the recompilation of Firefox and wait until the Firefox build manager has determined that only your extension requires recompilation. Oh, and of course, this needs the full 30+Mb source code for Firefox, and you must first have spent as much time as needed to actually get Firefox itself compile in the first place — something which typically takes quite some practice for new developers.

This program

What is this program ?

This program is a Makefile to

  • compile your components (both native implementations and cross-platform idl descriptions)
  • create an installer for your extension
  • automatically update the extension without having you restart Firefox twice or click anything.

If you have the source code of Firefox and if you have already compiled it, this Makefile for extensions may take advantage of it. If you don’t, don’t worry, there are easier solutions :

  • under Linux Debian, Linux Ubuntu or MacOSX using Fink, package firefox-dev (or xulrunner-dev or thunderbird-dev) , provides everything you need
  • under Red Hat, Fedora or Mandriva, package firefox-devel (or xulrunner-devel or thunderbird-devel) does the same.

Once everything is configured, your development cycle becomes

  1. Modify your extension.
  2. Run make update.
  3. (Re)start Firefox.
  4. Test.
  5. Back to point 1.

How do I use this ?

The first time you use this Makfile,

  1. Download and install Firefox and Firefox-dev (or Thunderbird and Thunderbird-dev, etc.)
  2. Download and unpack this Makefile.
  3. Write or generate an installer file and put it in directory src/installer .
  4. Edit Makefile.options to adapt the options to your particular setup.

After that, you can concentrate on writing your extension.

  • make update will update your extension in Firefox (or Thunderbird …)
  • make installer will create an installer ready for distribution.

2 commentaires »

  1. Makefile for Firefox extensions « Il y a du thé renversé au bord de la table a dit,

    décembre 19, 2007 à 2:31

    [...] development. This script was used in OpenBerg when OpenBerg was written in C++. You may grab it here. Je viens de publier un script pour automatiser certaines des tâches liées au développement [...]

  2. moserw a dit,

    avril 24, 2008 à 2:43

    Thanks for sharing. Very useful. Much appreciated. Adding this blog to my bookmarks.

Apporter un Commentaire