Getting started
Things to know first:
- The xforms extension has a dependency on the schema-validation extension, so you need to build both (that's done automatically)
- Mozilla switched from CVS to Mercurial starting with Firefox 3.5. During CVS times, the Mozilla repository contained both extensions. Since the switch to Mercurial, the extensions live in separate repositories.
Before you can start building the xforms extension, you should check your Mozilla build environment by doing a regular Firefox build. Have a look at the Build Instructions for detailed information for your platform. The following table gives you an overview of which version you want to build:
Firefox version | Gecko/Toolkit version | source code notes | status |
---|---|---|---|
Firefox 2.0 | Gecko 1.8.1 | CVS, branch MOZILLA_1_8_BRANCH | not developed any more last release: 0.8.5ff2 |
Firefox 3.0 | Gecko 1.9.0 | CVS, branch HEAD | not developed any more last release: 0.8.5ff3 |
Firefox 3.5 | Gecko 1.9.1 | xforms/schema-validation code does not build with Firefox 3.5 any more | not supported |
Firefox 3.6 | Gecko 1.9.2 | xforms/schema-validation code does not build with Firefox 3.6 any more | not developed any more last release: 0.8.6 |
Firefox 4 | Gecko 2.0 | Mercurial, repositories
| mostly works upcoming 0.8.7 release |
If you have your first working Firefox build, you can go on with building the xforms extension.
Firefox 3.5 and up: get the source code
If you want to build XForms for Firefox up to 3.0, you already have the required source code, it's part of your CVS checkout. Skip to the next section.
Starting with Firefox 3.5, you need to do two more Mercurial checkouts:
cd extensions hg clone http://hg.mozilla.org/xforms hg clone http://hg.mozilla.org/schema-validation
That's it, you now have everything you need to get started.
Configure your build: the .mozconfig file
Mozilla uses a file called .mozconfig
in your home directory to store the build configuration. For xforms, you will need to add the following line:
ac_add_options --enable-extensions="default,xforms" # if you're using a Mozilla source before 2010-11-06 (e.g. an old Firefox 3.6 release) use this instead (see bug 601570 for details): ac_add_options --enable-extensions="default,xforms,schema-validation"
A complete .mozconfig
file for a release build might look like that:
. $topsrcdir/browser/config/mozconfig mk_add_options MOZ_CO_PROJECT=browser mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@ #mk_add_options AUTOCONF=autoconf2.13 # possibly needed #mk_add_options MOZ_MAKE_FLAGS=-jn # (optional) replace n with the number of parallel build processes (e.g. 2 on a dual core processor) ac_add_options --enable-extensions="default,xforms" ac_add_options --disable-debug ac_add_options --enable-optimize ac_add_options --disable-tests
For a debug build, you could use this configuration:
. $topsrcdir/browser/config/mozconfig mk_add_options MOZ_CO_PROJECT=browser mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@ ac_add_options --enable-extensions="default,xforms" ac_add_options --enable-debug ac_add_options --disable-optimize ac_add_options --disable-tests
Building
Now that you have everything ready, you can rebuild Mozilla with the same command you used before to build Firefox without xforms. Switch to the root of your source directory and start the build with
make -f client.mk build
After the build finishes, you'll have a xforms.xpi
in obj-*/dist/xpi-stage/xforms.xpi
. Congratulations, you've successfully built your first Mozilla XForms extension!
The built XPI file will only install on a nightly snapshot from the same day or your self-built Firefox version. If you are sure that older or newer Firefox versions are compatible with your extension, you can unzip the XPI file (it's a regular ZIP file), edit the install.rdf
and change the minVersion
and maxVersion
entries. The following scheme usually works (replace {GeckoVersion}
with the used Gecko/Toolkit version):
<em:minVersion>{GeckoVersion}.0</em:minVersion> <em:maxVersion>{GeckoVersion}.*</em:maxVersion>
For example, for the Firefox 3.5 version of the extension, it might look like that:
<em:minVersion>1.9.1.0</em:minVersion> <em:maxVersion>1.9.1.*</em:maxVersion>
Then zip the files again (or use an editor like vim that can edit files inside a ZIP archive).