1. Mozilla build tools
Mozilla open-source organization has many great cross-platform products, such as Firefox, Thunderbird, Mozilla Suite/SeaMonkey, xulrunner, sunbird, standalone composer, standalone XPCOM, and standalone xpconnect. Most of them are built using Mozilla build system.
Mozilla build system is based on GNU make and Autoconf.
In Mozilla, make is used to compile libraries and executables, create jar files for chrome, and copy files.
Make for each directory is divided into two phases:
* Export: copy the public header file to Dist/include, and generate the C ++ header file from the IDL file;
* Libs: Compile libraries, create jar files, and create typelib files from IDL;
Make is divided into two phases to solve the problem of circular reference between modules.
In addition to make, another very important tool is the configure script, which runs in the first step of build. The configure script determines the options of the system, compiler, and processor. Configure includes the following two important steps:
* Generate Autoconf. mk. In from config/Autoconf. in. This file contains variables that control global build options;
* Makefiles generated from makefile. InSource codeThe path is replaced with the actual path so that makefile can work correctly;
The configure script is a bash shell script, which is generated by Configure. In And Autoconf described by the M4 syntax.
2. Install Mozilla build tools
1) Ubuntu Linux
Sudo apt-Get build-dep Firefox
Sudo apt-Get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev Mesa-common-dev autoconf2.13
2) Windows
Download installation: http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe
Directory structure after installation:
Mozilla-build
+ --- 7zip
+ --- Atlthunk_compat
+ --- Blat261
+ --- Emacs-22.3
+ --- Hg
+ --- Info-zip
+ --- Kdiff3
+ --- Using tools
+ --- Moztools-180compat
+ --- Moztools-x64
+ --- Msys
+ --- Nsis-2.22
+ --- Nsis-2.33u
+ --- Python25
+ --- Svn-win32-1.6.3
+ --- Upx203w
+ --- Vim
+ --- Guess-msvc.bat
+ --- Start-msvc9.bat
\ --- Wget
Three build Firefox
1) Prerequisites
-Windows XP with SP2 and. NET Framework 2.0
-Visual Studio 2008 or express
-Windows SDK
-Install Mozilla build tools (see the previous section)
2) Get code/build/rebuild
-Run the start-msvc9.bat from the installation directory of Mozilla build tools;
-Download the code under c: \ firefoxbuild and then build
# Get the source
CD/d c: \ firefoxbuild
Hg clone http://hg.mozilla.org/mozilla-central/
CD mozilla-Central
# Setup a basic configure Config File
Echo '. $ topsrcdir/Browser/config'> Configure config # Let's build Firefox...
Echo 'mk _ add_options export _objdir = @ topsrcdir @/objdir-FF-release '> export config #... in this directory...
Echo 'mk _ add_options pai_make_flags = "-J4" '> Configure config
# Build
Make-F client. mk
-If you build debug, you need to add the following options in the example config
. $ Topsrcdir/Browser/config/configure config
Mk_add_options export _objdir = @ topsrcdir @/objdir-FF-Debug
Ac_add_options -- enable-Debug
Ac_add_options -- disable-optimize
-Rebuild
# Get the latest source
Hg pull-r default
Hg update
# Build
Make-F client. mk
Iii. Reference
1) https://developer.mozilla.org/en/Build_Documentation
2) https://developer.mozilla.org/En/Simple_Firefox_build#Installing_build_tools
3) https://developer.mozilla.org/en/NSPR_build_instructions
Mozilla build tools can be modified to build cross-platform products!
Complete!