准备工作:
先准备好需要compile的依赖包。
If you're running a Debian- or Ubuntu-derived system, you may be able to use apt-get build-dep firefox
OR apt-get build-dep iceweasel
and sudo apt-get install libdbus-glib-1-dev curl
to pull in most of the prerequisites. The libcurl-dev
package is also needed if you're building the crashreporter (on Ubuntu it's provided by either libcurl4-openssl-dev
or libcurl4-gnutls-dev
). Alternatively you can disable the crashreporter (option "--disable-crashreporter").
这里写的好多,有的可能已经装了,有的可能没有装,按情况sudo apt-get install , 最好是上面提到的包,如果下面make的时候提示Error, 把-dev的包都装上。
sudo apt-get install build-essential
sudo apt-get install pkg-config fontconfig autoconf2.13
先下载firefox源代码
http://hg.mozilla.org/mozilla-central
选定一个你想下载的版本,下载到本地。
tar -xjvf xxxx.tar.bz2 #xxxx为你下载的firefox src包文件名
cd xxxx
配置一下自己的编译参数
vi .mozconfig
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-opt
mk_add_options AUTOCONF=autoconf2.13
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-installer
ac_add_options --disable-xprint
ac_add_options --disable-crashreporter
ac_add_options --disable-mochitest
ac_add_options --disable-mailnews
ac_add_options --disable-javaxpcom
ac_add_options --enable-xft
ac_add_options --enable-default-toolkit=cairo-gtk2
ac_add_options --enable-optimize="-O2 -g -pipe -march=i686"
看情况,作加减,不熟悉的不要加。
ac_add_options --enable-optimize="-O2 -g -pipe -march=i686"
这行,特别根据系统和cpu做优化。
开始编译:
$ make -f client.mk build
漫长的等待,我的机器大概等了40分钟左右。E2180的cpu.
编译完了,打发布包:
$cd ff-opt
$make package
这会在ff-opt目录的dist下生成一个firefox-3.1b2pre.en-US.linux-i686.tar.bz2,这是个免install的包。
运行:
解决上面那个包到哪个目录,如
$tar -xjvf firefox-3.1b2pre.en-US.linux-i686.tar.bz2 -C /usr/local/firefox/nightly
$/usr/local/firefox/nightly/firefox/firefox
就可以运行了。
为了不和原来的firefox3.0.3冲突,请先准备好两个Profile, 名字如nightly 然后使用
$/usr/local/firefox/nightly/firefox/firefox -P nightly
firefox --help
firefox -ProfileManager 创建profile
如果想用原来的的plugins和配置,创建完profile后,直接cp ,下面是我的,cp那行使用你们本机的名字。那是个随机的。
$cd ~/.mozilla/firefox
$cp -av pztu7ehb.default v224c2kl.nightly
看http://developer.mozilla.org/en/Build_Documentation ,这里有英文的详细步骤。
http://developer.mozilla.org/en/mozilla-central