smellman's Broken Diary

クソみたいなもんです

Minefieldのビルド環境作ったよ @ MacOSX Snow Leopard

そろそろ作らないとやばいと思って作成しました。
手順としてはこんな感じ。
Xcodeの最新版(iPhone Developer KitでもOK)をインストールしてから、MacPortsで必要なライブラリを揃える。

$ sudo port install mercurial libidl autoconf213

次に作業用ディレクトリを掘ります。

$ mkdir -p develop/mozilla
$ cd develop/mozilla

mercurialでソースを落とすんですが、trunkなのかわけがわからなくなるので、mozilla-centralという名前のディレクトリに落とします。

$ hg clone http://hg.mozilla.org/mozilla-central/ mozilla-central

あとは.mozconfigの作成ですが、僕の場合Minefieldのみビルドするわけじゃないので、.mozconfigではなく別の名前にします。

$ vim mozconfig-mozilla-central
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../build-mozilla-central
mk_add_options MOZ_MAKE_FLAGS="-s -j4"
ac_add_options --enable-debug
ac_add_options --disable-optimize
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
CC="gcc-4.2 -arch i386"
CXX="g++-4.2 -arch i386"
ac_add_options --target=i386-apple-darwin8.0.0
ac_add_options --enable-macos-target=10.5
# bug 491774. crashreporter won't build in cross compile
ac_add_options --disable-crashreporter

HOST_CC="gcc-4.2"
HOST_CXX="g++-4.2"
RANLIB=ranlib
AR=ar
AS=$CC
LD=ld
STRIP="strip -x -S"
CROSS_COMPILE=1

あとは、ビルドを行います。

$ cd mozilla-central
$ export MOZCONFIG=../mozconfig-mozilla-central
$ make -f client.mk build

これでビルド完了。
ビルド後に気をつけたいのが、プロファイルマネージャーとかを動かすときに、 dist/MinefieldDebug.app/Contents/MacOS/firefox を叩くとだめ。 firefox-bin の方を叩いてください。詳細は Bug 513747 - [10.6] SQLite incompatibility causes crashes on Snow Leopard (Mac OS X 10.6) を参考の事。
ちなみに、加速度センサーの実装はちゃんと動きました。うれしい!!!