How to compile Firefox source code

Source: Internet
Author: User

The following is an excerpt from:
Http://zhidao.baidu.com/question/33214960.html

Source code compilation install Firefox (Linux) http://forums.mozine.cn/index.php? Showtopic = 601

How to compile Mozilla source code http://www.firefox.net.cn/newforum/viewtopic.php in windows? P = 12810

How to compile Mozilla/Firefox in Windows
ZZ from Lotus roots.bokee.com

Mozilla/Firefox (the latest version is Firefox 2.0 RC3, and the stable version is firefox1.5.0.7) is well known. This time, I need to use some of the content, you have to compile it from the source code. Of course, I am not likely to use Linux for compilation, so I am using the win2003 system.
1. First, find information on the Internet and find that compiling it is not so easy. Many people have encountered many problems. It is worth reading the following several pages: Official pages on Compilation: http://developer.mozilla.org/en/docs/build_documentation.pdf pages using vs2005compiled Mozilla (Firefox): http://cs.senecac.on.ca /~ David. Humphrey/writing/firefox-win32-build.html; a clearer description of vs2005 compiled pages: http://zenit.senecac.on.ca/wiki/index.php/Assignment_1_ (pstdenis );
2. Prepare the compilation tool. There are many tools to be prepared, including vs2005, cygwin, NSIs, and development tools. First, go to any site to download the free version of vs2005, and the second item is: Success.
3. Install the compilation tool. There is nothing to say about installing vs2005 (the main installation is VC ++). The only point is: to facilitate future configuration, we recommend that you use the default directory for installation. NSIs installation is also easy. Be sure to use the full installation option. Do not miss anything. Unzip tools is just a compressed package, which can be decompressed and put into a directory. Cygwin installation is a troublesome task, because you download only a client, you need to run it, and then upgrade (install) the features you need online, be sure to select a fast server (If your network is slow, I suggest you do not compile Mozilla ). During installation, You need to select the following packages:
* Ash
* Diffutils
* Fileutils
* Findutils
* Gawk
* Grep
* SED
* Sh-utils
* Textutils
These are installed by default. You also need to install the following packages:
* Coreutils
* CVS
* Cygutils
* Libiconv
* Make
* Patch
* Patchutils
* Perl
* Unzip
* Zip
Any version is acceptable. Of course, this is just a luxury. The current Mozilla source code only supports the make program of version 3.80, but it is not possible to install make 3.80 from cygwin, because the minimum version is version 3.81. Therefore, you need to download a make 3.80 version below: Release.
4. configuration. A total of two parts need to be configured. One is the path of various tools, and the other is the compile config file necessary for compilation. To start configuration, we need to set a directory to save the Mozilla source file. The recommended method is as follows: a) create a directory: C:/proj; B) create a directory: C:/proj/Mozilla; c) Save the development tools tool to C: /proj/development tools; d) install cygwin in the C:/proj/cygwin directory. Of course, this is not necessary. Therefore, the first configuration can be implemented using the following configuration file:
@ Echo off

Rem --- CVS setup
Set cvsroot =: pserver: anonymous@cvs-mirror.mozilla.org:/cvsroot
Set cvs_rsh = SSH

Rem --- paths of Alibaba tools
Set pai_tools = C:/proj/release tools
Set glib_prefix = % cmd_tools %
Set libidl_prefix = % __tools %

Rem --- path of window
Set include =
Set Lib =
Set Path = C:/; C:/Windows/system32; C:/Windows/system32/WBEM

Rem --- path of cygwin
Set Path = C:/proj/cygwin/bin; % PATH %

Rem --- path of vc8 (VS 2005)
Call "C:/program files/Microsoft Visual Studio 8/VC/vcvarsall. Bat" x86

Rem --- path of runtime tools/glib and/libidl
Set Path = % PATH %; % glib_prefix %/bin
Set include = % glib_prefix %/include; % include %
Set Lib = % glib_prefix %/LIB; % lib %

Rem --- runtime tools comes last after glib/libidl
Set Path = % PATH %; % pai_tools %/bin

Rem --- path of NSIs
Set NSIs = C:/NSIs
Set Path = % PATH %; % NSIs %
Save the text as a bat file, such as buildsetup. bat. We recommend that you save it to the C:/proj directory.
The processing in the second part is somewhat characteristic. Now we need to create a name for the following content: ". do not try to create this file directly, because window will tell you that you must type the file name! Enter the following content in notepad and save it as ". Configure config:
# Building Firefox trunk with debugging
. $ Topsrcdir/Browser/config/configure config

# Put all OBJ files in one place, not in SRC tree
Mk_add_options export _objdir = @ topsrcdir @/Firefox-objdir
Ac_add_options -- disable-static
Ac_add_options -- enable-shared

# Debug build setup options
Ac_add_options -- disable-optimize
Ac_add_options -- enable-Debug

# I'm using canvas for my work
Ac_add_options -- enable-canvas

# I disabled the installer
Ac_add_options -- disable-Installer
This file must be saved to the created C:/proj/Mozilla directory.
5. Start to download the source file. You do not need to download the source file. You can go to ftp.mozilla.org to download the latest code, save it to Mozilla, and perform step 4. However, please note that I have downloaded four source codes (SeaMonkey, Mozilla, and Firefox), but none of them can be compiled, not to mention the code compilation error if there are fewer files. Anyway, I suggest you use the following method to directly download the source code from CVS to Mozilla (because it is not compressed, the size of the Code is around MB, the compressed code is usually about 30 mb ).
A) first enter the C:/proj directory and execute buildsetup. bat. The following is the screen operation process:
C:/Documents and Settings/Administrator> C:
C:/> Cd proj
C:/proj> buildsetup. bat
Setting environment for using Microsoft Visual Studio 2005x86 tools.
C:/proj>
B) then download the CVS configuration file, which is displayed on the screen below:
C:/proj> CVS Login
Logging in to: pserver: anonymous@cvs-mirror.mozilla.org: 2401/cvsroot
CVS password:
C:/proj> CVS Co Mozilla/Browser/config Mozilla/client. mk
CVS checkout: updating Mozilla/Browser/config
C:/proj>
Note that the input password is anonymous.
C) Go To The Mozilla directory, and then start a long download of the source file, a word: wait:

C:/proj/Mozilla> make-F client. mk checkout
6. Everything is ready. Now it is time to compile the program:
C:/proj/Mozilla> make-F client. mk build

Other Instructions:
1. The downloaded source file is about 240 mb. Therefore, it is a long process and I spent over 30 minutes;
2. Compilation is a longer process. It took me three hours to complete the process. My configuration is 1.8g + 512 M;
If you use it for network connection, you will find that the error window is often displayed, which is used for testing (you need to ignore each point to continue execution ). It will be very troublesome, so you can remove the line "ac_add_options -- enable-Debug" to avoid trouble. Change to "ac_add_options -- disable-Debug". Remember, this will speed up compilation! Another way to speed up is to add "ac_add_options -- disable-tests", so that many test programs will not be generated. It is recommended that the best ". keystore config" when compiling Firefox is as follows:
. $ Topsrcdir/Browser/config/configure config
Mk_add_options pai_objdir = @ topsrcdir @/FF-opt-static
Ac_add_options -- enable-optimize
Ac_add_options -- disable-Debug
Ac_add_options -- disable-static
Ac_add_options -- enable-shared
Ac_add_options -- disable-Tests
Mk_add_options pai_co_project = Browser
4. The compiled file is in the C:/proj/Mozilla/Firefox-objdir/Dist/bin directory (if you are using a non-debug mode, the file is in the directory c: /proj/Mozilla/FF-opt-static/Dist/bin). The name is firefox.exe. However, after you execute it, you can view the version below for help, it is called minefield 3.0a1 (not a name before. Hehe.
5. If you want to compile it into an installed version, you can delete "ac_add_options -- disable-installer ". For more compilation options, see http: // developer.mozilla.org/en/docs/javasing_build_options.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.