Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1510)

Unified Diff: docs/common_build_tasks.md

Issue 1309473002: WIP: Migrate Wiki content over to src/docs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « docs/code_coverage.md ('k') | docs/cr_user_manual.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/common_build_tasks.md
diff --git a/docs/common_build_tasks.md b/docs/common_build_tasks.md
new file mode 100644
index 0000000000000000000000000000000000000000..43ac2d8be51a7c6e87c7eddb600c4c7b6f555889
--- /dev/null
+++ b/docs/common_build_tasks.md
@@ -0,0 +1,130 @@
+The Chromium build system is a complicated beast of a system, and it is not very well documented beyond the basics of getting the source and building the Chromium product. This page has more advanced information about the build system.
+
+If you're new to Chromium development, read the [getting started guides](http://dev.chromium.org/developers/how-tos/get-the-code).
+
+
+
+# Faster Builds
+
+## Components Build
+
+A non-standard build configuration is to use dynamic linking instead of static linking for the various modules in the Chromium codebase. This results in significantly faster link times, but is a divergence from what is shipped and primarily tested. To enable the [component build](http://www.chromium.org/developers/how-tos/component-build):
+
+```
+$ GYP_DEFINES="component=shared_library" gclient runhooks
+```
+
+or
+
+```
+C:\...\src>set GYP_DEFINES=component=shared_library
+C:\...\src>gclient runhooks
+```
+
+
+## Windows: Debug Builds Link Faster
+
+On Windows if using the components build, building in debug mode will generally link faster. This is because in debug mode, the linker works incrementally. In release mode, a full link is performed each time.
+
+## Mac: Disable Release Mode Stripping
+
+On Mac, if building in release mode, one of the final build steps will be to strip the build products and create dSYM files. This process can slow down your incremental builds, but it can be disabled with the following define:
+
+```
+$ GYP_DEFINES="mac_strip_release=0" gclient runhooks
+```
+
+## Mac: DCHECKs in Release Mode
+
+DCHECKs are only designed to be run in debug builds. But building in release mode on Mac is significantly faster. You can have your cake and eat it too by building release mode with DCHECKs enabled using the following define:
+
+```
+$ GYP_DEFINES="dcheck_always_on=1" gclient runhooks
+```
+
+## Linux
+
+Linux has its own page on [making the build faster](https://code.google.com/p/chromium/wiki/LinuxFasterBuilds).
+
+# Configuring the Build
+
+## Environment Variables
+
+There are various environment variables that can be passed to the metabuild system GYP when generating project files. This is a summary of them:
+
+| GYP\_DEFINES | A set of key=value pairs separated by space that will set default values of variables used in .gyp and .gypi files |
+|:-------------|:-------------------------------------------------------------------------------------------------------------------|
+| GYP\_GENERATORS | The specific generator that creates build-system specific files |
+| GYP\_GENERATOR\_FLAGS | Flags that are passed down to the tool that generates the build-system specific files |
+| GYP\_GENERATOR\_OUTPUT | The directory that the top-level build output directory is relative to |
+
+Note also that GYP uses CPPFLAGS, CFLAGS, and CXXFLAGS when generating ninja files (the values at build time = ninja run time are _not_ used); see [gyp/generator/ninja.py](https://code.google.com/p/chromium/codesearch#chromium/src/tools/gyp/pylib/gyp/generator/ninja.py&q=cxxflags).
+
+## Variable Files
+
+If you want to keep a set of variables established, there are a couple of magic files that GYP reads:
+
+### chromium.gyp\_env
+
+Next to your top-level `/src/` directory, create a file called `chromium.gyp_env`. This holds a JSON dictionary, with the keys being any of the above environment variables. For the full list of supported keys, see [/src/build/gyp\_helper.py](https://code.google.com/p/chromium/codesearch#chromium/src/build/gyp_helper.py&sq=package:chromium&type=cs&q=file:gyp_helper.py%5Cb).
+
+```
+{
+ 'variables': {
+ 'mac_strip_release': 0,
+ },
+ 'GYP_DEFINES':
+ 'clang=1 '
+ 'component=shared_library '
+ 'dcheck_always_on=1 '
+}
+```
+
+
+### include.gyp
+
+Or globally in your home directory, create a file `~/.gyp/include.gypi`.
+
+### supplement.gypi
+
+The build system will also include any files named `/src/*/supplement.gypi`, which should be in the same format as include.gyp above.
+
+## Change the Build System
+
+Most platforms support multiple build systems (Windows: different Visual Studios versions and ninja, Mac: Xcode and ninja, etc.). A sensible default is selected, but it can be overridden:
+
+```
+$ GYP_GENERATORS=ninja gclient runhooks
+```
+
+[Ninja](https://code.google.com/p/chromium/wiki/NinjaBuild) is generally the fastest way to build anything on any platform.
+
+## Change Build Output Directory
+
+If you need to change a compile-time flag and do not want to touch your current build output, you can re-run GYP and place output into a new directory, like so, assuming you are using ninja:
+
+```
+$ GYP_GENERATOR_FLAGS="output_dir=out_other_ninja" gclient runhooks
+$ ninja -C out_other_ninja/Release chrome
+```
+
+Alternatively, you can do the following, which should work with all GYP generators, but the out directory is nested as `out_other/out/`.
+
+```
+$ GYP_GENERATOR_OUTPUT="out_other" gclient runhooks
+$ ninja -C out_other/out/Release chrome
+```
+
+**Note:** If you wish to run the WebKit layout tests, make sure you specify the new directory using `--build-directory=out_other_ninja` (don't include the `Release` part).
+
+## Building Google Chrome
+
+To build Chrome, you need to be a Google employee and have access to the [src-internal](http://go.ext.google.com/src-internal) repository. Once your checkout is set up, you can run gclient like so:
+
+```
+$ GYP_DEFINES="branding=Chrome buildtype=Official" gclient runhooks
+```
+
+Then building the `chrome` target will produce the official build. This tip can be used in conjunction with changing the output directory, since changing these defines will rebuild the world.
+
+Also note that some GYP\_DEFINES flags are incompatible with the official build. If you get an error when you try to build, try removing all your flags and start with just the above ones.
« no previous file with comments | « docs/code_coverage.md ('k') | docs/cr_user_manual.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698