LDP/LDP/howto/docbook/Mozilla-Optimization.xml

154 lines
11 KiB
XML

<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
]>
<article lang="en">
<articleinfo>
<title>Mozilla Optimization Mini-HOWTO</title>
<author>
<firstname>Salvador</firstname>
<surname>Peralta</surname>
<othername role="mi">J.</othername>
<affiliation>
<address>
<email>speralta at willamette dot edu</email>
</address>
</affiliation>
</author>
<pubdate>January 2003</pubdate>
<revhistory id="revhistory">
<revision>
<revnumber>1.0</revnumber>
<date>2003-01-03</date>
<authorinitials>SJP</authorinitials>
<revremark>Initial release, reviewed by LDP</revremark>
</revision>
</revhistory>
<abstract>
<para>This document discusses how to make configuration and source level customizations of Mozilla to make it more suitable as a primary browser for Linux and X Windows. It is not intended as a guide for programming Mozilla, nor is it a guide to XUL.</para>
<para>The techniques described in this document have been implemented and tested in a kiosk-like public computing environment using thin client workstations running on Redhat Linux, utilizing XFree86.</para>
</abstract>
</articleinfo>
<sect1 id="copyleft">
<title>Copyright</title>
<para>
Copyright &copy; 2002 Salvador Peralta
</para>
<para>
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found at the <ulink url="http://www.gnu.org/copyleft/fdl.html">GNU web site</ulink>.
</para>
</sect1>
<sect1 id="Introduction">
<title>Introduction</title>
<para>
Mozilla is an Open Source, cross-platform, browser and graphical application environment. It is rapidly becoming a significant component on many Linux-based desktops due to its stability, robust feature-set, large developer-base, and ease of configuration. This Mini HOWTO addresses how to patch and configure Mozilla's source to better optimize it for Linux desktop environments, and is intended to serve as a general set of instructions for the Linux community on how to compile and configure Mozilla.
</para>
<para>
The most current version of this Mini HOWTO can be obtained in HTML format from <ulink url="http://www.willamette.edu/~speralta/tldp/mozilla">www.willamette.edu/~speralta/tldp/mozilla</ulink>.
</para>
</sect1>
<sect1 id="UsetheSource">
<title>Get the Source</title>
<para>There are pros and cons to building Mozilla yourself. The biggest drawback is that the source version, compressed, is a 30+ MB file in most releases which is about three times larger than the binary distribution. A second negative is that on a reasonably new machine such as my 1.6 ghz Pentium 4 with 256 MB of memory, compiling Mozilla can take anywhere between one and a half to four hours depending on any other jobs the system might be running. On an older machine, Mozilla can take twenty-four hours or more to compile. The biggest benefit is that there are a large number of compile-time options and patches that can be applied which will dramatically improve the performance and featureset of the browser. These patches are generally necessary if you intend to run Mozilla in a production environment.
</para>
<para>
If you are not interested in source level modifications of the Mozilla browser, please skip the next few sections and have a look at <xref linkend="postinstall" />, Post-Install Configuartion.
</para>
<para>
At the time this document was written, the latest version of the Mozilla source code is 1.2.1, which can be obtained via ftp at <ulink url="ftp://ftp.mozilla.org/pub/mozilla/releases/mozilla1.2.1">ftp.mozilla.org/pub/mozilla/releases/mozilla1.2.1</ulink>. The other stable release, 1.0.1, can be obtained via ftp at <ulink url="ftp://ftp.mozilla.org/pub/mozilla/releases/mozilla1.0.1">ftp.mozilla.org/pub/mozilla/releases/mozilla1.0.1</ulink>.
</para>
<para>
For CVS checkout, please review the documentation on the <ulink url="http://mozilla.org">Mozilla</ulink> website.
</para>
</sect1>
<sect1 id="patch">
<title>Patch the Source</title>
<para>
Unpatched Mozilla is not a very good X citizen. For example, it does not allow one to specify X and Y geometry position as a command-line option. This is not a big problem on a typical end-user desktop, but in a corporate or public computing environment, it is a killer. In order to fix this, we need to apply a patch to the C++ source code at <filename>embedding/components/windowwatcher/src/nsWindowWatcher.cpp</filename>. The first step is to obtain and apply the <ulink url="http://www.willamette.edu/~speralta/mozilla.kludge.txt">patch</ulink> written by Robert Riches. This patch has been tested in Mozilla versions 1.0 through 1.2.1.
</para>
<para>
To apply the patch, simply paste it into <filename>embedding/components/windowwatcher/src/nsWindowWatcher.cpp</filename>, in your Mozilla source tree. The notation uses <quote>+</quote> symbols to denote the code that needs insertion. Those symbols need to be removed before saving the <filename>nsWindowWatcher.cpp</filename> text file.
</para>
<para>
To use the patch, set an environment variable called <envar>MOZILLA_SCREEN_POS</envar> with the proper coordinates. For example, in Bash, type <command>export MOZILLA_SCREEN_POS='screenx=1,screeny=1'</command> will set the top left corner of your browser to the top left corner of your screen.
</para>
</sect1>
<sect1 id="configure">
<title>Configure the Source</title>
<para>Another problem with using Mozilla in a personal or production environment is that it contains code which will override any home page that you set on a timed basis, or whenever a new release of the product is distributed.
</para>
<para>Since this information is stored in a configuration file, the easiest thing to do without breaking the browser is to change the configuration file to point default homepage settings to one that is more consistent with the environment that you are using.
</para>
<para>
Mozilla conveniently stores most of its compile-time configuration files with a <emphasis>.properties</emphasis> extension. You can use these files to specify text in message dialogues, fonts, and other options. In this case, assuming that your locale and language settings are <envar>en-US</envar>, the <emphasis>.property</emphasis> file that you will need is <filename>region.properties</filename> which is located in the <filename class="directory">xpfe/browser/resources/locale/en-US/</filename> directory.
</para>
<para>
The changes that you need to make to this file are fairly straight forward. As a general rule, I replace the value portion of the name/value pair to one of my own choosing in every instance where the word <quote>homepage</quote> is mentioned in the configuration.
</para>
<screen>
# navigator.properties
homePageDefault=http://yoururl.com
shopKeyword=keyword:shop [Product]
quoteKeyword=keyword:quote [Enter symbol here]
localKeyword=keyword:zip [Your zip code]
keywordList=http://home.netscape.com/escapes/keywords
webmailKeyword=http://webmail.netscape.com
careerKeyword=keyword:[Your city] careers
fallbackDefaultSearchURL=http://search.netscape.com/cgi-bin/search?charset=UTF-8&amp;search=
otherSearchURL=http://home.netscape.com/bookmark/6_0/tsearch.html
#
# all.js
#
browser.startup.homepage=http://yoururl.com
browser.throbber.url=http://yoururl.com
browser.search.defaulturl=http://search.netscape.com/cgi-bin/search?search=
wallet.Server=http://www.mozilla.org/wallet/tables/
wallet.Samples=http://www.mozilla.org/wallet/samples/
#config.js
#
startup.homepage_override_url=http://yoururl.com
</screen>
</sect1>
<sect1 id="compile">
<title>Compile the Source</title>
<para>To configure Mozilla's compile-time options, type <command>./configure</command> from the root directory of the Mozilla source tree. To get a full list of compile-time options, type <command>./configure --help</command>. Some things to verify before doing a production compilation include verifying that environment preferences (mail vs. no mail, calendar, ldap, etc.) are set and making sure that the crypto package is enabled.
</para>
<para>
For simplicity's sake, I generally use a simple build script like the following to configure Mozilla.
</para>
<screen>
#!/bin/sh
MOZILLA_OFFICIAL=1
export MOZILLA_OFFICIAL
BUILD_OFFICIAL=1
export BUILD_OFFICIAL
./configure --with-x --disable-calendar --enable-crypto --with-system-nspr
--disable-debug --enable-extensions --enable-optimize
--without-system-zlib --without-system-jpeg --without-system-png
--without-system-mng
</screen>
<para>Once you have your patches applied, config files modified, and options set, simply build Mozilla with <emphasis>gmake</emphasis> by typing <command>./gmake</command> in the root directory of your source tree, and then create your tarball by typing <command>gmake</command> in the <filename class="directory">xpinstall/packager</filename> directory. This will drop the tarball in the dist subdirectory just beneath the root directory of your Mozilla source tree. Just move that package to <filename class="directory">/usr/local</filename>, unpack it, run it once from the command-line as the user who built the package (the command is <command>/usr/local/mozilla/mozilla</command>), and you are nearly ready to browse.
</para>
</sect1>
<sect1 id="postinstall">
<title>Post-Install Configuration</title>
<para>
There are several configuration choices that you can make after you have installed your browser. You can add plugins for common web technologies such as Java (<ulink url="http://java.sun.com">java.sun.com</ulink>), PDF printing (<ulink url="www.adobe.com">www.adobe.com</ulink>), and Flash animations (<ulink url="http://www.macromedia.com/software/flash">www.macromedia.com/software/flash</ulink>) and slightly less well-known, but very cool plug-ins, such as Enigmail (<ulink url="http://enigmail.mozdev.org">enigmail.mozdev.org</ulink>).
</para>
<para>
To install any plug-in, either copy the plug-in from the source application (e.g. Acrobat5 ) to the <filename class="directory">/plugins</filename> directory in Mozilla, or create a symbolic link from the plug-in to the plug-ins directory in the Mozilla binary tree. For example, to create a Mozilla plug-in for Adobe Acrobat 5 using a symbolic link, simply type <command>ln -s /path/to/Acrobat5/Browsers/intellinux/nppdf.so /usr/local/mozilla/plugins/</command>. Similarly, to create a plug-in from your Java runtime environment, type <command>ln -s /path/to/j2re1.4.0_02/plugin/i386/ns610/libjavaplugin_oji.so /usr/local/mozilla/plugins/</command>. Please note, it is recommended that you use Sun's JDK 1.4.1 with Mozilla 1.0.1 and above. There are known incompatibilities with Mozilla and earlier versions of Java.
</para>
<para>
To obtain Mozilla project plug-ins such as Enigmail, which provides an interface for encrypting and decrytping mail, or for Protozilla, which provides full parameterization (including support for multiple multiple protocol and programming languages), visit <ulink url="http://mozdev.org">mozdev.org</ulink>.
</para>
</sect1>
</article>