Differences between revisions 8 and 9
Revision 8 as of 2010-03-31 11:50:31
Size: 4467
Editor: Éric Araujo
Comment: Fix typo
Revision 9 as of 2010-04-19 11:40:27
Size: 4329
Editor: ?BenjaminDrung
Comment: put the dh 7 rules at the top
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
mozilla-devscripts makes packaging extensions for XUL based applications easy. It provides the file /usr/share/mozilla-devscripts/xpi.mk, which can be included by debian/rules. You only have to build a .xpi file, everything else will be done by mozilla-devscripts. It will extract the xpi file, remove extra license files, install it and set the links. mozilla-devscripts makes packaging extensions for XUL based applications easy. It provides a bunch of scripts and the CDBS snippet /usr/share/mozilla-devscripts/xpi.mk, which can be included by debian/rules. You only have to build a .xpi file, everything else will be done by mozilla-devscripts. It will extract the xpi file, remove extra license files, install it and set the links.

= debian/rules =

== simplified dh 7 ==

You can use this simplified dh 7 rule if your source contains the extracted .xpi file. This requires mozilla-devscripts (>= 0.22~).

{{{#!makefile
#!/usr/bin/make -f

%:
 dh --with xul-ext --buildsystem=xul_ext $@
}}}

== extended dh 7 ==

The xul_ext build system does nothing else than the following rule file. This rule file required only mozilla-devscripts (>= 0.19~). You can use this snippet if your extension provides a build system (like ant or make) and you need to override the dh_auto_build rule.

{{{#!makefile
#!/usr/bin/make -f

%:
 dh --with xul-ext $@

override_dh_auto_build:
 # put here the commands used for building the xpi file, for example:
 xpi-pack . xul-ext-fubar.xpi

override_dh_auto_install:
 install-xpi xul-ext-fubar.xpi

override_dh_auto_clean:
 rm -f xul-ext-fubar.xpi
}}}

== multiple xpi files ==

Installing multiple xpi file is supported too.

{{{#!makefile
#!/usr/bin/make -f

%:
 dh --with xul-ext $@

override_dh_auto_build:
 # put here the commands used for building the xpi files, for example:
 make

override_dh_auto_install:
 install-xpi -p xul-ext-bla bla.xpi
 install-xpi -p xul-ext-keks keks.xpi

override_dh_auto_clean:
 rm -f *.xpi
}}}


== CDBS ==

CDBS is support by mozilla-devscripts.

=== building from source ===

You have to run one command if you build the xpi file from source. Some extensions will provide a makefile to create the xpi file and you have to run "make", some will use ant and you have to run "ant", some will provide a shell script and you have to run "sh build.sh". Your debian/rules file will look like this with CDBS:
{{{#!makefile
#!/usr/bin/make -f

MOZ_XPI_BUILD_COMMAND = sh build.sh

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/mozilla-devscripts/xpi.mk
}}}

An example for this design is [[http://git.debian.org/?p=pkg-mozext/notify-extension.git|notify-extension]].

=== using xpi file ===

You should use med-xpi-unpack to create the source file if you use the xpi file from upstream. Please do not drop the xpi file into your sources. Your debian/rules file will be very simple if you use med-xpi-unpack to create the source. mozilla-devscripts will pack the files for you. You do not have to set MOZ_XPI_BUILD_COMMAND.
{{{#!makefile
#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/mozilla-devscripts/xpi.mk
}}}
An example for this design is [[http://git.debian.org/?p=pkg-mozext/flashgot.git;a=summary|flashgot]].
Line 12: Line 98:
Build-Depends: cdbs, debhelper (>= 7), mozilla-devscripts (>= 0.16~)
Standards-Version: 3.8.3
Build-Depends: debhelper (>= 7), mozilla-devscripts (>= 0.16~)
Standards-Version: 3.8.4
Line 34: Line 120:

= debian/rules =

== building from source ==

You have to run one command if you build the xpi file from source. Some extensions will provide a makefile to create the xpi file and you have to run "make", some will use ant and you have to run "ant", some will provide a shell script and you have to run "sh build.sh". Your debian/rules file will look like:
{{{#!makefile
#!/usr/bin/make -f

MOZ_XPI_BUILD_COMMAND = sh build.sh

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/mozilla-devscripts/xpi.mk
}}}

An example for this design is [[http://git.debian.org/?p=pkg-mozext/notify-extension.git|notify-extension]].

== using xpi file ==

You should use med-xpi-unpack to create the source file if you use the xpi file from upstream. Please do not drop the xpi file into your sources. Your debian/rules file will be very simple if you use med-xpi-unpack to create the source. mozilla-devscripts will pack the files for you. You do not have to set MOZ_XPI_BUILD_COMMAND.
{{{#!makefile
#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/mozilla-devscripts/xpi.mk
}}}
An example for this design is [[http://git.debian.org/?p=pkg-mozext/flashgot.git;a=summary|flashgot]].

It is not recommended, but supported to have the xpi file in the source package. You have to set MOZ_XPI_BUILD_COMMAND to NULL. Otherwise the xpi file will be removed in the clean target.
{{{#!makefile
#!/usr/bin/make -f

MOZ_XPI_BUILD_COMMAND := $(NULL)

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/mozilla-devscripts/xpi.mk
}}}

An example for this design is [[http://git.debian.org/?p=pkg-mozext/adblock-plus.git;a=summary|adblock-plus 1.1.1-2]] (the next upstream release will use med-xpi-unpack).

== plain debhelper ==

You can use debhelper without CDBS if you do not like CDBS. mozilla-devscripts 0.19 makes it dead simple (You have to bump the build dependency to >= 0.19~):

{{{#!makefile
#!/usr/bin/make -f

%:
 dh --with xul-ext $@

override_dh_auto_build:
 # put here the commands used for building the xpi file, for example:
 xpi-pack $(CURDIR) foo.xpi

override_dh_auto_install:
 install-xpi foo.xpi
}}}

== multiple xpi files ==

The xpi.mk CDBS module supports only one xpi file. You can use plain debhelper to install multiple xpi files, but only one xpi file per binary package. This requires mozilla-devscripts 0.19 or newer. Here is an example:

{{{#!makefile
#!/usr/bin/make -f

%:
 dh --with xul-ext $@

override_dh_auto_build:
 # put here the commands used for building the xpi file, for example:
 make

override_dh_auto_install:
 install-xpi -p xul-ext-bla bla.xpi
 install-xpi -p xul-ext-keks keks.xpi
}}}

mozilla-devscripts makes packaging extensions for XUL based applications easy. It provides a bunch of scripts and the CDBS snippet /usr/share/mozilla-devscripts/xpi.mk, which can be included by debian/rules. You only have to build a .xpi file, everything else will be done by mozilla-devscripts. It will extract the xpi file, remove extra license files, install it and set the links.

debian/rules

simplified dh 7

You can use this simplified dh 7 rule if your source contains the extracted .xpi file. This requires mozilla-devscripts (>= 0.22~).

#!/usr/bin/make -f

%:
        dh --with xul-ext --buildsystem=xul_ext $@

extended dh 7

The xul_ext build system does nothing else than the following rule file. This rule file required only mozilla-devscripts (>= 0.19~). You can use this snippet if your extension provides a build system (like ant or make) and you need to override the dh_auto_build rule.

#!/usr/bin/make -f

%:
        dh --with xul-ext $@

override_dh_auto_build:
        # put here the commands used for building the xpi file, for example:
        xpi-pack . xul-ext-fubar.xpi

override_dh_auto_install:
        install-xpi xul-ext-fubar.xpi

override_dh_auto_clean:
        rm -f xul-ext-fubar.xpi

multiple xpi files

Installing multiple xpi file is supported too.

#!/usr/bin/make -f

%:
        dh --with xul-ext $@

override_dh_auto_build:
        # put here the commands used for building the xpi files, for example:
        make

override_dh_auto_install:
        install-xpi -p xul-ext-bla bla.xpi
        install-xpi -p xul-ext-keks keks.xpi

override_dh_auto_clean:
        rm -f *.xpi

CDBS

CDBS is support by mozilla-devscripts.

building from source

You have to run one command if you build the xpi file from source. Some extensions will provide a makefile to create the xpi file and you have to run "make", some will use ant and you have to run "ant", some will provide a shell script and you have to run "sh build.sh". Your debian/rules file will look like this with CDBS:

#!/usr/bin/make -f

MOZ_XPI_BUILD_COMMAND = sh build.sh

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/mozilla-devscripts/xpi.mk

An example for this design is notify-extension.

using xpi file

You should use med-xpi-unpack to create the source file if you use the xpi file from upstream. Please do not drop the xpi file into your sources. Your debian/rules file will be very simple if you use med-xpi-unpack to create the source. mozilla-devscripts will pack the files for you. You do not have to set MOZ_XPI_BUILD_COMMAND.

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/mozilla-devscripts/xpi.mk

An example for this design is flashgot.

debian/control

The debian/control file will normally look like:

Source: EXTENSIONNAME
Section: web
Priority: optional
Maintainer: Debian Mozilla Extension Maintainers <pkg-mozext-maintainers@lists.alioth.debian.org>
Uploaders: Your Fullname <your@email.tld>
Build-Depends: debhelper (>= 7), mozilla-devscripts (>= 0.16~)
Standards-Version: 3.8.4
Homepage: http://example-extension.com/
Vcs-Git: git://git.debian.org/pkg-mozext/EXTENSIONNAME.git
Vcs-Browser: http://git.debian.org/?p=pkg-mozext/EXTENSIONNAME.git;a=summary

Package: xul-ext-EXTENSIONNAME
Architecture: all
Depends: ${misc:Depends}
Recommends: ${xpi:Recommends}
Provides: ${xpi:Provides}
Enhances: ${xpi:Enhances}
Description: one line for short description
 Long descriptions can span
 multiple lines
 .
 and as above empty lines
  • We maintain the extensions in git in the pkg-mozext group.
  • EXTENSIONNAME is the name of the extension. EXTENSIONNAME should not contain mozilla, iceape, icedove, iceape, firefox, thunderbird, seamonkey in its name. Append -extension to the source package name if EXTENSIONNAME is too generic without these name (The source package name for firefoxnotify is notify-extension and the binary package name is xul-ext-notify).
  • You need at least version 0.16~ of mozilla-devscripts for all features mentioned here.