Update Mozilla hint

Tushar Teredesai tush at yahoo.com
Fri Jul 5 00:18:47 PDT 2002


This is a multi-part message in MIME format.
--------------070609010804020600070801
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Added option to build spellchecker.
-- 
Tushar Teredesai
LFS ID: 1377
http://www.geocities.com/tush/lfs/

--------------070609010804020600070801
Content-Type: text/plain;
 name="mozilla.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mozilla.txt"

TITLE:		Compiling Mozilla and Installing Plugins

LFS VERSION:	All

AUTHOR:		Tushar Teredesai <Tush at Yahoo.Com>

SYNOPSIS:
	How to compile 'Mozilla from Scratch' and install some relevant plugins.

HINT:

Change Log:
[2002-06-20]
	* Changed the CFLAGS I use.
[2002-06-19]
	* Added alternate site for hint.
[2002-06-17]
	* Added "make install" option.
	* Added MOZ_PLUGIN_PATH.
	* Added warning for GTK2 option.
[2002-05-14]
	* Added explanations for configure options.
	* Added options to build only the browser.
[2002-04-28]
	* Add gtk2 toolkit option.
	* Added a section to list of relevant URLs.
[2002-04-24]
	* Added hack to ignore autocomplete=off attribute used by some websites.
	* Added some useful preference settings.
[2002-04-22]
	* Fixed some typos, again!
	* Renamed hint to mozilla.
	* Added warning for CFLAGS, CXXFLAGS.
	* Added warning for QT and XLib toolkits.
	* Added info about pre-compiled distributions.
	* Added MOZILLA_FIVE_HOME to .mozconfig
	* Added instructions to copy man page, header files and idl files.
[2002-03-28]
	* Fixed some typos.
	* Environment variable to speed up Mozilla.
	* First version as mozcompile.

Pre-requisites:
	* X 4.2.0
	* GLib & GTK >= 1.2 (<2.0)
	* libIDL >= 0.6.3 && < 0.7
	* JPEG, PNG, MNG Libraries (latest versions)

Packages to download:
	* Info Zip >= 2.3 <http://www.info-zip.org/Zip.html>
	* iCal <http://www.softwarestudio.org/libical/> [Optional]
	* Mozilla:) <http://www.mozilla.org/releases>
	* Mozilla SpellChecker <http://spellchecker.mozdev.org/source.html>

Alternate site:
This hint is also available at <http://www.geocities.com/tush/lfs>. The latest
version of the hint is available there.

I also have a patch at the site that enables the password hack mentioned below
and enables compilation of spellchecker.

Installing X:

I have X-4.2.0. If possible use the latest version, there have been some
problems when building the Xft support for some X versions. See the BLFS book on
installing X.


Installing GTK:

Installing GTK 1.2 and its dependencies (GLib-1.2). Mozilla has a new option to
build for GTK 2.0 but I had problems compiling mozilla for GTK2. YMMV.

The installation is simply the regular installation dance routine:
	./configure --help
	./configure "$OPTIONS" && make && make install


Installing libIDL:

libIDL is a part of ORBIT (Orbit1, not Orbit2). If you have not installed
ORBIT1, download libIDL from mozilla's ftp site.


Installing Image Libraries (JPEG, PNG, MNG):

See the BLFS book for installation instructions. Get the latest versions.


Installing Zip:

There are additional options, check out the unix/Makefile. I use:
	make -f unix/Makefile prefix=/usr generic_gcc &&
	make -f unix/Makefile prefix=/usr install


Installing libical:

libical is only required if you want to play around with calendar. I had
problems building Mozilla calendar, YMMV. Also, mozilla requires the libical
that is available from mozilla's CVS.
	./configure --prefix=/usr --disable-static &&
	make &&
	make install


Compiling Mozilla:

One option is to pass the options to configure. Alternatively, these options can
be placed in a file .mozconfig that is read by Mozilla's configure script. I
prefer latter method (useful for recompiles).

First we will set the flags so that we can build a distribution rather than
having to run Mozilla from the directory we compiled.
	export MOZILLA_OFFICIAL=1
	export BUILD_OFFICIAL=1
	export MOZ_INTERNAL_LIBART_LGPL=1
	export MOZ_CALENDAR=1
The third export specifies that you accept the LGPL License for libart. This is
required for SVG support and is recommended. The fourth export is required only
if you want to build the calendar interface (experimental).

Set CFLAGS and CXXFLAGS based on your needs. It is reported that Mozilla crashes
on startup if -fomit-frame-pointer is used. I have had no problems setting both
CFLAGS and CXXFLAGS to "-O3 -march=i686 -fforce-addr -funroll-loops
-frerun-cse-after-loop -frerun-loop-opt -falign-functions=4". YMMV.

If you would like to compile the spellchecker, you will need to download the
spellchecker source code via cvs. First the login.
	cvs -d :pserver:guest at mozdev.org:/cvs login
The password is guest. Now download the spellchecker code.
	cvs -d :pserver:guest at mozdev.org:/cvs co spellchecker/spellcheck
Move the spellcheck directory to the extensions directory of mozilla
	mv spellchecker/spellcheck $MOZSRC/extensions

First try
	cd $MOZSRC &&
	./configure --help
to understand all the options that are available to you.

Now create the .mozconfig file containing the options you want. The .mozconfig
file can be in various locations (home directory of the user compiling, or in a
hierarchy above the mozilla source directory). Since I use MSB's package user
hint, I prefer to keep the file in the home directory.

There are options that you can use to install just the browser and skip all the
additional baggage that comes along with mozilla. These are some of the common
options along with short descriptions.

Mozilla now supports the "make install" option:) I prefer installing mozilla in
one of the standard locations. Since GNOME is heavily depended on mozilla, I
install it with the same prefix as gnome.
	echo ac_add_options --prefix=/opt/gnome >> .mozconfig

The --enable-default-mozilla-five-home is not relevant anymore since mozilla
installs in the standard locations.

Redundant but here for the sake of completeness:)
	echo ac_add_options --with-x >> .mozconfig

Use the packages we have installed as against using the ones available with
mozilla.
	echo ac_add_options --with-system-jpeg >> .mozconfig
	echo ac_add_options --with-system-zlib >> .mozconfig
	echo ac_add_options --with-system-png >> .mozconfig
	echo ac_add_options --with-system-mng >> .mozconfig

Build the calendar client (optional).
	echo ac_add_options --enable-calendar >> .mozconfig

Disable the mail and news client (optional).
	echo ac_add_options --disable-mailnews >> .mozconfig

Disable LDAP Support, recommended if mail is disabled.
	echo ac_add_options --disable-ldap >> .mozconfig

Enable the Xft support.
	echo ac_add_options --enable-xft >> .mozconfig

Enable the Personal Security Manager to enable SSL connections.
	echo ac_add_options --enable-crypto >> .mozconfig

Disable all debugging options and enable all optimization options. Pick and
choose.
	echo ac_add_options --disable-jsd >> .mozconfig
	echo ac_add_options --disable-accessibility >> .mozconfig
	echo ac_add_options --disable-tests >> .mozconfig
	echo ac_add_options --disable-debug >> .mozconfig
	echo ac_add_options --enable-optimize=-O3 >> .mozconfig
	echo ac_add_options --disable-dtd-debug >> .mozconfig
	echo ac_add_options --disable-logging >> .mozconfig
	echo ac_add_options --enable-reorder >> .mozconfig
	echo ac_add_options --enable-strip >> .mozconfig
	echo ac_add_options --enable-elf-dynstr-gc >> .mozconfig
	echo ac_add_options --enable-cpp-rtti >> .mozconfig

The following option is for enabling the xterm title with the current command
when compiling.
	echo ac_add_options --enable-xterm-updates >> .mozconfig

Disable support for HTML editing (optional).
	echo ac_add_options --enable-plaintext-editor-only >> .mozconfig

Enable extensions you want.
	echo ac_add_options --enable-extensions="all" >> .mozconfig
You may also pick and choose the extensions you want. To disable everything
other than the browser, use the following.
	echo ac_add_options \
		--enable-extensions="default,-venkman,-inspector,-irc" >> \
		.mozconfig

Enable SVG (Scalable Vector Graphics) support.
	echo ac_add_options --enable-svg >> .mozconfig

Mozilla now supports both gtk 1.2 and gtk 2.0. To enable gtk2 support, use the
option '--enable-default-toolkit=gtk2'. I had problems compiling for GTK2.

The QT and XLib toolkit support are not stable and may fail to compile. Try
compiling without these first and if all goes well, experiment with the other
toolkits.

<WARNING>
According to the financial institutions, the following hack makes your browser
insecure. IMO, it is no more insecure than using MS-IIS (along with its security
history) as the server for financial sites;) You have been warned. Many sites
use an MS-IE specific tag (autocomplete=off) to prevent autocomplete from
working in some forms. This tag is now supported in mozilla to appease the
financial institutions. As per the requirements of the financial institutions,
they will not even accept a solution where this a preference option. My opinion
is that it should be in the hands of the user. To enable autocomplete to bypass
this restriction, we need to make a slight modification in the code.
</WARNING>

<HACK>
Open the file /usr/src/mozilla/extensions/wallet/src/wallet.cpp and search for
the line 
	#define WALLET_DONT_CACHE_ALL_PASSWORDS
and delete or comment out the line.
</HACK>

If anyone tells you MS-IE is user friendly, give them this example:)

Optionally you can apply the patch I mentioned in the begining of the hint to
enable spellchecker and the password hack.

Now configure and compile the package as usual. If there are problems run
configure again by removing the offending option.
	./configure &&
	make
This will take a few hours to compile. Watch your favorite Startrek movie.

You have two options, installing mozilla in the standard locations or making a
distribution that can be installed on various computers.

If you would like to install in the standard locations do the standard:
	make install

To make a distribution that you would like to install on other machines:
	cd xpinstall/packager &&
	make &&
	cd /opt &&
	tar -xzf $MOZSRC/dist/mozilla-i686-pc-linux-gnu.tar.gz &&
	cd $MOZSRC/dist &&
	cp -LfR man /opt/mozilla &&
	cp -LfR idl /opt/mozilla &&
	cp -LfR include /opt/mozilla &&
	mkdir /opt/mozilla/include/nss &&
	cp -Lf private/security/*.h /opt/mozilla/include/nss &&
	cp -Lf public/security/*.h /opt/mozilla/include/nss &&
	cd /opt &&
	tar -cvzf mozilla-dist.tar.gz mozilla/
The above commands create a binary distribution, installs it in /opt/mozilla,
copies the man pages and header files to the installation and then creates a
distribution that can be untarred on other machines.

Now we make some environment settings.

If you install mozilla in a non-standard location, make sure that the location
is in your PATH. Also you may add the man page to your MANPATH.
	export PATH=$PATH:/opt/mozilla
	export MANPATH=$MANPATH:/opt/mozilla/man
You may also add /opt/mozilla to /etc/ld.so.conf (not required and not
recommended). Remember to run ldconfig if you do.

To make your Mozilla build go faster, add:
	export XPCOM_CHECK_THREADSAFE=0
in .bash_profile or in run-mozilla.sh. This apparently only affects debug
builds, but no harm in setting it for optimized builds.

I use a different location for the Mozilla plugins so that I can keep remove and
reinstall mozilla without affecting the plugins. If you do this set the
MOZ_PLUGIN_PATH to the appropriate directory. I use:
	export MOZ_PLUGIN_PATH=/opt/mozilla-plugins
Also make a link to the default plugin in the mozilla directory
(libnullplugin.so).

To allow for a multiple-user install, the easiest option is to run mozilla as
the user that installed mozilla (usually root). Else when some other user tries
to run mozilla, it results in a segmentation fault.  So check out your shiny new
Moz:
	mozilla

Enzoy:)


Installing a pre-compiled distribution:

An alternative is to install a pre-compiled Mozilla distribution. Though against
"the spirit of LFS", the reasons you may wish to do so:
	1. Chicken and egg problem:) You are having problems compiling Mozilla
	   and till you resolve them, you need a browser to get support with the
	   debugging.
	2. You don't want to spend 5 hours (thats how long it takes on my P-II
	   350) compiling.
	3. You are content with the options used by the pre-compiled
	   distribution.
	4. You have a GCC3 CVS and you would like to use a GCC2 compiled mozilla
	   so that commercial plugins can work without problems. Though I am
	   using all the plugins (except for Real) mentioned below without
	   problems.

If so, head over to mozilla.org and download the "talkback enabled full
installer" and read the installation instructions in the release notes.
Remember to follow the instructions for multi-user installs in the notes, else
a core dump may occur at startup.


Relevant URLs:

Visit the following sites to find help and find extensions to mozilla.
	* http://www.mozdev.org/projects.html
	  Some really cool extensions to mozilla such as google bar.
	* http://www.mozilla.org/projects/
	  Projects related to mozilla, some of them are already integrated into
	  the current release, some are yet to mature.
	* http://www.gerbilbox.com/newzilla/
	  The unofficial Mozilla FAQ.
	* http://www.themes.org/skins/mozilla/
	  Theme park for Mozilla.


Changing Preferences:

Whether to follow the settings in the current section is entirely at your
discretion. Would just like to mention some changes in the preferences I like:
	* Appearance -> Colors -> Enable Use System Colors.
	* Appearance -> Theme -> Select Modern Theme. Way better than Classic.
	* Navigator -> Smart Browsing -> Enable Internet Keywords.
	* Navigator -> Search Engine -> Search Using Google:)
	* Navigator -> Tabbed Browsing -> Enable all options under Open Tabs
	  instead of windows. Tabs are cool.
	* Privacy & Security -> Cookies -> Enable Ask me before storing a
	  cookie. Bye bye Doubleclick.
	* Privacy & Security -> Images -> Enable Ask me before downloading an
	  image. Do this only if you are on a slow connection. Otherwise it is
	  more of a hassle. I usually set it because it prevents the user
	  tracking images from loading.
	* Advanced -> Scripts & Windows -> Disable Open Unrequested Windows,
	  Move or resize existing windows, Raise or lower windows. Bye bye X10.
	* Advanced -> Cache -> Disk Cache = 8192KB. I had some problems in an
	  older version when the disk cache became very large (although that was
	  on Windows 2000:D). Anyways 50 MB sounds a bit too much.


GCC 3 Tips:

If you compile Mozilla using GCC3, closed source plug-ins such as flash will
crash Mozilla since these plug-ins are compiled using GCC2. A work-around till
the plug-ins are fixed is to pre-load a library that will make some required
functions available to these plug-ins. Unfortunately, the Java Plugin does not
work using this approach. But I have hacked the j2sdk to compile from scratch.

Do the following.
	cat > libc++mem.c << "EOF"
	// From http://bugzilla.mozilla.org/show_bug.cgi?id=124006
	void *__builtin_new(int size) {return (void*)malloc(size);}
	void *__builtin_vec_new(int size) {return __builtin_new(size);}
	void *__builtin_delete(void *ptr) {free(ptr);}
	void *__builtin_vec_delete(void *ptr) {__builtin_delete(ptr);}
	EOF
	gcc -shared -fPIC -o libc++mem.so libc++mem.c
Move the resulting libc++mem.so to the location where run-mozilla.sh file is
installed (e.g. /opt/gnome/lib/mozilla-1.0.0/ or /opt/mozilla)
	mv libc++mem.so /opt/mozilla

Open run-mozilla.sh and just below line 351 enter
	export LD_PRELOAD=$MOZILLA_FIVE_HOME/libc++mem.so


Installing Adobe Acrobat Plugin:

Download the Acrobat Reader from Adobe's website.
	http://www.adobe.com/products/acrobat/readstep2.html

Install Acrobat in /opt/acrobat. Now link the plugin.
	cd $MOZ_PLUGIN_PATH &&
	ln -s /opt/acrobat/Browsers/intellinux/nppdf.so


Installing Java Plugin:

Download SUN JRE 1.4 from
	http://java.sun.com/j2se/

Install JDK in /opt/j2sdk and then link the plugin.
	cd $MOZ_PLUGIN_PATH &&
	ln -s ${JAVA_HOME}/jre/plugin/i386/ns610/libjavaplugin_oji.so

Some alternative java plugins:
	http://www.alphaworks.ibm.com/
	http://www.blackdown.org/

I have succesfully managed to compile Java 2 SDK 1.4 that is linked against
GCC3. Check out the "Java From Scratch" hint.


Installing Macromedia Flash Player:

Download the Flash Player from Macromedia's website.
	http://sdc.shockwave.com/shockwave/download/alternates/#linux

Untar the files.
	cp libflashplayer.so ShockwaveFlash.class $MOZ_PLUGIN_PATH


Installing RealPlayer:

Download the plugin from Real Networks.
	http://forms.real.com/real/player/unix/unix.html

Install RealPlayer in /opt/RealPlayer8 and then copy the plugin to mozilla's
plugin directory.
	cp rpnp.so raclass.zip $MOZ_PLUGIN_PATH


CodeWeaver's CrossOver Plugin:

If you are interested in using Windows plugins, this commercial product will
allow you to do it. Check out:
	http://www.codeweavers.com/products/crossover/
for more info.


Have fun mozzing around.

Don't forget to send me bug reports and enhancements so that I can keep the hint
updated. An appropriate place to discuss problems is the blfs-support mailing
list.


--------------070609010804020600070801--

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe hints' in the subject header of the message



More information about the hints mailing list