Linux Step By Steps

mozilla / firebird / thunderbird build system
Written by James McDonald on 23-January-2004.

This is how I semi-automate the build of Mozilla / Firebird / Thunderbird on my Redhat 9.0 box running a 2.6 kernel.

Create a folder to store all the stuff in
mkdir -p ~/downloads/mozilla
mine is in /home/james/downloads/mozilla from now on i'll call this $mozilla_root

Download the mozilla source into the $mozilla_root directory (download a tarball or cvs)
Find a mirror then download the source from the following relative path
(ftp | http)://<mirror_server>/mozilla/mozilla/nightly/latest/mozilla-source.tar.bz2

Convert the source file download to a cvs repository by following these instructions
http://www.mozilla.org/cvs.html#sandbox

Create the three different .mozconfig files for Mozilla / Firebird / Thunderbird put them in $mozilla_root and name them as shown
Mozilla .mozconfig ($mozilla_root/mozconfig)
# sh
# Build configuration script
#
# See http://www.mozilla.org/build/unix.html for build instructions.
#

# Options for client.mk.
mk_add_options MOZ_OBJDIR=/home/james/downloads/mozilla/mozilla-build
#mk_add_options MOZ_INTERNAL_LIBART_LGPL=1
#MOZ_INTERNAL_LIBART_LGPL=1
#export MOZ_INTERNAL_LIBART_LGPL=1
# Options for 'configure' (same as command-line options).
ac_add_options --with-pthreads
#ac_add_options --with-system-nspr

ac_add_options --with-system-jpeg=/usr
ac_add_options --with-system-zlib=/usr
ac_add_options --with-system-png=/usr
ac_add_options --enable-default-toolkit=gtk2
ac_add_options --enable-calendar
ac_add_options --enable-xft
ac_add_options --enable-crypto
#ac_add_options --enable-ldap-experimental
#ac_add_options --enable-svg
ac_add_options --disable-debug
#ac_add_options --enable-optimize="-O3 -mcpu=athlon -march=athlon"
ac_add_options --disable-logging
ac_add_options --enable-reorder
ac_add_options --enable-strip

Mozilla firebird .mozconfig ($mozilla_root/mozconfig-firebird)
mk_add_options MOZ_OBJDIR=/home/james/downloads/mozilla/firebird-build
topsrcdir=/home/james/downloads/mozilla/mozilla
. $topsrcdir/browser/config/mozconfig
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-optimize
ac_add_options --disable-shared
ac_add_options –enable-static

Mozilla Thunderbird .mozconfig ($mozilla_root/mozconfig-thunderbird)
mk_add_options MOZ_OBJDIR=/home/james/downloads/mozilla/thunderbird-build
ac_add_options --disable-accessibility
ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
ac_add_options --disable-debug
ac_add_options --disable-installer
ac_add_options --disable-mathml
ac_add_options --disable-necko-disk-cache
ac_add_options --disable-oji
ac_add_options --disable-profilesharing
ac_add_options --disable-tests
ac_add_options --enable-crypto
ac_add_options --enable-extensions=wallet,spellcheck,xmlextras
ac_add_options --enable-image-decoders=icon,png,gif,jpeg,bmp
ac_add_options --enable-necko-protocols=http,file,jar,viewsource,res,data
ac_add_options --enable-optimize
ac_add_options --enable-strip
ac_add_options --enable-strip-libs
export MOZ_THUNDERBIRD=1
mk_add_options MOZ_THUNDERBIRD=1

Create a script to run the cvs update and build process ( ~/bin/compile_and_build_mozilla )
#!/bin/sh
# cvs update and compile mozilla

usage(){

me=`basename $0`
echo $me \[mozilla\|\[firebird\|\[thunderbird\]\]\]

}

case "$1" in
mozilla)
objdir=mozilla-build
MOZ_CONF=mozconfig
;;
firebird)
objdir=firebird-build
MOZ_CONF=mozconfig-firebird
;;
thunderbird)
objdir=thunderbird-build
MOZ_CONF=mozconfig-thunderbird
;;
*)
usage
exit 0
;;
esac

export PATH=/usr/bin:$PATH

MOZ_TOP=/home/james/downloads/mozilla
MOZ_SRC=$MOZ_TOP/mozilla
MOZ_OBJDIR=$MOZ_TOP/$objdir

if [ ! -d "$MOZ_OBJDIR" ]
then

mkdir "$MOZ_OBJDIR"


fi

cp $MOZ_TOP/$MOZ_CONF $MOZ_OBJDIR/.mozconfig

cd $MOZ_TOP

export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot

cvs login
cvs co mozilla/client.mk

export MOZCONFIG=$MOZ_OBJDIR/.mozconfig

cd $MOZ_SRC

make -f client.mk pull_and_build_all

Once you have set up the above
Start the build process by calling the compile_and_build_mozilla script with one of three args

# for the full mozilla build
compile_and_build_mozilla mozilla

# for the browser only
compile_and_build_mozilla firebird

# for the mailnews only client
compile_and_build_mozilla thunderbird

Once the build process is complete you need to put the completed files into a tarball

For thunderbird and firebird use this
cd $mozilla_root/$objdir/dist/bin
# since just about all the files in $mozilla_root/$objdir/dist/bin are symlinks to other parts of the build tree use the -h option to tar to dereference the links and suck the real file into the tarball
tar -czhvf ../<firebird.tar.gz | thunderbird.tar.gz> *

For Mozilla use the included make process
cd $mozilla_root/$objdir/xpinstall/packager
make
# (this will drop a mozilla-*.tar.gz file into $mozilla_root/$objdir/dist)

Once you have created the tarball of the installation install the files (this shows them being put in the users $HOME/)
For thunderbird and firebird use this
mkdir ~/<thunderbird | firebird>
tar -zxvf <firebird.tar.gz | thunderbird.tar.gz> -C ~/<thunderbird | firebird>

For Mozilla use
tar -zxvf /path/to/mozilla-*.tar.gz -C ~/