Firefox

From Halfface
Revision as of 14:05, 24 September 2007 by 217.10.60.85 (talk)
Jump to navigation Jump to search

Prepare the machine for build.

yum groupinstall "Development Tools"

Download source code of firefox.

Unpack the source code.

tar jxf firefox-2.0.0.7-source.tar.bz2

In the top level of the source tree, create a .mozconfig file, containing your compiler options. Here's a basic configuration that works for me:

. $topsrcdir/browser/config/mozconfig
ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --enable-default-toolkit=gtk2
ac_add_options --enable-xft
ac_add_options --enable-official-branding
ac_add_options --enable-xinerama
mk_add_options MOZ_CO_PROJECT=browser

To get a working build identifier when writing about: in the url. Set the following variables.

  • Build identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.7) Gecko/2007092414 Firefox/2.0.0.7
setenv MOZILLA_OFFICIAL 1
setenv BUILD_OFFICIAL 1

Start compiling.

make -f client.mk build

Now to package the result. Firefox provides a special make command to create an installer archive. With the example .mozconfig file, a small hack is needed. Open browser/installer/Makefile in your editor and find this section:

ifdef BUILD_STATIC_LIBS
ifeq (WINNT,$(OS_ARCH))
MOZ_PKG_MANIFEST_P = $(srcdir)/windows/packages-static
else
ifneq (,$(filter-out OS2 Darwin,$(OS_ARCH)))
MOZ_PKG_MANIFEST_P = $(srcdir)/unix/packages-static
endif
endif
else
$(error you need a "--enable-static --disable-shared" build to create an installer)
endif

Delete the two lines so it looks like this:

ifdef BUILD_STATIC_LIBS
ifeq (WINNT,$(OS_ARCH))
MOZ_PKG_MANIFEST_P = $(srcdir)/windows/packages-static
else
ifneq (,$(filter-out OS2 Darwin,$(OS_ARCH)))
MOZ_PKG_MANIFEST_P = $(srcdir)/unix/packages-static
endif
endif
endif

Create firefox tar.gz in dist directory (dist/firefox-2.0.0.7.en-US.linux-x86_64.tar.gz).

make -C browser/installer

Unpack this file in /usr/lib64 and rename the firefox directory to firefox-2.0.0.7

cd /usr/lib64
tar zxf firefox-2.0.0.7.en-US.linux-x86_64.tar.gz
mv firfox firefox-2.0.0.7

Now create a copy of /usr/bin/firefox called /usr/bin/firefox.2 and change to 2 paths to point to /usr/lib64/firefox-2.0.0.7

  • before
if [ -x "/usr/lib64/firefox-1.5.0.10/firefox-bin" ]
then
  MOZ_LIB_DIR="/usr/lib64"
fi
MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox-1.5.0.10"
  • after
if [ -x "/usr/lib64/firefox-2.0.0.7/firefox-bin" ]
then
  MOZ_LIB_DIR="/usr/lib64"
fi
MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox-2.0.0.7"

Start the application and verify it works.

firefox.2