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

Side by Side Diff: docs/common_build_tasks.md

Issue 1314513007: [Docs]: Update to match style guide. (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
OLDNEW
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. 1 # Common Build Tasks
2 2
3 If you're new to Chromium development, read the [getting started guides](http:// dev.chromium.org/developers/how-tos/get-the-code). 3 The Chromium build system is a complicated beast of a system, and it is not very
4 well documented beyond the basics of getting the source and building the
5 Chromium product. This page has more advanced information about the build
6 system.
4 7
8 If you're new to Chromium development, read the
9 [getting started guides](http://dev.chromium.org/developers/how-tos/get-the-code ).
5 10
11 [TOC]
6 12
7 # Faster Builds 13 ## Faster Builds
8 14
9 ## Components Build 15 ### Components Build
10 16
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): 17 A non-standard build configuration is to use dynamic linking instead of static
18 linking for the various modules in the Chromium codebase. This results in
19 significantly faster link times, but is a divergence from what is shipped and
20 primarily tested. To enable the
21 [component build](http://www.chromium.org/developers/how-tos/component-build):
12 22
13 ``` 23 $ GYP_DEFINES="component=shared_library" gclient runhooks
14 $ GYP_DEFINES="component=shared_library" gclient runhooks
15 ```
16 24
17 or 25 or
18 26
19 ``` 27 ```
20 C:\...\src>set GYP_DEFINES=component=shared_library 28 C:\...\src>set GYP_DEFINES=component=shared_library
21 C:\...\src>gclient runhooks 29 C:\...\src>gclient runhooks
22 ``` 30 ```
23 31
32 ### Windows: Debug Builds Link Faster
24 33
25 ## Windows: Debug Builds Link Faster 34 On Windows if using the components build, building in debug mode will generally
35 link faster. This is because in debug mode, the linker works incrementally. In
36 release mode, a full link is performed each time.
26 37
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. 38 ### Mac: Disable Release Mode Stripping
28 39
29 ## Mac: Disable Release Mode Stripping 40 On Mac, if building in release mode, one of the final build steps will be to
41 strip the build products and create dSYM files. This process can slow down your
42 incremental builds, but it can be disabled with the following define:
30 43
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: 44 $ GYP_DEFINES="mac_strip_release=0" gclient runhooks
32 45
33 ``` 46 ### Mac: DCHECKs in Release Mode
34 $ GYP_DEFINES="mac_strip_release=0" gclient runhooks
35 ```
36 47
37 ## Mac: DCHECKs in Release Mode 48 DCHECKs are only designed to be run in debug builds. But building in release
49 mode on Mac is significantly faster. You can have your cake and eat it too by
50 building release mode with DCHECKs enabled using the following define:
38 51
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: 52 $ GYP_DEFINES="dcheck_always_on=1" gclient runhooks
40 53
41 ``` 54 ### Linux
42 $ GYP_DEFINES="dcheck_always_on=1" gclient runhooks
43 ```
44 55
45 ## Linux 56 Linux has its own page on [making the build faster](linux_faster_builds.md).
46 57
47 Linux has its own page on [making the build faster](https://code.google.com/p/ch romium/wiki/LinuxFasterBuilds). 58 ## Configuring the Build
48 59
49 # Configuring the Build 60 ### Environment Variables
50 61
51 ## Environment Variables 62 There are various environment variables that can be passed to the metabuild
52 63 system GYP when generating project files. This is a summary of them:
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 64
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 | 65 | 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 |:-------------|:--------------------------------------------------------------- ----------------------------------------------------| 66 |:-------------|:--------------------------------------------------------------- ----------------------------------------------------|
57 | GYP\_GENERATORS | The specific generator that creates build-system specific fi les | 67 | 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 | 68 | 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 | 69 | GYP\_GENERATOR\_OUTPUT | The directory that the top-level build output directo ry is relative to |
nodir 2015/08/29 00:53:49 prefer list over table * GYP_GENERATORS: the spec
Bons 2015/08/29 15:29:26 added a todo for the sake of speed.
60 70
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). 71 Note also that GYP uses CPPFLAGS, CFLAGS, and CXXFLAGS when generating ninja
72 files (the values at build time = ninja run time are _not_ used); see
73 [gyp/generator/ninja.py](https://code.google.com/p/chromium/codesearch#chromium/ src/tools/gyp/pylib/gyp/generator/ninja.py&q=cxxflags).
62 74
63 ## Variable Files 75 ### Variable Files
64 76
65 If you want to keep a set of variables established, there are a couple of magic files that GYP reads: 77 If you want to keep a set of variables established, there are a couple of magic
78 files that GYP reads:
66 79
67 ### chromium.gyp\_env 80 #### chromium.gyp\_env
68 81
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). 82 Next to your top-level `/src/` directory, create a file called
83 `chromium.gyp_env`. This holds a JSON dictionary, with the keys being any of the
84 above environment variables. For the full list of supported keys, see
85 [/src/build/gyp_helper.py](https://code.google.com/p/chromium/codesearch#chromiu m/src/build/gyp_helper.py&sq=package:chromium&type=cs&q=file:gyp_helper.py%5Cb).
nodir 2015/08/29 00:53:49 prefer direct links [/src/build/gyp_helper.py](/b
Bons 2015/08/29 15:29:26 Done.
70 86
71 ``` 87 ``` {
72 {
73 'variables': { 88 'variables': {
74 'mac_strip_release': 0, 89 'mac_strip_release': 0,
75 }, 90 }, 'GYP_DEFINES':
76 'GYP_DEFINES': 91 'clang=1 ' 'component=shared_library ' 'dcheck_always_on=1 '
77 'clang=1 ' 92 } ```
78 'component=shared_library '
79 'dcheck_always_on=1 '
80 }
81 ```
82 93
83 94 #### include.gyp
84 ### include.gyp
85 95
86 Or globally in your home directory, create a file `~/.gyp/include.gypi`. 96 Or globally in your home directory, create a file `~/.gyp/include.gypi`.
87 97
88 ### supplement.gypi 98 #### supplement.gypi
89 99
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. 100 The build system will also include any files named `/src/*/supplement.gypi`,
101 which should be in the same format as include.gyp above.
91 102
92 ## Change the Build System 103 ### Change the Build System
93 104
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: 105 Most platforms support multiple build systems (Windows: different Visual Studios
106 versions and ninja, Mac: Xcode and ninja, etc.). A sensible default is selected,
107 but it can be overridden:
95 108
96 ``` 109 $ GYP_GENERATORS=ninja gclient runhooks
97 $ GYP_GENERATORS=ninja gclient runhooks
98 ```
99 110
100 [Ninja](https://code.google.com/p/chromium/wiki/NinjaBuild) is generally the fas test way to build anything on any platform. 111 [Ninja](ninja_build.md) is generally the fastest way to build anything on any
112 platform.
101 113
102 ## Change Build Output Directory 114 ### Change Build Output Directory
103 115
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: 116 If you need to change a compile-time flag and do not want to touch your current
117 build output, you can re-run GYP and place output into a new directory, like so,
118 assuming you are using ninja:
105 119
106 ``` 120 ```shell
107 $ GYP_GENERATOR_FLAGS="output_dir=out_other_ninja" gclient runhooks 121 $ GYP_GENERATOR_FLAGS="output_dir=out_other_ninja" gclient runhooks
108 $ ninja -C out_other_ninja/Release chrome 122 $ ninja -C out_other_ninja/Release chrome
109 ``` 123 ```
110 124
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/`. 125 Alternatively, you can do the following, which should work with all GYP
126 generators, but the out directory is nested as `out_other/out/`.
112 127
113 ``` 128 ```shell
114 $ GYP_GENERATOR_OUTPUT="out_other" gclient runhooks 129 $ GYP_GENERATOR_OUTPUT="out_other" gclient runhooks
115 $ ninja -C out_other/out/Release chrome 130 $ ninja -C out_other/out/Release chrome
116 ``` 131 ```
117 132
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). 133 **Note:** If you wish to run the WebKit layout tests, make sure you specify the
134 new directory using `--build-directory=out_other_ninja` (don't include the
135 `Release` part).
119 136
120 ## Building Google Chrome 137 ### Building Google Chrome
121 138
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: 139 To build Chrome, you need to be a Google employee and have access to the
140 [src-internal](https://goto.google.com/src-internal) repository. Once your
141 checkout is set up, you can run gclient like so:
123 142
124 ``` 143 $ GYP_DEFINES="branding=Chrome buildtype=Official" gclient runhooks
125 $ GYP_DEFINES="branding=Chrome buildtype=Official" gclient runhooks
126 ```
127 144
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. 145 Then building the `chrome` target will produce the official build. This tip can
146 be used in conjunction with changing the output directory, since changing these
147 defines will rebuild the world.
129 148
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. 149 Also note that some GYP\_DEFINES flags are incompatible with the official build.
150 If you get an error when you try to build, try removing all your flags and start
151 with just the above ones.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698