Compiling Mozilla from source

  1. The first thing you will need is a source tarball from mozilla.org. You can find the latest and greatest (again, at the time of this writing) at:
    ftp://ftp.mozilla.org/pub/mozilla/releases/

    Next, you'll want to grab some plugins.

    Blackdown Java
    Blackdown is an implementation of Java that runs on Linux. It was recently voted as the "Best Java Implementation for Linux".
    Macromedia Flash Player
    Does this really need a description?
    RealPlayer
    Streaming media player. You all know what it is. Fortunately, you don't need it cause MPlayer can handle these files.
    MPlayer
    Linux movie player (Quicktimes, Windows Media, MPEG, AVI, DIVX, etc): here and here
    Adobe Acrobat
    View PDF files within your browser.

    Please note that I'm going to assume the following is installed on your Linux system already:

    • libjpeg
    • libz/zlib
    • libmng
    • gtk+ 2.x
  2. Configuring Mozilla
    I configure Mozilla to use the default toolkit. You might want to adjust this to your tastes. I also compile for a 686 CPU. You should change this to match your processor type.
    • Since we need to build a "distribution" in order to install it ourselves, we need a couple of environment items set:
      • export MOZILLA_OFFICIAL=1
      • export BUILD_OFFICIAL=1
    • tar zxvf mozilla-source-x.x.x.tar.gz
    • cd mozilla
    • Let's make the browser a *little* more secure..
      • cat extensions/wallet/src/wallet.cpp|sed 's/#define WALLET_DONT_CACHE_ALL_PASSWORDS//g' > extensions/wallet/src/wallet.cpp.new
      • mv extensions/wallet/src/wallet.cpp.new extensions/wallet/src/wallet.cpp
    • Mozilla has really matured, so I now install it into the /usr directory...
      • ./configure --prefix=/usr \
      • --enable-default-mozilla-five-home \
      • --enable-toolkit-gtk2 \
      • --enable-default-toolkit=gtk2 \
      • --with-x \
      • --with-system-zlib \
      • (this next one is for those not using Gnome)
      • --disable-gnomevfs \
      • --with-system-jpeg \
      • --with-system-png \
      • --with-system-mng \
      • --enable-crypto \
      • --enable-java-supplement \
      • (this next one is for those not using Gnome)
      • --disable-gnomeui\
      • --disable-tests \
      • --disable-debug \
      • --disable-freetypetest \
      • --disable-logging \
      • --enable-reorder \
      • --disable-freetype2 \
      • --enable-strip \
      • --disable-pedantic \
      • --enable-cpp-rtti \
      • --enable-optimize \
      • --enable-extensions=all \
      • (this next one is for building the whole suite. you can change this)
      • --enable-application=suite
  3. Now we're ready to build.
    Finally, the following command will produce us a browser. Run it and go do whatever it is you've been putting off doing. You're going to get a lot done waiting for this thing to compile!
    • make
  4. Now we can install the beast...
    • make install
    • install -d /usr/include/mozilla-1.8/nss
    • cp -Lf dist/private/nss/*.h dist/public/nss/*.h /usr/include/mozilla-1.8/nss
    • ln -nsf mozilla-1.8 /usr/include/mozilla
    • ln -nsf mozilla-1.8 /usr/lib/mozilla
  5. Now, we need to do the final configuration of the browser:
    • cd /usr/lib/mozilla-1.8
    • export LD_LIBRARY_PATH="/usr/lib/mozilla-1.8"
    • export MOZILLA_FIVE_HOME="/usr/lib/mozilla-1.8"
    • ./regxpcom
    • ./regchrome
    • touch `find /usr/lib/mozilla-1.8 -name *.rdf`
    • ln -sf mozilla /usr/bin/netscape
  6. Okay, personally, I'd prefer to avoid using Java where possible, but there's a couple of sites I frequent that require it, so... Fortunately, (or unfortunately depending on your viewpoint), Blackdown is only available in binary format, so it's relatively easy to install. (I put mine in /opt)
    • sh /some/path/j2re-1.3.1-FCS-linux-i386.tar.bz2
    You then need to add <j2re-home>/bin to your path if you want to run Java programs directly. To use the Java plugin, simply create a symlink from it's home in the <j2re-home> into the Mozilla plugins folder. In my case, Mozilla lives in /usr/lib/mozilla so:
    • cd /usr/lib/mozilla/plugins
    • ln -s /opt/j2re1.3.1/plugin/i386/mozilla/javaplugin_oji.so

    You then need to restart your browser. The following page has some applets running, so it's a quick and easy test of a working plugin: http://java.sun.com/openstudio/index.html
  7. Installing Flash player is really straightforward.
    • cd /opt
    • tar -xvzf /some/path/flash_linux.tar.gz
    • cd flash_linux
    • cp libflashplayer.so ShockwaveFlash.class /usr/lib/mozilla/plugins

    Restart Mozilla. A good test site is http://www.shockwave.com/.
  8. Installing Adobe Acrobat is fairly simple as well.
    • tar -xvzf linux-505.tar.gz
    • cd ILINXR.install
    • ./INSTALL
    This will run the install script which will prompt you for the final location to install Acrobat. After this runs, you should run the following command to create a link in your path to the acroread startup script (the recommended way to run the program directly:
    • ln -s <acrohome>/bin/acroread /usr/bin/acroread
    Finally, to make it available as a plugin...
    • cd /usr/lib/mozilla/plugins
    • ln -s <acro-home>/Browsers/intellinux/nppdf.so
  9. Now, follow the MPlayer instructions here and here

That's it. You now have a modern, stable browser which can handle most of the fluff webmasters today will throw at you.

As an added bonus, you can configure KDE/Konqueror to scan the Mozilla plug-in directory (/usr/lib/mozilla/plugins) and you should be able to use the newly installed plugins with Konqueror!

© Douglas Hunley (doug at hunley.homeip.net)
searchSearch Index