13 July 2010

Firefox 3.6 with pretty fonts in Debian Squeeze

[Update 2011-06-25: You should consider this post obsolete. See this post for more info.] 

Iceweasel 3.6 has yet to trickle down to Debian Testing and very well may not make it before the freeze. However, some of us would like to have some 3.6iness in spite of this. If you've tried downloading SwiftFox, IceCat or the Firefox 3.6 binaries, you know that you get a 3.6, but the font rendering looks poopy.

Here's what I did to compile FF 3.6 from sources and get the same smooth font rendering that you get with Iceweasel 3.5 from the Squeeze repo. I'm not an expert, but this seems to have worked.

The following is based mostly on Mozilla's documentation on a Simple Firefox Build and Linux Prerequisites.

First, create a working directory. I called mine firefox-mercurial. The reason for the name will become obvious shortly.

Next, get the tools you need to build stuff. Since there's no firefox package in the Debian repos, I used (as root):

# apt-get build-dep iceweasel

Then install a bunch of other stuff that is supposedly needed:

# apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm

You will also have to add:

# apt-get install libidl-dev

This isn't documented anywhere that I know of. I found this out the hard way after my first attempts to compile failed.

Get sources
With a regular user terminal open in firefox-mercurial, use mercurial to get the sources:

hg clone http://hg.mozilla.org/releases/mozilla-1.9.2/ 192src

This will get you the latest, most update, bleeding edge version of 3.6--which may or may not be the same as the release version. For example, at the time of this writing, the latest version is 3.6.8pre and the latest release is 3.6.6. To specify the exact version you want, use #{tag}, where {tag} is  one of tags listed at http://hg.mozilla.org/releases/mozilla-1.9.2/. For example, to get and build FF 3.6.6:

hg clone http://hg.mozilla.org/releases/mozilla-1.9.2/#FIREFOX_3_6_6_RELEASE 192src

Getting the sources will take a long time, but not nearly as long as compiling will later on.

Next we need to move into the 192src directory and set up the mozconfig file that tells the system how to build firefox:

cd 192src
echo '. $topsrcdir/browser/config/mozconfig' > mozconfig
echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-release' >> mozconfig
echo 'mk_add_options MOZ_MAKE_FLAGS="-j4"' >> mozconfig
echo 'ac_add_options --disable-debug' >> mozconfig
echo 'ac_add_options --disable-tests' >> mozconfig
echo 'ac_add_options --enable-optimize' >> mozconfig
echo 'ac_add_options --enable-system-cairo' >> mozconfig

The objdir-ff-release is the name of the directory that built stuff will end up in. You can change this name if you want. The line with --enable-optimize is optional. The last option above, --enable-system-cairo, I found looking through the list of available options, and I'm pretty sure it's what gives you nice font rendering in GTK+ environments.

Build the beast with

make -f client.mk

The build will take forever. Once the compile is done, the binaries will be in
Execute the file firefox to make it go.

When you make it go, you'll notice that the app is identified by its code name, Namoroka.

I have not yet tried this, but according to Mozilla's documentation, to build a new version you'll need to update the sources with

hg pull -r default
hg update

I suspect you do this in the 192src directory and I suspect you'll need to rebuild as above afterward. Also, I suspect that in place of default above you'll want to use a valid tag (as when you first cloned the sources), but until I actually update I won't be able to say for sure.

Extra credit
Once I've done some more testing, I will be move the built files to /opt/firefox and add a *.desktop entry for it. The big question is whether I should call it 'Firefox' or 'Namoroka'.

No comments: