免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1715 | 回复: 0
打印 上一主题 下一主题

firefox源代码编译 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-26 19:47 |只看该作者 |倒序浏览
Windows平台的构建前提条件——firefox源代码编译
写篇文章总结一下
我编译的环境 : 
1. VC6 + sp5 
2. firefox 编译需要的辅助工具 wintools.zip 
3. cygwin 环境 
准备工作 : 
1. 下载 firefox 程序代码,在 mozilla 的站点上可以下载到,我编译的是 firefox 1.5.0.6 版本。
2. 下载编译需要的 wintools.zip 工具 ,1.73MB 大小 , 其中带有 glib 和 libidl 库 , 在下载解压缩后 , 建立一个环境变量 MOZ_TOOLS 到某个目录 , 然后进入解压缩后的 windows 目录 , 运行 install.bat 文件 , 安装相关需要的文件 . 
3. 安装 cygwin 环境 , 一个 window 下的类 unix 平台 , 这里需要注意的是 , 最新的 cygwin 中 , 安装的 make 版本是 3.81 的 , 而编译 firefox 需要的是 3.80 版本的 make, 解决的方法是到 cygwin 的某个 ftp 镜像站点上去下一个 3.80 版本的文件 , 安装到 cygwin 安装目录下的 /bin 目录下就可以了 . 
其中编译 firefox 需要的基本工具 
ash -- UNIX-like command line interpreter shell (Base category) 
coreutils -- GNU core utilities (includes fileutils, install, sh-utils, and textutils) (Base category) 
cvs -- concurrent versions system (Devel category) 
diffutils -- file comparison utility (Base category) 
findutils (Base category) 
gawk -- pattern matching language (Base and Interpretors categories) 
grep -- text search tool (Base category) 
libiconv -- character set conversion (Devel category) 
make 3.80 (not 3.81!) -- dependency analyzer for software builds (Devel category) 
patchutils -- a small collection of programs that operate on patch files (Devel category) 
perl -- a scripting language used to control parts of the build (Interpreters category) 
sed -- a search and replace language (Base category) 
unzip -- zip file extraction (Archive category) 
zip -- zip file creation (Archive category) 
可以在 cygwin 命令窗口中输入相关命令检测是否安装了相关的程序 ., 其实如果下载了 firefxo 源代码的话 , 象 cvs 中的都不是必须的 . 
4. 安装 vc6 + sp5, 编译 firefox 1.5.0.6, 推荐的是 vc6 的 cpp 编译器 . 在 vs6 安装后 , 会自动设置相关的 path,include 和 lib 环境变量 . 有一个需要注意的是 , vc6 的 link.exe 和 cygwin 中的 link.exe 是相同的名字 , 为了避免在编译的时候 , 调用错误的 link 执行文件 , 可以把 cygwin/bin 中的 link.exe 改名为 glink.exe 避免冲突 . Vs 的 sp5 补丁也需要打一下 , 否则 , 生成的 xpldl.exe(firefox 用来编译 idl 文件的工具 ) 在编译 idl 过程中会报错 . 
5. 配置文件 
在环境和编译工具准备好后 , 解压缩 firefox 的代码 , 然后在 firefox 代码目录的 mozilla 目录下 , 建立一个名为 .mozconfig 的文件 , 并在其中编辑文本 
. $topsrcdir/browser/config/mozconfig 
ac_add_options --enable-optimize 
ac_add_options --disable-debug 
ac_add_options --enable-static 
ac_add_options --disable-shared 
ac_add_options --disable-test 
开工 
上面所有工作完成之后 , 启动 cygwin 命令窗口 , 进入 firefox 代码的 mozilla 目录 
输入 make –f client.mk build 命令开始编译 , 一切顺利的话 , 几十分钟后 , 就会有一个 firefox 的执行文件生成到 mozilla/dist/bin 目录下 . 
需要注意的是 , 在生成一个 test 的模块的时候 , 会报一个 jsint 类型未定义 , 这个无关紧要 , 因为 firefox 已经生成了 , 这是一个测试模块 , 我的解决方法是 , 打开那个出错的cpp文件,加入 
#ifdef _MSCVER 
typedef int int32; 
#endif 
然后再编译就可以了 , 所谓自动动手 , 丰衣足食 , 有的时候 , 实在不行的话 , 需要把 firefox 的代码自己动手改一下 .
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/28528/showart_1667897.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP