mozilla-devscripts is a collection of scripts based on Makefile inheritance
usable by Mozilla packages in Ubuntu.
- xpi provides hooks to help package extensions in an elegant way
In addition there is a xpi.mk which provides standard rules/targets to package
XPI extensions for mozilla/toolkit based applications.
=== xpi.mk ===
install-xpi - unpack and install the contents of the .xpi file to the
package named by the MOZ_EXTENSION_PKG parameter
clean-xpi - clean build cruft from install-xpi
MOZ_EXTENSION_PKG - the binary package that will ship the extension
MOZ_XPI_FILE - the XPI file to unpack and install to the binary package
named by MOZ_EXTENSION_PKG. If not set, xpi.mk will use
the first |*.xpi| file found in the packages top level
MOZ_XPI_EMID - use the given EMID to name the links in the applications
|extensions| directory. If not set, xpi.mk will try to
guess the right EMID by introspecting the |install.rdf|
shipped by the XPI
- use the given command _before_ running the normal
|install-xpi| procedure. This parameter is useful for all
those extension sources that have a command/make target
to produce a XPI. If a developer doesn't provide the
command, the default one will be used.
- link the extension to the global |extensions| directory
of the given MOZILLAs. The default value is |firefox| and
|firefox-addons|, which will link the extension to the
/usr/lib/firefox/extensions and /usr/lib/firefox-addons/extensions
If you are using cdbs (debhelper.mk) xpi.mk hooks in appropriately.
cdbs targets to build the packages without any rule. The only thing required
is to include the debhelper.mk from cdbs _before_ including xpi.mk.
A template is available in the branch available under the following URL:
=== xpi-unpack ===
This script unpacks XPI file to the provided output directory. After unpacking
the XPI file, it will look for JAR files in the output directory. All JAR files
will be unpacked to $JAR_FILE with "!" appended. For example, "test.jar" is
unpacked to "test.jar!" directory. After unpacking, the script removes all JAR
To run it, pass the name of the XPI file, and the name of the output directory:
$ xpi-unpack ubufox.xpi output
In case some of the parameters are missing, input XPI file doesn't exist, or
output directory already exists, it will report an error and exit.
=== xpi-pack ===
This script prepares a XPI file from the provided input directory. First, it
will look for all unpacked JAR files in the input directory. Directories with
the unpacked JAR files have the format explained in xpi-unpack section. The
script will pack the contents of the directory to the JAR file, named like the
JAR directory, with stripped "!" sign. For example, contents of "test.jar!" are
packed to "test.jar" file. After that, it will remove all JAR directories.
Finally, it will pack the contents of the input directory to the XPI file,
which is placed inside the provided input directory. This behaviour is because
xpi.mk will look for XPI file inside top-level extension directory, which is
the input directory in that case. The script doesn't pack debian/ and temp-*/
directories to the XPI file. After XPI file is produced, it will unpack all JAR
files, in order to leave intact source.
To run it, pass the name of the input directory, and the name of the XPI file:
$ xpi-pack . ubufox.xpi
In case some of the parameters are missing, or input directory doesn't exist,
it will report an error and exit.