How to compile Firefox by yourself

Source: Internet
Author: User
To prepare the compilation environment, you must install the Unix simulation environment of cygwin and download cygwin. In addition to the default installation, you need to install the following package:

* CVS
* Cygutils
* Make
* Patch
* Patchutils
* Perl
* Unzip
* Zip
If you do not use CVS to download the code, CVS does not need to be installed. However, we recommend that you use CVS to download the locals file.

If Microsoft compiler is used (Microsoft compiler is officially released), we recommend that you use VC 6 + SP5 + visual c ++ Processor Pack.
If you use the vc7 and. Net compilers, you need to make some settings. When installing vc6, it is recommended that you set your own environment variables for later convenience.
You can also use the built-in compiler of cygwin (or mingw, which is also the GCC fore windows used by cygwin). However, the compiled program is larger than that compiled by VC, and the efficiency may be lower. install at least:
* Gcc-core
* Gcc-G ++
* Binutils
* W32api
* Mingw-runtime

Prepare the environment variable setting script sorted set. BAT (the directory location is modified as needed)
@ Echo off
Set pai_tools = C:/Mozilla/development tools
Set Path = C:/Mozilla/mingw/bin; C:/Mozilla/cygwin/bin; % pai_tools %/bin; % PATH
Set Home = C:/Mozilla
Set cvsroot =: pserver: anonymous@cvs-mirror.mozilla.org:/cvsroot

Install Netscape wintools. Download:
Http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip
Install
Set pai_tools = C:/Mozilla/development tools
Mkdir C:/Mozilla/development tools
CD buildtools/Windows
Install. bat

We recommend that you convert the format of the header file to d2u under cygwin/bin.
Cd c:/Mozilla/development tools/include/
D2u.exe *. h
CD libidl/
D2u.exe *. h

Download the source code of Firefox 1.0, which can be found at www.mozilla.org.

Set the. Configure config file under the Mozilla directory of the compilation environment
. $ Topsrcdir/Browser/config/configure config

Mk_add_options pai_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
Compile the browser Firefox in Mozilla and load the default compilation options. The following are official compilation options. You can add them for optimization. For the optimization instructions, see the official website description.
Specify the compiled programs in the Mozilla/FF directory.
The last line specifies to compile the Simplified Chinese interface (but download the corresponding locles file first)

If cygwin compiler is used, you also need to add these two compilation options to disable the feature.
Ac_add_options -- disable-ActiveX
Ac_add_options -- disable-Accessibility

In addition, if vc6 is not installed, you also need to modify Mozilla/config/static-config.mk, remove urlmon
Static_extra_libs + = $ (call expand_libname, comctl32 comdlg32 UUID shell32 oleaut32 urlmon version winspool)
Changed:
Static_extra_libs + = $ (call expand_libname, comctl32 comdlg32 UUID shell32 oleaut32 version winspool)
If you haven't modified the above items, You can't compile the Code through Firefox using gcc for Windows.

Go to the Windows cmd window
Run reset set. bat
Go to the Firefox source code directory,

Compile
Make-F client. mk build

I used the madfox patch when creating the redfox 1.0b version. You can also choose not to use this patch.
The madfox patch file is as follows:
----
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

------

How to compile a localized version (such as simplified Chinese)

Download the UI local file of Firefox 1.0. It is not included in the default source code package and can only be downloaded through 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

In another way, install locale switcher extension and install the specified xpi file below. However, this method cannot be compiled into a Chinese installation interface (Fortunately, we can write NSIs scripts by ourselves)
Http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-0.11-l10n/windows-xpi/

Compile the installation package

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.
Package into zip
Make-C:/Mozilla/xxxx compiling directory/Browser/Installer

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.