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

Side by Side 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, 3 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 unified diff | Download patch
« no previous file with comments | « docs/code_coverage.md ('k') | docs/cr_user_manual.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 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 Chromi um product. This page has more advanced information about the build system.
2
3 If you're new to Chromium development, read the [getting started guides](http:// dev.chromium.org/developers/how-tos/get-the-code).
4
5
6
7 # Faster Builds
8
9 ## Components Build
10
11 A non-standard build configuration is to use dynamic linking instead of static l inking for the various modules in the Chromium codebase. This results in signifi cantly 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):
12
13 ```
14 $ GYP_DEFINES="component=shared_library" gclient runhooks
15 ```
16
17 or
18
19 ```
20 C:\...\src>set GYP_DEFINES=component=shared_library
21 C:\...\src>gclient runhooks
22 ```
23
24
25 ## Windows: Debug Builds Link Faster
26
27 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 r elease mode, a full link is performed each time.
28
29 ## Mac: Disable Release Mode Stripping
30
31 On Mac, if building in release mode, one of the final build steps will be to str ip the build products and create dSYM files. This process can slow down your inc remental builds, but it can be disabled with the following define:
32
33 ```
34 $ GYP_DEFINES="mac_strip_release=0" gclient runhooks
35 ```
36
37 ## Mac: DCHECKs in Release Mode
38
39 DCHECKs are only designed to be run in debug builds. But building in release mod e on Mac is significantly faster. You can have your cake and eat it too by build ing release mode with DCHECKs enabled using the following define:
40
41 ```
42 $ GYP_DEFINES="dcheck_always_on=1" gclient runhooks
43 ```
44
45 ## Linux
46
47 Linux has its own page on [making the build faster](https://code.google.com/p/ch romium/wiki/LinuxFasterBuilds).
48
49 # Configuring the Build
50
51 ## Environment Variables
52
53 There are various environment variables that can be passed to the metabuild syst em GYP when generating project files. This is a summary of them:
54
55 | GYP\_DEFINES | A set of key=value pairs separated by space that will set defau lt values of variables used in .gyp and .gypi files |
56 |:-------------|:--------------------------------------------------------------- ----------------------------------------------------|
57 | GYP\_GENERATORS | The specific generator that creates build-system specific fi les |
58 | GYP\_GENERATOR\_FLAGS | Flags that are passed down to the tool that generates the build-system specific files |
59 | GYP\_GENERATOR\_OUTPUT | The directory that the top-level build output directo ry is relative to |
60
61 Note also that GYP uses CPPFLAGS, CFLAGS, and CXXFLAGS when generating ninja fil es (the values at build time = ninja run time are _not_ used); see [gyp/generato r/ninja.py](https://code.google.com/p/chromium/codesearch#chromium/src/tools/gyp /pylib/gyp/generator/ninja.py&q=cxxflags).
62
63 ## Variable Files
64
65 If you want to keep a set of variables established, there are a couple of magic files that GYP reads:
66
67 ### chromium.gyp\_env
68
69 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 environmen t 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).
70
71 ```
72 {
73 'variables': {
74 'mac_strip_release': 0,
75 },
76 'GYP_DEFINES':
77 'clang=1 '
78 'component=shared_library '
79 'dcheck_always_on=1 '
80 }
81 ```
82
83
84 ### include.gyp
85
86 Or globally in your home directory, create a file `~/.gyp/include.gypi`.
87
88 ### supplement.gypi
89
90 The build system will also include any files named `/src/*/supplement.gypi`, whi ch should be in the same format as include.gyp above.
91
92 ## Change the Build System
93
94 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:
95
96 ```
97 $ GYP_GENERATORS=ninja gclient runhooks
98 ```
99
100 [Ninja](https://code.google.com/p/chromium/wiki/NinjaBuild) is generally the fas test way to build anything on any platform.
101
102 ## Change Build Output Directory
103
104 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:
105
106 ```
107 $ GYP_GENERATOR_FLAGS="output_dir=out_other_ninja" gclient runhooks
108 $ ninja -C out_other_ninja/Release chrome
109 ```
110
111 Alternatively, you can do the following, which should work with all GYP generato rs, but the out directory is nested as `out_other/out/`.
112
113 ```
114 $ GYP_GENERATOR_OUTPUT="out_other" gclient runhooks
115 $ ninja -C out_other/out/Release chrome
116 ```
117
118 **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 `Rele ase` part).
119
120 ## Building Google Chrome
121
122 To build Chrome, you need to be a Google employee and have access to the [src-in ternal](http://go.ext.google.com/src-internal) repository. Once your checkout is set up, you can run gclient like so:
123
124 ```
125 $ GYP_DEFINES="branding=Chrome buildtype=Official" gclient runhooks
126 ```
127
128 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.
129
130 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 star t with just the above ones.
OLDNEW
« 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