firefox をソースからビルドする


rustのお膝元であるfirefoxをソースコードからビルドしてみました。
rustが使われているところの観賞用。もしかしたらデバッガ当ててみたり。

準備

Ubuntu 18.04を使用しています。
基本手順はここに書いてある通り。
https://developer.mozilla.org/ja/docs/Developer_Guide/Build_Instructions/Linux_Build_Prerequisites

mkdir firefox
cd firefox/
wget -q https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py -O bootstrap.py
python bootstrap.py

以下のように聞かれるので、1を選択しました。

Please choose the version of Firefox you want to build:
1. Firefox for Desktop Artifact Mode
2. Firefox for Desktop
3. Firefox for Android Artifact Mode
4. Firefox for Android
Your choice:

それ以外の質問にはYで回答しました。

ソースコードの入手

hg clone https://hg.mozilla.org/mozilla-central

ビルド

cd mozilla-central/
./mach bootstrap
./mach build

clangがubuntu 18.04 に入っているよりも新しいものが必要だったのですが、./mach bootstrap を実行することで自動で準備してくれました。

ビルドしたものを実行

./mach run

ビルドしてできたものは以下のディレクトリにあります。
obj-x86_64-pc-linux-gnu/dist/bin