2009-10-12

Makefile for building/distributing extensions

I've written a Makefile to help build and distribute Personas and Snowl. It automates the process of generating manifests; packaging the extension into a JAR and a XPI; and, for a "development" distribution channel, autogenerating successive version numbers and rsyncing the builds and update.rdf file to a distribution server.

The file makes it easy for me to update the latest development build of Personas after checking in a fix via:

make build channel=dev make package channel=dev make publish

For release builds, it's:

make build channel=rel make package channel=rel [manually upload to AMO]

And when I just want to test locally, I can build and install to a local profile:

make build make install profile=~/dev-profile firefox -profile ~/dev-profile

Or I can package the build and install via Firefox's Add-ons Manager:

make build make package [manually install via Firefox's Add-ons Manager]

Because I reuse it for multiple projects, project-specific variables are defined in a separate client.mk file. If you have similar needs and would find it useful, you are welcome to it!

Just grab the Makefile, see client.mk for the variables you should define, and check out the Personas source directory for the general layout that the Makefile handles as well as the install.rdf.in, chrome.manifest.in, and update.rdf.in templates from which their respective files are built.


Notes:
  1. It's originally based on Weave's top-level Makefile, although it doesn't currently support the binary components that Weave's Makefile builds.

  2. It assumes a directory structure in which content/, locale/, and skin/ directories are at the top level of the source directory (not within a chrome/ subdirectory).

  3. It currently builds in the source directory rather than in an object directory, which means it can leave old install.rdf, chrome.manifest, and chrome.jar files around, so sometimes I need to make clean && make build to get rid of the ones I previously built (f.e. for a release build whose chrome files are archived) and generate new ones for continued development.

  4. For Personas, I use a defaults/preferences/prefs.js.in template to generate prefs that contain the Mercurial revision ID (so I can identify the version of code in a development build with which someone is reporting problems) and the distribution channel (which the extension uses to suppress the "You've been updated!" page for the "dev" channel, since that would get annoying fast).

4 comments:

dafi said...

I use jakarta ANT for similar tasks but your approach is very interesting and using make is simpler then java JRE+ANT

Henning said...

Hallo!

I know it is of topic but are you still updating your addon content preferences from time to time? or is that a mostly dead project that w'ont be usable in later firefox versions.

Biest wishes
Henning

Henning said...

Hallo!

I know it is of topic but are you still updating your addon content preferences from time to time? or is that a mostly dead project that w'ont be usable in later firefox versions.

Biest wishes
Henning

Myk said...

Henning: I haven't updated that extension in a while, and I don't expect to get back to it in the near future, so it probably won't be usable in later Firefox versions unless someone else starts contributing to it.