Contents
History
Source
Email Feedback
Creating Mozilla Language RPMs
It would be nice if you could install languages for Mozilla using RPM and not
have to go through the XPI process. The following is a guide to doing just
that. It has not been extensively tested but may be a good start for you to do
the same.
The .spec and instructions where kindly created by Buchan Milne.
Creating the RPM
Date: Fri, 6 Feb 2004 20:41:12 +0200 (SAST)
From: Buchan Milne
To: Dwayne Bailey
Subject: Re: Mozilla localisation
On Thu, 5 Feb 2004, Dwayne Bailey wrote:
> >>I want to convert the XPI files to RPM or at least wrap
> >>them in RPM so that they are more usable on Linux.
> >>
> >>
> >
> >I could do that if necessary, shouldn't take more than a few minutes ...
> >
> >
> I'd love you to look at that if you can.
>
OK, it took a bit longer, but it won't have to be done again.
You can define the macros of interest in the rpm invocation to adjust the
behaviour. By default it will build an afza for the version of mozilla you
have installed (assuming there is only one rpm of mozilla installed on the
machine), ie when you build it like this on RHEL3 (only redhat I have
available, and my Mandrake box has Mozilla 1.6):
$ rpmbuild -ba rpm/rh/SPECS/mozilla-l10n.spec
you get:
Wrote:
/home/bgmilne/rpm/rh/SRPMS.rhEnterpriseAS3/mozilla-l10n-afza-1.4-1.src.rpm
Wrote:
/home/bgmilne/rpm/rh/RPMS.rhEnterpriseAS3/noarch/mozilla-l10n-afza-1.4-1.noarch.rpm
But, say you want to build for Mozilla-1.6 (with 1.4 still installed, or
no mozilla installed at all), for North Sotho, you can do:
$ rpmbuild --define 'lang nso' --define 'country za' \
--define 'mozver 1.6' -ba rpm/rh/SPECS/mozilla-l10n.spec
And you get:
Wrote:
/home/bgmilne/rpm/rh/SRPMS.rhEnterpriseAS3/mozilla-l10n-nsoza-1.6-1.src.rpm
Wrote:
/home/bgmilne/rpm/rh/RPMS.rhEnterpriseAS3/noarch/mozilla-l10n-nsoza-1.6-1.noarch.rpm
THe pre/post scripts seem correct (the right things seem to get done to
installed-chrome.txt), Afrikaans was offered in the
Appearance->Languages/Content, and about:mozilla showed af-za, but running
/usr/lib/mozilla-1.4/mozilla-rebuild-databases.pl removed the entries, and
I didn't see any Afrikaans.
Also, I didn't see anything about region data (I don't know if I should).
And ideas?
(I notice the country codes for other xpi's are in upper-case, these are
lower case)
> >> RedHat doesn't seem
> >>to do anything like that. I was wondering if Mandrake did.
This is a generic RPM, that should work for any rpm-based distro.
We could add a few more tweaks if people want to build distro-specific
packages (but I don't think that is worthwhile).
Shout if you're not familiar with building RPMS and would like some
packages ....
Regards,
Buchan
The .spec file
%{?!lang: %global lang af}
%{?!country: %global country za}
%{?!mozver: %global mozver %(rpm -q --qf "%{VERSION}" mozilla)}
BuildRequires: mozilla
Requires(pre): mozilla = %{mozver}
Name: mozilla-l10n-%{lang}%{country}
Version: %{mozver}
Release: 1
Summary: Mozilla localisation for locale %{lang}%{country}
Group: Applications/Internet
License: LGPL/GPL/MPL
Source: ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/l10n/lang/moz%{version}/lang%{lang}%{country}.xpi
Buildroot: %{_tmppath}/%{name}-root
Buildarch: noarch
%description
This is the Mozilla localisation file for the local %{lang}%{country}
%prep
%setup -c -D
%install
rm -Rf %{buildroot}
install -d %{buildroot}/%{_libdir}/mozilla-%{mozver}/chrome
install bin/chrome/%{lang}-unix.jar %{buildroot}/%{_libdir}/mozilla-%{mozver}/chrome
install bin/chrome/%{lang}-%{country}.jar %{buildroot}/%{_libdir}/mozilla-%{mozver}/chrome
%post
CHROMES=""
for i in autoconfig chatzilla communicator content-packs cookie editor embed forms inspector global help messenger messenger-smime messenger-mapi mozldap navigator necko pipnss pippki venkman wallet
do
cat << EOF >> %{_libdir}/mozilla-%{mozver}/chrome/installed-chrome.txt
locale,install,url,jar:resource:/chrome/%{lang}-%{country}.jar!/locale/%{lang}-%{country}/${i}/
EOF
done
for i in global-platform communicator-platform navigator-platform
do
cat << EOF >> %{_libdir}/mozilla-%{mozver}/chrome/installed-chrome.txt
locale,install,url,jar:resource:/chrome/%{lang}-unix.jar!/locale/%{lang}-%{country}/${i}/
EOF
done
%clean
# In this case, we want to clean the builddir, since unzip goes interactive
rm -Rf %{buildroot}
[ -n "$RPM_BUILD_DIR" ] && rm -Rf $RPM_BUILD_DIR/%{name}-%{version}
%preun
sed -i -e 's/^.*%{lang}-%{country}\.jar.*$//g;s/^.*%{lang}-unix\.jar.*$//g' %{_libdir}/mozilla-%{mozver}/chrome/installed-chrome.txt
%files
%{_libdir}/mozilla-%{mozver}/chrome/%{lang}-%{country}.jar
%{_libdir}/mozilla-%{mozver}/chrome/%{lang}-unix.jar
%changelog
* Fri Feb 06 2004 Buchan Milne 1
-First release