firefox 1.0.7 编译方法及步骤
post by glacier
根据 Mozilla 官方网站上的编译步骤操作总会遇到各种各样的错误提示,在虚拟机下反复尝试了多次才顺利编译通过。在 BLOG 上跟其他朋友分享一下,顺便备忘。(注:xfocus 的 blog 会过滤反斜杠,文中以全角符号“\”代替,复制批处理命令内容时需要替换回来)
1、准备工作
1) 依次安装 Visual C++ 6, Visual C++ Service Pack 5, Visual C++ Processor Pack。
2) 安装 cygwin 至 C 盘根目录,选择 DOS 风格(默认为 UNIX 风格)。除默认组件外,还应选择以下组件:
# ash -- UNIX-like command line interpreter shell
# autoconf -- Wrapper scripts for autoconf2.1 and autoconf2.5
# coreutils -- GNU core utilities (includes fileutils, sh-utils, and textutils)
# cvs -- Concurrent Version System
# diffutils -- file comparison utility
# findutils -- Utilities for finding files--find, xargs, locate, updatedb
# gawk -- pattern matching language (Devel category)
# gcc -- C compiler upgrade helper
# grep -- text search tool
# make -- dependency 易做图yzer for software builds (Devel category)
# patchutils -- a small collection of programs that operate on patch files
# perl -- a scripting language used to control parts of the build (Interpreters category)
# sed -- a search and replace language
# unzip -- zip file extraction (Archive category)
# zip -- zip file creation (Archive category)
3) 下载并解压 firefox-1.0.7-source.tar.bz2 至 C 盘根目录,解压后生成 c:\mozilla 目录。
4) 下载并解压 Netscapes wintools,在 buildtools 目录编写以下 BAT 文件,运行后生成 moztools 目录:
-------------- moztools.bat --------------
set MOZ_TOOLS=c:\mozilla\moztools
md %MOZ_TOOLS%
cd windows
install.bat
------------------ end -------------------
5) 编写 .mozconfig 文件保存至 c:\mozilla 目录:
--------------- .mozconfig ---------------
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff
ac_add_options --enable-optimize
ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --enable-static
ac_add_options --disable-shared
ac_add_options --enable-official-branding
------------------ end -------------------
6) 编写 mozbuild.bat 文件保存至 c:\mozilla 目录:
-------------- mozbuild.bat --------------
@echo off
set MOZ_TOOLS=c:\mozilla\moztools
set PATH=%PATH%;"C:\Program Files\Microsoft Visual Studio\VC98\Bin";c:\cygwin\bin;%MOZ_TOOLS%\bin
call VCVARS32.BAT
c:\cygwin\bin\make.exe -f client.mk build
------------------ end -------------------
7) 重命名 cygwin\bin\link.exe
2、编译
启动 cygwin 后运行以下命令
Administrator@win2kpro ~
$ cd c:
Administrator@win2kpro /cygdrive/c
$ cd mozilla/
Administrator@win2kpro /cygdrive/c/mozilla
$ ./mozbuild.bat
以下为编译时的部分输出结果:
Setting environment for using Microsoft Visual C++ tools.
Adding client.mk options from /cygdrive/c/mozilla/.mozconfig:
MOZ_PHOENIX=1
MOZ_OBJDIR=$(TOPSRCDIR)/ff
cd /cygdrive/c/mozilla/ff
/cygdrive/c/mozilla/configure
Adding configure options from /cygdrive/c/mozilla/.mozconfig:
--disable-ldap
--disable-mailnews
--enable-extensions=cookie,xml-rpc,xmlextras,pref,transformiix,universalchardet,webservices,inspector,gnomevfs,negotiateauth
--enable-crypto
--disable-composer
--enable-single-profile
--disable-profilesharing
--enable-optimize
--disable-debug
--disable-tests
--enable-static
--disable-shared
--enable-official-branding
--enable-ui-locale=zh-CN
loading cache ./config.cache
checking host system type... i686-pc-cygwin
checking target system type... i686-pc-cygwin
checking build system type... i686-pc-cygwin
checking for gcc... (cached) cl
checking whether the C compiler (cl ) works... yes
checking whether the C compiler (cl ) is a cross-compiler... no
checking whether we are using GNU C... (cached) no
checking whether cl accepts -g... (cached) no
checking for c++... (cached) cl
checking whether the C++ compiler (cl ) works... yes
checking whether the C++ compiler (cl ) is a cross-compiler... no
checking whether we are using GNU C++... (cached) no
checking whether cl accepts -g... (cached) no
checking for ranlib... (cached) ranlib
checking for ml... (cached) /cygdrive/c/PROGRA~1/MICROS~2/VC98/BIN/ml
checking for ar... (cached) ar
checking for ld... (cached) link
checking for strip... (cached) strip
checking for windres... (cached) windres
checking for gawk... (cached) gawk
checking for midl... (cached) midl
checking for midl flags... none needed
checking how to run the C preprocessor... cl
checking for mmintrin.h... (cached) no
checking how to run the C preprocessor... cl
checking how to run the C++ preprocessor... (cached) /lib/cpp
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking whether ln -s works... (cached) yes
checking for perl5... (cached) /usr/bin/perl
checking for minimum required perl version >= 5.004... 5.008007
checking for full perl installation... yes
checking for doxygen... (cached) :
checking for whoami... (cached) /usr/bin/whoami
checking for autoconf... (cached) /usr/bin/autoconf
checking for unzip... (cached) /usr/bin/unzip
checking for zip... (cached) /usr/bin/zip
checking for makedepend... no
checking for xargs... (cached) /usr/bin/xargs
checking for make... (cached) /usr/bin/make
checking for X... (cached) no
checking for 64-bit OS... no
checking for valid optimization flags... yes
creating ./config.status
creating config/autoconf.mk
creating config/doxygen.cfg
creating xpfe/global/buildconfig.html
creating toolkit/content/buildconfig.html
creating toolkit/components/passwordmgr/resources/content/contents.rdf
creating toolkit/mozapps/contents-content.rdf
creating gfx/gfx-config.h
gfx/gfx-config.h is unchanged
creating netwerk/necko-config.h
netwerk/necko-config.h is unchanged
creating xpcom/xpcom-config.h
xpcom/xpcom-config.h is unchanged
creating xpcom/xpcom-private.h
xpcom/xpcom-private.h is unchanged
configuring in nsprpub
running /bin/sh /cygdrive/c/mozilla/nsprpub/configure --disable-ldap --disable-mailnews --enable-extensions=cookie,xml-rpc,xmlextras,pref,transformiix,universalchardet,webservices,inspector,gnomevfs,negotiateauth --enable-crypto --disable-composer --enable-single-profile --disable-profilesharing --enable-optimize --disable-debug --disable-tests --enable-static --disable-shared --enable-official-branding --enable-ui-locale=zh-CN --with-dist-prefix=c:/mozilla/ff/dist --with-mozilla --cache-file=.././config.cache --srcdir=/cygdrive/c/mozilla/nsprpub
loading cache .././config.cache
checking host system type... i686-pc-cygwin
checking target system type... i686-pc-cygwin
checking build system type... i686-pc-cygwin
checking for cl... (cached) cl
creating ./config.status
creating Makefile
creating config/Makefile
creating config/autoconf.mk
creating config/nsprincl.mk
creating config/nsprincl.sh
creating config/nspr-config
creating lib/Makefile
补充:综合编程 , 安全编程 ,