Compile Mozilla Firefox and Thunderbird by yourself

Source: Internet
Author: User
Tags microsoft website

Firefox and Thunderbird are browsers and mail clients in the Mozilla Network suite respectively. Firefox does not use Microsoft's ie kernel and is naturally immune to many rogue plug-ins, thunderbird is an excellent mail client that integrates functions such as newsgroups, RSS, Pgp, and anti-spam, these advantages make these two tools the most popular in the Mozilla Network suite. These two tools are as open-source as other tools in the Mozilla Suite. Anyone can download their source code research. If you are interested, you can also join the developers of these two tools. The purpose of this article is not to introduce the usage of the two software. For details about the Mozilla Suite, visit the official website of Mozilla: www.mozilla.org. The purpose of this article is to introduce how to compile Firefox and Thunderbird.

Compiling Firefox and Thunderbird on Windows is a very painful task, especially for programmers who are used to using Visual Studio and other integrated development tools, these two software were first developed in a UNIX system and then transplanted to Windows. To compile Firefox and Thunderbird on Windows, you need to prepare many development tools. First, you need to download the source code from www.mozilla.org. You can directly obtain the code under development through CVs, cvs can be used to obtain the latest code in real time, but sometimes the code in the library may not be compiled, and sometimes it may be unstable. If you just want to compile a stable local version, it is best to download the packaged stable version source code from the Mozilla FTP website. The compiler first introduced Microsoft Visual Studio, including vc6 and vc71 (Visual Studio. NET 2003) and vc8 (Visual Studio. NET 2005), I use vc71. The methods described in this article are based on this development environment, but it is also applicable to vc8. Another tool, cygwin, is used to simulate a shell similar to Unix or Linux on the Windows platform, because the make tool used for compilation does not support Windows dos shell. You can download cygwin from www.cygwin.com. The complete cygwin is about 1.3 GB, but you do not need to compile all cygwin for Firefox and Thunderbird. You only need to download the following components:

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)-libiconv2 does not contain the iconv program needed for the installer
Make 3.80 -- 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)

Based on my experience, these components may be more than 80 mb. In addition, there are several other gadgets that need to be downloaded, which I will refer to later.

The following is the start of the project. First, prepare the code, and then install cygwin and Visual Studio. NET 2003. Take this article as an example. The installation paths are:
Visual Studio. NET 2003: C:/program files/Microsoft Visual Studio. NET 2003
Cygwin: C:/cygwin
Code: C:/Mozilla
In addition to these directories, you also need to prepare a directory, that is, the development tools Directory, which can be located on any disk, but the name is preferably development tools. In this example, set this directory to C: /keystore tools, which contains several important library files and header files. The first step is from keystore (because I am using vc71, use another version of VC to download the corresponding compressed file ). After obtaining these files, decompress them to C:/Alibaba tools. Sort the files and put them in the include, bin, and Lib directories. After preparing these directories, you need to write two important files: one is the batch processing file that starts the compiling environment (Shell), and the other is the compilation configuration file.

The content of the batch processing file that starts the compilation environment is as follows:

Set Home = C:/Mozilla
Set vcvars = C:/program files/Microsoft Visual Studio. NET 2003/vc7/bin/vcvars32.bat
Rem set mssdk = C:/program files/Microsoft platform SDK
Set required _tools = C:/required tools
Set cygwinbase = C:/cygwin
Set cygwin = nodosfilewarning

Set Path = % cygwinbase %/bin; % PATH %

Call "% vcvars %"
 
Rem set Path = % mssdk %/bin; % PATH %
Rem set include = % mssdk %/include; % include %
Rem set Lib = % mssdk %/LIB; % lib %

Set Path = % PATH %; % pai_tools %/bin

Rem MS-SDK; msvc; cygwin; windows; glib/libidl; runtime tools

Bash -- login-I

Mssdk has been commented out Because Visual Studio. NET 2003 already contains the Platform SDK. This is only for vc6 settings. Store the content in setvc. bat. This name can be arbitrary. The other is to compile the configuration file. To compile Firefox and Thunderbird, you need to prepare two different configuration files. The configuration file name must be. Configure config. The content of the configuration file for compiling Firefox is as follows:
#. $ Topsrcdir/Browser/config/configure config
Mk_add_options export _objdir = @ topsrcdir @/Firefox-release
Mk_add_options pai_co_project = Browser
Ac_add_options -- disable-Installer
Ac_add_options -- disable-Debug
Ac_add_options -- enable-optimize
Ac_add_options -- enable-application = Browser
# Ac_add_options -- enable-optimize =-O2
# Ac_add_options -- disable-optimize
# Ac_add_options -- enable-Debug
# Ac_add_options -- enable-static -- disable-shared
Ac_add_options -- disable-static -- enable-shared
Ac_add_options -- disable-Tests

The configuration file for compiling Thunderbird is as follows:
#. $ Topsrcdir/mail/config/configure config
Mk_add_options pai_objdir = @ topsrcdir @/tbird-release
Mk_add_options pai_co_project = Mail, calendar
Ac_add_options -- disable-Debug
Ac_add_options -- enable-optimize
Ac_add_options -- enable-application = Mail
# Ac_add_options -- enable-optimize =-O2
# Ac_add_options -- disable-optimize
# Ac_add_options -- enable-Debug
# Ac_add_options -- enable-static -- disable-shared
Ac_add_options -- disable-static -- enable-shared
Ac_add_options -- disable-Tests

The functions of each option in the middle can be checked on the Mozilla website. Here we only introduce several important items, one of which is pai_objdir. This is the storage location of the executable files after compilation. The above files are used as an example, the generated executable files are located in C:/Mozilla/Firefox-release and C:/Mozilla/tbird-release. Another option is javas_co_project. To compile Firefox, you must specify the browser. To compile Thunderbird, you must specify mail.

The next step is to make cygwin/ghost better. Also.

Finally, compile the code. Copy the. Taobao config and setvc. bat to the C:/Mozilla directory, run setvc. BAT to start the shell, and enter:
Make-F client. mk build
It takes about 50 minutes to several hours to start code compilation. It depends on your computer capabilities. One thing to remind everyone is that the code I downloaded has an error while compiling the nsmsgtagservice. cpp file. I added a line of code in it:
# Include "nscore. H"
If there is no compilation problem, you can not modify this file. In addition, you must modify wabtags in the VC platform directory. the H file may be a unicode problem. Some code is mistakenly identified by the compiler as a comment generation code. I have not found the technical support for this problem on the Microsoft website, I don't know if other versions of VC will have this problem. I would like to remind you that if there is a problem, use a Unicode-supported compiler to modify wabtags. h file.

The last step is to check the compilation result. If there is no problem, the version will be generated at the location specified by pai_objdir. No installation is required for both software, run the corresponding executable file directly.

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.