系统需求:
https://code.google.com/p/chromium/wiki/LinuxBuildInstructionsPrerequisites
1, Ubuntu 14.04
2, Disk space
It takes about 10GB or so of disk space to check out and build the source tree. This number grows over time.
3, Memory space
It takes about 8GB of swap file to link chromium and its tests. If you get an out-of-memory error during the final link, you will need to add swap space with swapon. It's recommended to have at least 4GB of memory available for building a statically linked debug build. Dynamic linking and/or building a release build lowers memory requirements. People with less than 8GB of memory may want to not build tests since they are quite large.
4, 64-bit Systems
Chromium can be compiled as either a 32-bit or 64-bit application. Chromium requires several system libraries to compile and run. While it is possible to compile and run a 32-bit Chromium on 64-bit Linux, many distributions are missing the necessary 32-bit libraries, and will result in build or run-time errors.
5, Depot tools
Before setting up the environment, make sure you install the depot tools first.
6, Software Requirements
Ubuntu Setup
Run build/install-build-deps.sh The script only supports current releases as listed onhttps://wiki.ubuntu.com/Releases.
Building on Linux requires software not usually installed with the distributions. The script attempts to automate installing the required software. This script is used to set up the canonical builders, and as such is the most up to date reference for the required prerequisites.
blink code standard:
http://dev.chromium.org/blink/coding-style
1, get the source code: http://dev.chromium.org/developers/how-tos/get-the-code
1.1 GET DEPOT TOOLS (http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up)
Clone the depot_tools repository:
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
~/.bashrc
or
~/.zshrc
). Assuming you cloned
depot_tools to
/path/to/depot_tools
:
$ export PATH=$PATH:/mnt/blink_chromium_browser/depot_tools
1.2, get the blink source code:
# mkdir blink && cd $_
# /mnt/blink_chromium_browser/blink$ ../depot_tools/fetch --nohooks --no-history blink
[0:22:22] Still working on:
[0:22:22] src/third_party/WebKit
Syncing projects: 100% (78/78), done.
Running: git submodule foreach 'git config -f $toplevel/.git/config submodule.$name.ignore all'
Running: git config --add remote.origin.fetch '+refs/tags/*:refs/tags/*'
Running: git config diff.ignoreSubmodules all
2, Install any necessary dependencies
2.1 Install any necessary dependencies
build/install-build-deps.sh If you are on linux and fetching the code for the first time, then you’ll needto run:
Run build/install-build-deps.sh The script only supports current releases as listed onhttps://wiki.ubuntu.com/Releases.
Problems: 1,
How can I accept the Microsoft EULA agreement for ttf-mscorefonts-installer?
- Use the Tab key to move from one element (e.g., button, text box) to the next. UseShift+Tab to move in reverse.
- Use Spacebar to "click" the selected button.
- Use Enter to click the default button (or currently selected button, if there is no default).
- You can move up and down in a textbox with the arrow keys, and with Page Up andPage Down. If that doesn't work, pressTab until the text box you want to navigate in is selected.
2.2 Run post-sync hooks
Finally, runhooks to run any post-sync scripts
$ gclient runhooks
3, build blink
https://code.google.com/p/chromium/wiki/LinuxBuildInstructions
3.1 Building Chromium base
- .gclient This file (generated by fetch) defines the configuration of your checkout. It contains the location of the repository, as well as some other useful configuration
- .gclient_entries This file (also generated by fetch) contains the repository and version information for each of Chromium's sub-repositories (dependencies)
- src/ Contains the Chromium codebase (an explanation of the directory structure)
- out/ Contains the generated output from builds
- Debug/ One of the default build folders; builds the debug build
- Release/ One of the default build folders; builds the release build
- out/ Contains the generated output from builds
GYP build (standard)
Generating the build files
$ ./build/gyp_chromium -Dcomponent=shared_libraryBy default, this will add the build files to the out/ directory, but you can specify a different directory if you wish, e.g.:
$ ./build/gyp_chromium -Goutput_dir=out_cros
3,2 gyp (configuring)
$ gclient sync
This will pull all dependencies of the Chromium src checkout. You will needto run this any time you update the main src checkout, including when youswitch branches.
$ ./build/gyp_chromium -Dcomponent=shared_library
$ ./build/gyp_chromium -Dcomponent=shared_libraryBy default, this will add the build files to the out/ directory, but you can specify a different directory if you wish, e.g.:
$ ./build/gyp_chromium -Goutput_dir=out_cros
Specifying build parameters
3.3 Building Chrome
You can then build Chromium (the chrome target) using:
https://code.google.com/p/chromium/wiki/LinuxBuildInstructions
http://dev.chromium.org/developers/how-tos/get-the-code
$ ninja -C out/Release chrome
$ ninja -C out/Debug chrome
$ ninja -C out/Release chrome chrome_sandbox
4 Running Chromium
http://dev.chromium.org/developers/how-tos/get-the-code
https://code.google.com/p/chromium/wiki/LinuxBuildInstructions
meeting the problem: https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment
[4084:4084:0420/123757:FATAL:browser_main_loop.cc(169)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
How to fix it????? https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment
$ ninja -C out/Release chrome chrome_sandbox
$ sudo cp out/Release/chrome_sandbox /usr/local/sbin/chrome-devel-sandbox
$ sudo chown root:root /usr/local/sbin/chrome-devel-sandbox
$ sudo chmod 4755 /usr/local/sbin/chrome-devel-sandbox
$ export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox