XPI Maker is a utility for building installers for Mozilla chrome packages. It provides a graphical interface for specifying files to be installed. It will build the manifest files and install scripts as needed.
XPI Maker let's you specify the files to be included in the content, skin and locale parts of a package. You can also target certain files to be used as dynamic overlays or stylesheets. XPI Maker records the paths of the source files, so it does not matter where on the disk they are located.
Note that, despite the name, it doesn't currently package the files into an archive. You can do that easily enough with a ZIP utility.
The Build command is used to construct the installer. It copies the files into a package directory and into the necessary subdirectories. It will then build the contents.rdf manifest files from the information you provide. It will also build an install.js installation script and a simple HTML file you can use to test the installer.
The information about an installation can be saved to a file so that you can use it later. The file is an RDF file that contains the list of files that make up the installation and other information about the package.
This utility is not finished yet and there are lots of features left to implement. It doesn't support many advanced features.
How to Use
After installing XPI Maker, restart Mozilla and choose XPI Maker from the Tools -> Web Development menu.
The initial dialog will prompt you to create a new package or open an existing one. You can choose one of the three types of package by selecting one of the buttons.
To create a new package, select the New Package button. This will allow you to create a content, skin and locale part of the package. To create just skin files, select the New Skin button. To create a localization, or package together a language pack, select the New Locale button. To open an existing installer file, select the Open button and select the file to open.
Once a selection has been made, a window with a number of tabs will appear. On the first screen, you enter general information about the package. The Application ID should be a short keyword that is used in chrome URLs to identify the package. Example IDs are 'editor' and 'chatzilla'.
You can also enter additional information -- the application title, a short description, the author and a version number. For skins, you can optionally specify a preview image URL, which will be displayed as the skin preview in the theme selection preferences panel.
When built, the installer files will be copied into the directory specified in the Output Directory field. Files and subdirectories will be added into the output directory during the build process. There are three check boxes at the bottom of the panel to enable certain features.
- If the check box Delete files in output directory before building is checked, the output directory will be deleted before the build. Otherwise, the files in the directory will be left in place. Warning! Checking this box will do a recursive delete of all the files in the output directory!
- If the check box Package installed files into a JAR archive is checked, the installer organizes the files in such a way that would be suitable for a JAR archive, much like the packages that come with Mozilla. If this check box is unchecked, each file would be installed separately.
- The check box Require restart after installation indicates that Mozilla should be restarted before the package can be used.
The remaining tabs allow one to add files to the content, skin and locale part of the package. The available tabs depend on the type of package being built.
To add a file, click the Add button. Then, select the file you would like to add. You can also add files by dragging them from your file system into the list. To delete a file, select a file and click the Delete button or press the Delete key.
In the Content tab, you should add XUL files and script files. The files will be added as part of the content part of the package.
You can add a dynamic overlay by selecting a file you have added and then choosing the Add Overlay button. A window will appear where you can enter the URL of a XUL file that it overlays, which will typically be a chrome URL. For example, let's say you have created a simple FTP utility and have a file 'ftpbrowseOverlay.xul' which adds a new FTP menu to the browser window. To do this:
- Add the file 'ftpbrowseOverlay.xul' by clicking the Add button and then selecting the file from the file dialog.
- Select the file in the Content tab list, and choose Add Overlay.
- Enter the URL chrome://navigator/content/navigator.xul and press OK.
In the Skin tab, you can add stylesheets and images to an installation. You must first choose which skin to apply the files to. To do this, press the Add Skin button and choose the skin from the drop down list. You can then add files to that skin in the same manner as with the content tab. You can add files to a different skin by adding another one.
You can add a dynamic stylesheet in a similar way to dynamic overlays. Select a stylesheet you have added and then select the Add Stylesheet button. Then, enter the URL of a XUL file to apply the dynamic stylesheet to.
In the Locale tab, you can add DTD and properties to the installation. Like with the skin, you must choose which language to apply the files to.
When building a skin, or locale, you will only see the Main and Package tabs. In the Package tab, you must select which package to apply the files in the skin or locale to. You can switch between multiple packages by selecting the package from the dropdown.
To save the install description, select Save or Save As from the File menu.
To build the installer, select Build from the File menu. The files will copied into the output directory. Currently, the files are not packaged into an XPI file. You can do that manually with a command such as the following:
zip -r package.xpi * -x package.html -x install.js
If you checked the box to package into a JAR archive, you can use the following lines instead:
zip -r package.jar * -x package.html -x install.js zip package.xpi package.jar install.js
Features to Implement
Because this isn't a finished product, there are a number of things left to do.
- You can't add files outside of the chrome, such as new components or plugins yet.
- You can't create subpackages such as those found in the communicator package.
- The ability to add subdirectories within the built archive.
- The ability to specify the destination directory for installed files.
- A mode where one can use the output directory as the source directory. Files won't be copied, and the user could choose commands to view and edit files.