Building Localised Seamonkey (and probably Firefox too)

Firefox (and Seamonkey) is one of the most-localised browser in the world. At present, it is offered in more than 70 languages.

Surprisingly, the information on how to build a localised version of Firefox from source is very thin - especially from a release-build version. This article documents my findings to build one for Seamonkey successfully (the instructions for Firefox is nearly identical - it is left as an exercise for the reader).

Overview

First, you need to be able to build Seamonkey successfully. There are many ways of doing it but the one that I find easy to follow is the one from Beyond Linux from Scratch (BLFS), linked below in the reference section below (it is at Seamonkey version 2.19 at the moment, but as it is a live copy from SVN it will be updated from time to time).

Once you're familiar with that, you need to adjust the build instruction slightly and then get the localisation tarball. This tarball will contain all the needed location information for your locale. It is imperative that you get the correct tarball or you will encounter significant grief later: there are many irrelevant and incorrect information of getting this tarball, especially for release-build version of Firefoxes and Seamonkeys.

Lastly, just before you build the final binary tarball, you need to modify the package manifest. Many (including the locale I'm using, en-GB), do not come with dictionaries than thus they need to be excluded from the packaging process.

The Steps: Building localised Seamonkey 2.19 for en-GB locale.

1. Get the release tarball.

Get it from here: http://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/2.19/source/seamonkey-2.19.source.tar.bz2

Notice the URL pattern, play with it to get other versions.

2. Get the locale tarball

This is a bit complicated. First, look in here: https://hg.mozilla.org/releases/l10n/mozilla-release/ and choose your locale (I choose en-GB). Clicking en-GB there will bring me to this page (obviously): https://hg.mozilla.org/releases/l10n/mozilla-release/en-GB/

Scroll down a bit to branches header, and just before it you will see three dots (meaning, show me more of these tags stuff ). Click it. For en-GB that will bring me to here: https://hg.mozilla.org/releases/l10n/mozilla-release/en-GB/tags

Now you've got a chockful of tags to choose. For me, I will choose the tag SEAMONKEY_2_19_RELEASE because that's the Seamonkey version I'm going to build. Clicking on that tag will bring me to here: https://hg.mozilla.org/releases/l10n/mozilla-release/en-GB/rev/41ddbe5f4e8f

On this page, near the top, click the "bz2" header (the URL of that link for me is https://hg.mozilla.org/releases/l10n/mozilla-release/en-GB/archive/41ddbe5f4e8f.tar.bz2 . That will prompt you to download a bzip2 tarball, and that's the tarball you need.

3. Extract seamonkey tarball

Now extract the seamonkey tarball. You can extract it anywhere with enough disk space in it (the build process will end up using 1.4 GB of disk space for both source and building - not including temporary disk space it may consume). When you're done extracting, there will be a comm-release directory in it. Now cd to that directory.

4. Extract locale tarball

Inside the comm-release directory, extract the locale tarball. You will get a directory named with the locale folllowed by some number (e.g. en-GB-41ddbe5f4e8f), so rename it to the locale only (en-GB in this example).

5. Create mozconfig file

Inside that comm-release directory, create a file named mozconfig with the following contents. Adjust the parameters as you need, if you want to see the meaning of these parameters (or see other options), just run ./configure --help from inside comm-release.

# If you have a multicore machine you can speed up the build by running
# several jobs at once, but if you have a single core, delete this line:
mk_add_options MOZ_MAKE_FLAGS="-j$(getconf _NPROCESSORS_ONLN)"

# If you have installed Yasm delete this option:
ac_add_options --disable-webm

# If you have installed DBus-Glib delete this option:
ac_add_options --disable-dbus

# If you have installed wireless-tools delete this option:
ac_add_options --disable-necko-wifi

# If you have installed libnotify delete this option:
ac_add_options --disable-libnotify

# Uncomment these if you have installed them:
# ac_add_options --enable-startup-notification
# ac_add_options --enable-system-hunspell
# ac_add_options --enable-system-sqlite
# ac_add_options --with-system-libevent
# ac_add_options --with-system-libvpx
# ac_add_options --with-system-nspr
# ac_add_options --with-system-nss

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/moz-build-dir
ac_add_options --disable-crashreporter
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-installer
ac_add_options --disable-static
ac_add_options --disable-tests
ac_add_options --disable-updater
ac_add_options --enable-application=suite
ac_add_options --enable-shared
ac_add_options --enable-system-ffi
ac_add_options --prefix=/usr
ac_add_options --with-pthreads
ac_add_options --with-system-jpeg
ac_add_options --with-system-png
ac_add_options --with-system-zlib
ac_add_options --with-l10n-base=..
ac_add_options --enable-ui-locale=en-GB
Sample mozconfig file from BLFS, with locale adjustment

Pay attention to the last two lines and the MOZ_OBJDIR.

  1. MOZ_OBJ_DIR says that the build directory (where your object files and final binaries will be located) will be in a directory named moz-build-dir inside the @TOPSRCDIR@, which is comm-release. That directory doesn't exist yet, but don't worry Mozilla build system will create that for you.

  2. --with-l10n-base defines there your localisation files will be located. It should point at the directory that contains the directories of your localisation files, and since you expanded it inside comm-release, it should point to comm-release. But here's another thing - you can also specify this directory relative from your MOZ_OBJ_DIR directory, and since comm-release is the parent of moz-build-dir, we can also specify .. (two dots) there.

  3. --enable-ui-locale - no explanation needed, obvious enough.

6. Build

To build Seamonkey, launch make -f client.mk from the comm-release directory. Go out, exercise, have coffe, or whatever, it will take hours to build (around 2 hours on my x86_64, and 15 hours on my ARM).

7. Package

When the build is finished, you need to package it. Before you package it, you need to edit the package-manifest file (the file that determines what goes inside the package). Many locales (including en-GB) do not have dictionaries, so let's exclude them from now; otherwise the package will fail to build.

Edit comm-release/moz-build-dir/suite/installer/package-manifest; find bin/dict/* entry, and comment it out by putting a semicolon in front of it.

Then you can build your installer (launching it from comm-release directory) by typing make -C moz-build-dir/suite/installer.

When the build process finishes, your shiny new browser will be located here: moz-build-dir/mozilla/dist, with name like seamonkey-2.19.en-GB.*.tar.bz2 (name varies according to platform). Just extract this binary tarball to /usr/lib/seamonkey and them symlink /usr/lib/seamonkey/seamonkey to /usr/bin and your new localised browser is good to go.

References: