building firefox 【linux】

先列出要需要网上下载文件/更新文件的命令,也就是下面要用到的:

 

sudo apt-get build-dep firefox sudo apt-get install mercurial libasound2-dev libcurl4-openssl-dev sudo apt-get install autoconf2.1 sudo apt-get install libdbus-glib-1-dev cd /opt && hg clone http://hg.mozilla.org/mozilla-central/ firefox-3.7

分别列为A,B,C,D,E.请分别按照次序运行之,当运行完某条命令后,提示不需要更新的时候,请忽略这条命令

 

若在A更新过程中,出现下面的错误:

不能满足软件包 firefox 所要求的构建依赖关系

请将 /etc/apt/sources.list 改为默认的源 也就是 装完系统后自带的:

#deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ - Release i386 (20090421.3)]/ jaunty main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://cn.archive.ubuntu.com/ubuntu/ jaunty main restricted deb-src http://cn.archive.ubuntu.com/ubuntu/ jaunty main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://cn.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted deb-src http://cn.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://cn.archive.ubuntu.com/ubuntu/ jaunty universe deb-src http://cn.archive.ubuntu.com/ubuntu/ jaunty universe deb http://cn.archive.ubuntu.com/ubuntu/ jaunty-updates universe deb-src http://cn.archive.ubuntu.com/ubuntu/ jaunty-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://cn.archive.ubuntu.com/ubuntu/ jaunty multiverse deb-src http://cn.archive.ubuntu.com/ubuntu/ jaunty multiverse deb http://cn.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse deb-src http://cn.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse ## Uncomment the following two lines to add software from the 'backports' ## repository. ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://cn.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu jaunty partner # deb-src http://archive.canonical.com/ubuntu jaunty partner deb http://security.ubuntu.com/ubuntu jaunty-security main restricted deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted deb http://security.ubuntu.com/ubuntu jaunty-security universe deb-src http://security.ubuntu.com/ubuntu jaunty-security universe deb http://security.ubuntu.com/ubuntu jaunty-security multiverse deb-src http://security.ubuntu.com/ubuntu jaunty-security multiverse

命令E会将给定的网站上的代码克隆到本地/opt/firefox-3.7,当然自动会创建firefox-3.7文件夹。注意这条命令会很慢。。

 

当一切顺利完成后开始编译准备过程!!

 

修改toolkit/toolkit-makefiles.sh[下面的命令都是基于 跟目录,也就是/opt/firefox-3.7]

找到MAKEFILES_plugin

 MAKEFILES_plugin=" modules/plugin/Makefile modules/plugin/base/src/Makefile modules/plugin/base/public/Makefile modules/plugin/default/mac/Makefile modules/plugin/default/unix/Makefile modules/plugin/default/windows/Makefile modules/plugin/sdk/Makefile modules/plugin/sdk/samples/Makefile modules/plugin/sdk/samples/common/Makefile modules/plugin/sdk/samples/basic/windows/Makefile modules/plugin/sdk/samples/winless/windows/Makefile modules/plugin/sdk/samples/npruntime/Makefile "

加入下面这行

modules/plugin/sdk/samples/npruntime/Makefile

为后面编写npruntime做准备,当然你若是不做插件可跳过此步骤~

修改browser/config/mozconfig

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@ ac_add_options --disable-tests ac_add_options --disable-javaxpcom ac_add_options --disable-necko-wifi ac_add_options --enable-application=browser mk_add_options MOZ_CO_PROJECT=browser

好开始编译

在根目录下运行

autoconf2.13

编译步骤

./configure --enable-application=browser make distclean make -f client.mk build

注意命令的顺序!!

注意:若无 --enable-选项,则会报错  

 

configure: error: --enable-application=APP was not specified and is required  

在上面的configure 或者make 过程中的出错处理

 

若是关于 automationutils.py的错误,忽略之

 

若是关于头文件找不到错误,如nptypes.h, npruntime.h

从modules/plugin/base/public拷贝找不到的头文件到dist/include

然后继续编译步骤

 

若出现库错误或者似乎环境变量设置问题,运行下面的命令更新下

apt-get install libnotify-dev

若出现

configure: error: Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora)); use --disable-necko-wifi to disable

则运行下面的命令更新下:

apt-get install libiw-dev

若出现

 

checking for GL/glx.h... no configure: error: Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))

根据提示装响应的库,如

 get mesa-common-dev

若出现

bin/sh:can not open ../build/autoconf/configure Configure :error:../build/autoconf/configure/ failed for js/src

先编译下面的子目录

cd js/src autoconf2.13 cd ../..

请在出错后按照上面处理后重新运行

./configure --enable-application=browser make distclean make -f client.mk build

 


最后,这行是成功消息:
config.status: creating include/Makefile config.status: creating include/ffi.h config.status: creating Makefile config.status: creating testsuite/Makefile config.status: creating man/Makefile config.status: creating libffi.pc config.status: creating fficonfig.h config.status: linking src/x86/ffitarget.h to include/ffitarget.h config.status: executing depfiles commands config.status: executing libtool commands config.status: executing include commands config.status: executing src commands config/autoconf.mk is unchanged

出现这些信息,并且尾部没有其他信息了,则表示编译成功了。编译成功后,一般这个文件

/opt/firefox-3.7/obj-i686-pc-linux-gnu/dist/bin/filefox

就是可执行目标了

 

整个编译时间大概1H...

 

你可能感兴趣的:(linux,ubuntu,Security,header,mercurial,firefox)