wiki:firefox

Version 14 (modified by andy@…, 15 years ago) ( diff )

--

Please login and fix my errors!

Compiling Firefox and Thunderbird From CVS

The Mozilla developers tend to be cautious, making stable releases quite infrequently. Meanwhile active development continues on cvs head. Compiling Firefox and Thunderbird from cvs isn't hard. Obviously you'll need cvs http://www.linuxfromscratch.org/blfs/view/svn/basicnet/netprogs.html#cvs. First, decide where you're going to keep the code. The mozilla tree weighs in at more than 300Mb so it makes sense to use the same code for both Firefox and Thunderbird. First cd into a suitable folder and then login to cvs

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

Just press enter when it asks you for a password. Then checkout some configuration files

 cvs co -f mozilla/client.mk &&
cvs co -f mozilla/browser/config/mozconfig &&
cvs co -f mozilla/mail/config/mozconfig

Now create a suitable mozconfig for Firefox

cat > mozilla/mozconfig-fox << "EOF"
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-build
ac_add_options --with-pthreads
ac_add_options --disable-tests
ac_add_options --enable-svg
ac_add_options --enable-canvas
ac_add_options --enable-static
ac_add_options --disable-shared
ac_add_options --prefix=/usr
ac_add_options --disable-installer
ac_add_options --enable-extensions=default,spellcheck
EOF

And one for Thunderbird

cat > mozilla/mozconfig-bird << "EOF"
. $topsrcdir/mail/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/thunderbuild
ac_add_options --with-pthreads
ac_add_options --disable-tests
ac_add_options --prefix=/usr
ac_add_options --disable-installer
EOF

Create a folder to make a backup copy of the finished builds

mkdir tarballs

Now you can build Firefox with these commands

cd mozilla &&
ln -sf mozconfig-fox mozconfig &&
rm -rf firefox-build &&
make LDFLAGS=-lpangoxft-1.0 -f client.mk &&
make -C firefox-build/browser/installer &&
cp firefox-build/dist/firefox-3.0a1.en-US.linux-i686.tar.bz2 ../tarballs/firefox-$(date +%d-%m-%y).tar.bz2

If you put those commands in a script it makes it easy to automate it and do a weekly build. The first time it is run it will take forever for cvs to pull the code (slight exaggeration) depending on the speed of you internet connection.

Building Thunderbird is basically the same

cd mozilla &&
ln -sf mozconfig-bird mozconfig &&
rm -rf thunderbuild &&
make -f client.mk &&
make -C thunderbuild/xpinstall/packager &&
cp thunderbuild/dist/thunderbird-3.0a1.en-US.linux-i686.tar.bz2 ../tarballs/thunderbird-$(date +%d-%m-%y).tar.bz2

The date in that command is in the European format, so tweak that to suit yourself.

To run the finished build it's just like the tarballs you can download from Mozilla. Untar it somewhere suitable and run the {firefox,thunderbird} script in the folder.
I find it convenient to run them in my home folder, it saves having to login as root and it means that nothing I do here can screw up my carefully crafted BLFS system. It is possible to run (as root) make -f client.mk install, then it will install Firefox in /usr (or Thunderbird, depending which mozconfig the symbolic link is pointing too). But I wouldn't recommend it, unless you've thoroughly road tested the build first.
For one thing, you can't build Yelp (Gnomes help browser) linked against a current cvs Firefox build because it no longer installs libgtkembedmoz.so.
If you do install it system side, but later change your mind and want to delete it again, these commands will remove Firefox

rm -f /usr/{bin,lib/pkgconfig}/firefox*
rm -f /usr/share/aclocal/nspr.m4
rm -rf /usr/{lib,include,share/idl}/firefox-3.0a1

And these commands will remove Thunderbird

rm -f /usr/{bin,lib/pkgconfig}/thunderbird*
rm -rf /usr/{lib,include,share/idl}/thunderbird-3.0a1

It's safer not to take the risk. Just run it in your home folder.

Tweak the Build

If I have to start afresh, I like Firefox to create the default profile with my bookmarks already there. To do this, copy ~/.mozilla/firefox/<random number>/bookmarks.html into the mozilla source, mozilla/browser/locales/en-US/profile/bookmarks.html then the next time you run the build script they'll be built in. If it causes a problem for cvs then delete the file and run the build script again, cvs will replace it.
Another file that's ripe for tweaking is mozilla/browser/app/profile/prefs.js which, when it becomes the prefs.js file in you profile, stores many imporant settings (font sizes and suchlike). Firefox is picky about the syntax of that file so it's probably best not to edit it directly. Alter it by entering about:config in Firefoxs addressbar, make the changes you want, close Firefox and then copy the prefs.js from your profile.

Building on non-x86 architectures

Most architectures seem to have flakey handling of the visibility pragma. If you encounter errors such as

undefined reference to `memcpy@@GLIBC_2.0'

you need to add the following to your .mozconfig

ac_cv_visibility_pragma=no
Note: See TracWiki for help on using the wiki.