|
|
我在国外网看到这样一编文章,文字易懂,非常容易实现(除了对内存要求高一点之外)。本想翻译,但英语太烂恐误人子弟,所以贴下来:
http://www.fedoraforum.org/forum ... mp;page=1&pp=15
Instructions for building firefox-1.0.6 from source for FC4.
Overview:
=========
A. Make sure all the prerequisites are there
B. Compile the source into a binary tarball
1. obtain source
2. apply patches
3. compile (make -f client.mk build)
4. create binary tarball (make -C obj-i686-pc-linux-gnu/browser/installer)
C. Turn the binary tarball into an rpm
1. create environment to build rpms as regular user
2. Assemble all the necessary files
3. Build the rpm
Details:
========
A. Make sure that the prerequisites are present. (Numbers in parentheses are what I had on my FC4 box)
-512 MB RAM
-3 GB free disk space (This is real! It ate up a huge amount of space)
-glibc (2.3.5-10)
-gcc and g++ at least 3.2 or higher (4.0.1-4.fc4)
-perl 5.6 or higher (5.8.6-15)
-GNU make 3.79.1 (I had 3.80-7, and it worked fine)
-CVS 1.11 or higher (1.11.19-8; didn't use it; just downloaded source tarball)
-gtk2 (gtk2-2.6.7-4)
-libIDL 0.6.3 - 0.6.8 (0.8.5-2)
mozilla.org says that libIDL 0.8.x will NOT work
but it also says that the package ORBit contains libIDL with older version
so did: yum install ORBit ORBit-devel
which installed version 0.5.17-15 of each, which worked fine
-zip 2.3 or higher (2.3-30)
-freetype 2.1.0 or higher (2.1.9-2)
-fontconfig (2.2.3-13)
-pkgconfig 0.9.0 or higher (0.15.0-6)
B. Compile the souce into a binary tarball
1. Obtain the source tarball firefox-1.0.6-source.tar.bz2
from http://www.mozilla.org/download-mozilla.html
and unpack it where you have at least 3 GB of disk space.
2. cd into the top level folder, place the attached patch file
firefox-mozconfig-oiddatah.patch (attached below, remove the .txt ending)
just outside the top level folder, and apply the patch by typing:
patch -p1 < ../firefox-mozconfig-oiddatah.patch
This patch
a) adds the configuration file .mozconfig to the folder. If you look
at the created .mozconfig, you'll see that it just copies the settings
found in the standard Fedora build of firefox, by typing about:buildconfig
in the browser window.
b) fixes a declaration in oiddata.h (changes something declared as []
to a pointer. When declared as [], it produced a fatal compilation
error).
3. In the top level folder, issue the command: make -f client.mk build
The compilation took about 2 hours on my 1.6 GHz machine.
4. After the compilation is done, issue this command from the top level folder:
make -C obj-i686-pc-linux-gnu/browser/installer
Now, look inside the subdirectory: mozilla/obj-i686-pc-linux-gnu/dist
and you will have the binary tarball:
firefox-1.0.6.en-US.linux-i686.tar.gz
This binary tarball is what will be used to make the rpm. Move it someplace
safe, and then delete the (now enormous) compilation directory.
NOTES:
Compared to the official binary tarball available from
http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
our homemade binary tarball is missing the following files:
I: A set of files that will be generated the first time firefox is invoked
by root. They will not be generated when invoked by a regular user, because
the regular user does not have write-access to /usr/lib. The browser will
still function normally without these files:
+/usr/lib/firefox-1.0.6/chrome/overlayinfo/*
+/usr/lib/firefox-1.0.6/components.ini
+/usr/lib/firefox-1.0.6/components/compreg.dat
+/usr/lib/firefox-1.0.6/components/xpti.dat
II: A set of files involved in "talkback" -- feeding back errors back
to mozilla.org. This is not available for home builds. The browser
will otherwise function normally without these files:
+/usr/lib/firefox-1.0.6/components/libqfaservices.so
+/usr/lib/firefox-1.0.6/components/qfaservices.xpt
+/usr/lib/firefox-1.0.6/components/talkback/*
III A set of files involved in processing extensions. They are
NECESSARY in order for firefox to process extensions normally. Why
they were not generated in the compilation, I have no idea. Fortunately,
they are just textfiles, so we will patch them in during the process
(outlined below) of building an rpm.
+/usr/lib/firefox-1.0.6/extensions
+/usr/lib/firefox-1.0.6/extensions/Extensions.rdf
+/usr/lib/firefox-1.0.6/extensions/installed-extensions-processed.txt
+/usr/lib/firefox-1.0.6/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
+/usr/lib/firefox-1.0.6/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
C. Turn the binary tarball into an rpm. This stuff is lifted straight from
Thomas Chung's site.
1. Make sure you are set up to build rpms as a regular unprivileged user.
a) copy/paste the directory /usr/src/redhat into your home directory
and then make a subdirectory called /tmp:
$ cp -r /usr/src/redhat /home/yourusername
$ mkdir -p /home/yourusername/redhat/tmp
b) Create a textfile with the following contents:
%packager Your Name
%distribution Fedora Core 4
%vendor yourusername
%_topdir %(echo $HOME)/redhat
%_tmppath %{_topdir}/tmp
%_builddir %{_tmppath}
%_rpmtopdir %{_topdir}/%{name}
%_sourcedir %{_rpmtopdir}
%_specdir %{_rpmtopdir}
%_rpmdir %{_topdir}/RPMS
%_srcrpmdir %{_topdir}/RPMS
%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
and make sure there is a blank line at the end.
Save this file as /home/yourusername/.rpmmacros
c) With this setup, whenever you want to build an rpm called
name-version-release.arch.rpm
you will create a folder /home/yourusername/redhat/name.
Inside this folder you will place the source/binary tarball and specfile.
And then from inside this folder you will issue the command
rpmbuild -ba specfile [options]
2. Create the folder /home/yourusername/redhat/firefox, and put the following
files into it:
extensions-folder.patch - attached; remove .txt ending
firefox-1.0.6.en-US.linux-i686.tar.gz - the binary tarball you built above
firefox-mathml-enabling.patch - attached; remove .txt ending
firefox.desktop - attached; remove .txt ending
firefox.png - attached;
firefox.spec - the text of this file follows
#-----------------------------------------------------------------------------------
#Here are the contents of firefox.spec
Name : firefox
Version : 1.0.6
Release : 1.yourusername.FC4
# The Epoch allows for handling hard-to-compare version numbers.
# Use this tag if RPM cannot figure out the ordering of which release comes after another.
# Epoch : 2
License : MPL/LGPL
Summary : Mozilla Firefox Web browser.
Group : Applications/Internet
URL : http://www.mozilla.org/products/firefox/
Vendor : The Mozilla Organization
Packager : Your Name
BuildRoot : %{_tmppath}/%{name}-%{version}-buildroot
Source0 : %{name}-%{version}.en-US.linux-i686.tar.gz
# The home-made version lacks talkback capability
# for reporting errors.
Source1 : firefox.desktop
Source2 : firefox.png
Patch0 : firefox-mathml-enabling.patch
# small changes in res/mathml.css and
# res/fonts/fontEncoding.properties
# to enable viewing mathml
Patch1 : extensions-folder.patch
# adds the extensions folder /usr/lib/firefox.
# This folder is not included with homemade builds, but
# without it, the browser does not know how to add
# extensions
AutoReq : No
AutoProv : No
%description
Mozilla Firefox is an open-source web browser, designed for standards
compliance, performance and portability.
%prep
rm -rf %{buildroot}
rm -rf %{_tmppath}/*
%setup -q -n %{name}-%{version} -c
# Patch to enable mathml viewing
cd %{_tmppath}/%{name}-%{version}/%{name}
%patch0 -p1
# And patch to enable installation of extensions
%patch1 -p1
# And now rename the parent folder from firefox to firefox-%{version}
cd %{_tmppath}/%{name}-%{version}
mv %{name} %{name}-%{version}
%install
%{__install} -d -m 755 %{buildroot}%{_libdir}
cp -a firefox-%{version} %{buildroot}%{_libdir}
%{__install} -D -m 644 %{SOURCE1} %{buildroot}%{_datadir}/applications/firefox.desktop
%{__install} -D -m 644 %{SOURCE2} %{buildroot}%{_datadir}/pixmaps/firefox.png
%{__install} -d -m 755 %{buildroot}%{_bindir}
ln -sf %{_libdir}/firefox-%{version}/firefox %{buildroot}%{_bindir}/firefox
ln -sf %{_libdir}/firefox-%{version}/firefox-bin %{buildroot}%{_bindir}/firefox-bin
%clean
rm -rf %{_tmppath}/*
%files
%defattr(-, root, root)
%{_libdir}/firefox-%{version}/*
%{_datadir}/applications/firefox.desktop
%{_datadir}/pixmaps/firefox.png
%{_bindir}/firefox
%{_bindir}/firefox-bin
%changelog
#-----------------------------------------------------------------------------------
Please go through the firefox.spec file and change "Your User Name" on line 3 to
whatever is appropriate for you.
3. Build the rpm: open up a shell, and as regular user,
$ cd /home/yourusername/redhat/firefox
$ rpmbuild -ba firefox.spec --target=i686 (or whatever architecture you have)
This should only take a few minutes
Your finished rpms should be waiting inside /home/yourusername/redhat/RPMS
If this works, you can now delete /home/yourusername/redhat/firefox
Be sure to cleanout /home/yourusername/redhat/tmp
我把他的rpm包下载了,感觉是快了。不过就是中文支持不太好,字体有点不清楚。因为在:
"Edit" -- " references" -"Language" -"Language"里没有simple chinese的缘故吧?不知那位高手可以牺牲点时间重新编译一次,把简体中文编进去,方便一下大家呢? |
|