summaryrefslogtreecommitdiff
path: root/README
blob: b9250f886ea0f39a98c4814f374f9216e7f95e34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 ===

targets:
---------
 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

parameters:
------------
 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
                     directory
 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
 MOZ_XPI_BUILD_COMMAND
                   - 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.
 MOZ_XPI_MOZILLA_DIRS
                   - 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
                     directories, respectively.

cdbs:
------
 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.

examples:
----------
 A template is available in the branch available under the following URL:
   https://code.launchpad.net/~mozillateam/firefox-extensions/XPI.TEMPLATE

=== 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
files.
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.