系统需求:
https://code.google.com/p/chromium/wiki/LinuxBuildInstructionsPrerequisites
1, Ubuntu 14.04
It takes about 10GB or so of disk space to check out and build the source tree. This number grows over time.
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.
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.
Before setting up the environment, make sure you install the depot tools first.
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
# /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,
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
$ ./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
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
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