Compiling Mozilla from Source

Linux-sxs.org features an informative article on how to compile Mozilla from source. Especially if you have switched to GCC 3.1, you can build some really optimized binaries for your Mozilla, as GCC 3.1 does better optimization in general, plus it supports special optimizations for Pentium4 or AthlonXP. A very simple example of how you could do that (you could add more parameters or modify to your liking or needs), is following. By exporting these variables to a terminal, you are making sure that all subsequent compilations in that session will use these optimizations. The following will work for all 686 (pentium-pro/PII/PIII etc architecture that is) CPUs and up.


export CXXFLAGS=”-O3 -march=i686 -mcpu=i686″
export CPPFLAGS=”-O3 -march=i686 -mcpu=i686″
export CFLAGS=”-O3 -march=i686 -mcpu=i686″


This will work for AthlonXPs:
export CXXFLAGS=”-O3 -march=athlon-xp -mcpu=athlon-xp”
export CPPFLAGS=”-O3 -march=athlon-xp -mcpu=athlon-xp”
export CFLAGS=”-O3 -march=athlon-xp -mcpu=athlon-xp”


And this one, for Pentium 4s:
export CXXFLAGS=”-O3 -march=pentium4 -mcpu=pentium4″
export CPPFLAGS=”-O3 -march=pentium4 -mcpu=pentium4″
export CFLAGS=”-O3 -march=pentium4 -mcpu=pentium4″


You get the idea. Other options for GCC 3.1 include i386, i486, i586, i686, pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-4, athlon-xp and athlon-mp. Get the list and additional optimization flags here.


If you got GCC 2.95.x or 2.96 (open a terminal and type: gcc -v, to check out what version you are running), I believe you are limited to these CPU types.


The Mozilla configure script as described in the Linux-sxs.org article, already contains this line:
–enable-optimize=’-O3 -march=i686 -mcpu=i686′
so, you will want to change it according to your CPU type as described above.


XFree 4.3 will have native support in its XFT library for Mozilla true type font anti-alias, but if you can’t wait till then, recompile the latest FreeType2 library by changing the #undef to #define in front of the “TT_CONFIG_OPTION_BYTECODE_INTERPRETER” line, in its [freetype2-src-dir]/include/freetype/config/ftoption.h file and then configure and compile.


Make sure you have read its unix Readme file, in order to make sure FreeType2’s ‘make install’ script will put the compiled libraries to the correct places for your distribution.


After you do all that, open up the /usr/lib/… or ~/mozilla/defaults/pref/unix.js file with a text editor and leave uncommented only this line: pref(“font.FreeType2.unhinted”, true); and hide its previous line: pref(“font.FreeType2.autohinted”, false); Then, remove the double slashes (comments) from: pref(“font.directory.truetype.2”, “/usr/X11R6/lib/X11/fonts/ttf”); and replace that last directory with the directory you have all your TTF web fonts installed on your X11 system. If you do not have the special Web Fonts installed yet, you can find them either at your C:\windows\fonts\ directory or on Microsoft’s web site as linked above.

22 Comments

  1. 2002-06-08 6:19 pm
  2. 2002-06-08 6:29 pm
  3. 2002-06-08 6:45 pm
  4. 2002-06-08 7:12 pm
  5. 2002-06-08 9:44 pm
  6. 2002-06-09 1:14 am
  7. 2002-06-09 2:11 am
  8. 2002-06-09 6:07 am
  9. 2002-06-09 7:45 am
  10. 2002-06-09 7:55 am
  11. 2002-06-09 10:57 am
  12. 2002-06-09 11:07 am
  13. 2002-06-09 3:01 pm
  14. 2002-06-09 4:37 pm
  15. 2002-06-09 6:22 pm
  16. 2002-06-09 6:29 pm
  17. 2002-06-09 7:01 pm
  18. 2002-06-10 1:29 am
  19. 2002-06-10 2:09 am
  20. 2002-06-10 5:36 am
  21. 2002-06-10 5:58 am
  22. 2002-06-10 8:12 am