阅读:49621回复:19
如何自己编译firefox
准备编译环境,需要安装 cygwin的unix模拟环境,下载cygwin,在default安装之外,需要选择安装如下包:
* cvs * cygutils * make * patch * patchutils * perl * unzip * zip 如果你不是通过CVS下载代码,cvs可以不装,不过考虑到必须通过cvs下载locals文件,还是装了吧。 如果使用微软编译器(官方发布的就是使用微软编译器) ,建议用VC 6 + SP5 + Visual C++ Processor Pack. 如果使用vc7和.net编译器,还要做一些设定,此处暂时不讲。安装vc6的时候,建议让它去设置自己的环境变量,后面会比较方便。 也可以使用cygwin自带的编译器(或者mingw的,也是cygwin使用的gcc fore windows),但是编译出来的程序比vc编译的要大,效率可能也要低一些.至少要安装: * gcc-core * gcc-g++ * binutils * w32api * mingw-runtime 准备环境变量设置脚本 mozset.bat (目录位置自行根据情况修订) @echo off set MOZ_TOOLS=c:\mozilla\moztools set PATH=c:\mozilla\mingw\bin;c:\mozilla\cygwin\bin;%MOZ_TOOLS%\bin;%PATH set HOME=c:\mozilla set CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot 安装netscape的wintools,下载: http://ftp.mozilla.org/pub/mozilla.org/ ... ntools.zip 安装 set MOZ_TOOLS=c:\mozilla\moztools mkdir c:\mozilla\moztools cd buildtools\windows install.bat 建议做头文件格式转换 d2u在cygwin/bin下面 cd c:\mozilla\moztools\include\ d2u.exe *.h cd libIDL\ d2u.exe *.h 下载firefox 1.0的源码 ,在www.mozilla.org上可以找到 设置编译环境 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 ac_add_options --enable-ui-locale=zh-CN 指定编译mozilla里面的browser firefox ,加载默认编译选项,后面的都是官方编译选项,可以自行加入进行优化,优化说明参见官方网站说明 指定编译好以后的程序放在 mozilla/ff目录中 最后一行指定编译简体中文界面(但是要先下载相应的locles文件) 如果是使用cygwin的编译器还需要加入这两个编译选项禁用特性 ac_add_options --disable-activex ac_add_options --disable-accessibility 另外,如果没有装vc6 ,还需要修改 mozilla/config/static-config.mk,去掉urlmon STATIC_EXTRA_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 Urlmon version winspool) 改为: STATIC_EXTRA_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool) 如果没有修改上面的几个地方,用gcc for windows无法编译通过firefox 进入windows的cmd窗口 运行 mozset.bat 进入 firefox源码目录, 编译 make -f client.mk build 我在制作redfox 1.0b版本的时候使用了madfox的补丁,你也可以不使用这个patch madfox patch的文件如下: ---- patching file mozilla/browser/app/firefox.exe.manifest patching file mozilla/browser/app/macbuild/Contents/Info.plist.in patching file mozilla/browser/app/Makefile.in patching file mozilla/browser/installer/unix/installer.cfg patching file mozilla/browser/installer/unix/packages-static patching file mozilla/browser/locales/en-US/chrome/browser/aboutDialog.dtd patching file mozilla/browser/locales/en-US/chrome/browser/browser.dtd patching file mozilla/browser/locales/en-US/chrome/browser-region/region.properties patching file mozilla/browser/locales/en-US/chrome/global/brand.dtd patching file mozilla/browser/locales/en-US/chrome/global/brand.properties patching file mozilla/configure patching file mozilla/content/base/src/nsFrameLoader.cpp patching file mozilla/content/base/src/nsParserUtils.cpp patching file mozilla/content/html/document/src/nsHTMLContentSink.cpp patching file mozilla/docshell/base/nsDocShell.cpp patching file mozilla/docshell/base/nsDocShell.h patching file mozilla/docshell/base/nsIDocShellTreeItem.idl patching file mozilla/dom/src/base/nsGlobalWindow.cpp patching file mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp patching file mozilla/htmlparser/public/nsHTMLTagList.h patching file mozilla/htmlparser/src/nsElementTable.cpp patching file mozilla/htmlparser/src/nsHTMLTags.cpp patching file mozilla/js/src/jsdate.c patching file mozilla/layout/html/document/src/Makefile.in patching file mozilla/layout/html/document/src/quirk.css patching file mozilla/layout/html/document/src/xbl-xmldataisland/Makefile.in patching file mozilla/layout/html/document/src/xbl-xmldataisland/resources/content/contents.rdf patching file mozilla/layout/html/document/src/xbl-xmldataisland/resources/content/xbl-xmldataisland.xml patching file mozilla/layout/html/document/src/xbl-xmldataisland/resources/jar.mn patching file mozilla/layout/html/document/src/xbl-xmldataisland/resources/Makefile.in patching file mozilla/netwerk/streamconv/converters/nsUnknownDecoder.cpp patching file mozilla/uriloader/base/nsURILoader.cpp ---- $ patch -p0 < new-madfox-patch.0.2.diff patching file mozilla/browser/locales/en-US/chrome/browser/aboutDialog.dtd patching file mozilla/content/base/src/nsFrameLoader.cpp patching file mozilla/content/base/src/nsParserUtils.cpp patching file mozilla/content/html/document/src/nsHTMLContentSink.cpp patching file mozilla/docshell/base/nsDocShell.cpp patching file mozilla/docshell/base/nsDocShell.h patching file mozilla/docshell/base/nsIDocShellTreeItem.idl patching file mozilla/dom/src/base/nsGlobalWindow.cpp patching file mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp patching file mozilla/htmlparser/public/nsHTMLTagList.h patching file mozilla/htmlparser/src/nsElementTable.cpp patching file mozilla/htmlparser/src/nsHTMLTags.cpp patching file mozilla/js/src/jsdate.c patching file mozilla/layout/html/document/src/Makefile.in patching file mozilla/layout/html/document/src/quirk.css patching file mozilla/layout/html/document/src/xbl-xmldataisland/Makefile.in patching file mozilla/layout/html/document/src/xbl-xmldataisland/resources/conte nt/contents.rdf patching file mozilla/layout/html/document/src/xbl-xmldataisland/resources/conte nt/xbl-xmldataisland.xml patching file mozilla/layout/html/document/src/xbl-xmldataisland/resources/jar.m n patching file mozilla/layout/html/document/src/xbl-xmldataisland/resources/Makef ile.in patching file mozilla/netwerk/streamconv/converters/nsUnknownDecoder.cpp patching file mozilla/uriloader/base/nsURILoader.cpp ------ 如何编译本地化(例如简体中文)的版本 下载firefox 1.0的UI local文件,默认源码包中没有,只能通过cvs下载 export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot Firefox 1.0 source is not on the main CVS "trunk" but rather from a branch, named AVIARY_1_0_20040515_BRANCH. In order to check out the locale files from this branch, you must use the -r flag with CVS: cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/l10n checkout -rAVIARY_1_0_20040515_BRANCH mozilla 另外一种方式,安装Locale switcher extension,然后在下面安装指定的xpi文件,但这种方法无法编译为中文安装界面(好在我们可以自己写nsis脚本) http://ftp.mozilla.org/pub/mozilla.org/ ... ndows-xpi/ 编译安装包 For Firefox 0.9 and later, you first need to build a static build. Then do cd mozilla/browser/installer and then make installer. The installer bits will be found at mozilla/dist/install/FirefoxSetup.exe. 打包成zip make -C C:/mozilla/mozilla/XXXX编译目录/browser/installer |
|
|