From Fedora Project Wiki

Revision as of 12:23, 11 August 2011 by Kalev (talk | contribs)

This page is a draft only
It is still under construction and content may change. Do not rely on the information on this page.

Draft for Packaging Mozilla Extensions

This is a draft for packaging extensions for Mozilla applications: Firefox, Thunderbird, Seamonkey, and others.

Naming

Packages of Mozilla extensions should take into account the upstream name of the extension. All Mozilla extensions MUST follow the scheme of mozilla-<extension>, where <extension> is the name of the extension. Examples include mozilla-adblockplus, mozilla-noscript.

Rationale:

Installation Directories

Packages for Mozilla extensions should place unpacked files in %{_datadir}/mozilla/extensions/common/<extension>/ directory, where <extension> is the name of the package without the mozilla- prefix. Packages that contain architecture specific files should instead use %{_libdir}/mozilla/extensions/<extension>/ directory.

To register an extension for a Mozilla application, the package should drop into the application's extension directory symlinks which point to the actual files in the %{_datadir}/mozilla/extensions/common/<extension>/ directory.

For an example, to register the extension for Mozilla and Thunderbird, the package should:

# Firefox
mkdir -p $RPM_BUILD_ROOT%{_firefox_extdir}
ln -s %{_moz_ext_commondir}/{extension_name} $RPM_BUILD_ROOT%{_firefox_extdir}/{extension_id}
# Thunderbird
mkdir -p $RPM_BUILD_ROOT%{_thunderbird_extdir}
ln -s %{_moz_ext_commondir}/{extension_name} $RPM_BUILD_ROOT%{_thunderbird_extdir}/{extension_id}

Rationale:

Directory Ownership

Mozilla extension packages should Require mozilla-filesystem for common directories, but avoid depending on specific Mozilla applications. Each of the %{_<appname>_extdir} directory where the extension package drops symlinks in, should also be owned by the same extension package.

XXX: What to do with %{_mozilla_common_extdir}? Is mozilla-filesystem going to own it or should the extension packages own it?

Sample %files section:

%files
%{_mozilla_common_extdir}/%{name}/
%{_firefox_extdir}/
%{_seamonkey_extdir}/
%{_thunderbird_extdir}/

Rationale: RPM needs to keep track of the installed directories, so that it could remove them on uninstall. When installing extensions, we drop symlinks to multiple application directories and want to avoid depending on these apps just to satisfy directory ownership requirements. Because of that, Mozilla extension packages need to own all the %{_<appname>_extdir} directories they drop symlinks in, so rpm could track these directories and remove them when the extension package is uninstalled.

Macros

Macro Usage
_moz_ext_commondir Directory where extension packages should install actual files.
_chatzilla_extdir Chatzilla extension directory for dropping symlinks in
_firefox_extdir Firefox extension directory for dropping symlinks in
_seamonkey_extdir Seamonkey extension directory for dropping symlinks in
_spicebird_extdir Spicebird extension directory for dropping symlinks in
_sunbird_extdir Sunbird extension directory for dropping symlinks in
_thunderbird_extdir Thunderbird extension directory for dropping symlinks in

Sample Spec File