Building Firefox on Mac OS X 10.7 Lion

A couple of changes needed at the time of writing from the usual build requirements.

  1. If you haven’t done it already, MacPorts and all ports must be completely uninstalled and then re-installed to support the new operating system.
  2. The glib1 port must be installed using MacPorts. It provides the glib-config script, which raises an error if missing.
  3. The grep port must be installed. This works around a bug in the shipped version of egrep. Details in bug 655339.
  4. The patch from bug 673789 needs to be applied to get around a file missing in Lion. Save it to disk and then execute hg patch --no-commit /path/to/patch from your source directory. (Trying to use the URL directly in hg results in an error, at least for me.)

So, in short:

sudo port selfupdate
sudo port install libidl autoconf213 yasm glib1 grep mercurial wget
wget --no-check-certificate "https://bugzilla.mozilla.org/attachment.cgi?id=548028&action=diff&context=patch&collapsed=&headers=1&format=raw" -O ~/minidump_generator.diff
#if you haven't already got a working copy:
hg clone http://hg.mozilla.org/mozilla-central/ ~/mozilla-central
cd ~/mozilla-central
hg pull
hg update
hg patch --no-commit ~/minidump_generator.diff
make -f client.mk build

My mozconfig looks like this:

. $topsrcdir/browser/config/mozconfig

CC="gcc-4.2 -arch x86_64"
CXX="g++-4.2 -arch x86_64"
HOST_CC="gcc-4.2"
HOST_CXX="g++-4.2"
CFLAGS=-Qunused-arguments
CPPFLAGS=-Qunused-arguments
RANLIB=ranlib
AR=ar
AS=$CC
LD=ld
STRIP="strip -x -S"

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg
mk_add_options MOZ_MAKE_FLAGS="-s -j8"
mk_add_options AUTOCONF=autoconf213

ac_add_options --disable-debug
ac_add_options --enable-optimize
ac_add_options --disable-tests
ac_add_options --enable-application=browser
ac_add_options --disable-installer
ac_add_options --enable-official-branding
ac_add_options --enable-crashreporter

ac_add_options --target=x86_64-apple-darwin11.0.0
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.7.sdk
ac_add_options --enable-macos-target=10.7