summaryrefslogtreecommitdiffstats
path: root/chromium/docs/website/site/developers/gyp-environment-variables/index.md
blob: 8c1dbcf4d78f30dcf93760b972f4fb77db0e051c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
---
breadcrumbs:
- - /developers
  - For Developers
page_name: gyp-environment-variables
title: GYP build parameters
---

Chromium no longer uses GYP but GN. The corresponding page is [GN build
configuration.](/developers/gn-build-configuration)

Hence, the following is **obsolete**.

GYP has many **environment variables** that configure the way Chrome is built.
By modifying these parameters, you can build chrome for different architectures,
or speed up the build process. Generally, we strive to have good defaults and
you shouldn't have to set many of these. The wiki also has some additional tips
on [common build
tasks](https://code.google.com/p/chromium/wiki/CommonBuildTasks).

## Specifying parameters

### Command-line

To specify build parameters for GYP, you can do so on the command line:

$ ./build/gyp_chromium -Dchromeos=1 -Dcomponent=shared_library

### Environment variable

Or with an environment variable:

$ export GYP_DEFINES="chromeos=1 component=shared_library" $
./build/gyp_chromium

### chromium.gyp_env file

Or in a chromium.gyp_env file in your chromium directory:

$ echo "{ 'GYP_DEFINES': 'chromeos=1 component=shared_library' }" >
../chromium.gyp_env

### Some common file examples:

**Windows**:

{ 'GYP_DEFINES': 'component=shared_library' }

**Mac**:

{ 'GYP_DEFINES': 'fastbuild=1' }

**Linux**:

{ 'GYP_DEFINES': 'component=shared_library remove_webcore_debug_symbols=1' }

## ChromeOS on Linux:

{ 'GYP_DEFINES': 'chromeos=1 component=shared_library
remove_webcore_debug_symbols=1' }

## Android:

{ 'GYP_DEFINES': 'OS=android' }

## Recommended Parameters

For a full list of the main build variables and their defaults, see the
variables section in any \*.gyp or \*.gypi file, e.g.:

$ cat build/common.gypi

<table>
<tr>

<td>### Variable</td>

<td>### Explanation</td>

<td>### Linux</td>

<td>### Windows</td>

<td>### Mac</td>

</tr>
<tr>
<td>component=shared_library</td>
<td>If you dynamically link, you save a lot of time linking for a small time cost during startup. On Windows, this uses a DLL build and incremental linking, which makes linking much faster in Debug.</td>

<td><a href="/developers/gyp-environment-variables/menu_check.png"><img
alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>

<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
<tr>
<td>fastbuild=1</td>
<td><b>Optional: removes all debug information, but builds much faster. </b>0 means all debug symbols (.pdb generated from .obj), 1 means link time symbols (.pdb generated from .lib) and 2 means no pdb at all (no debug information). In practice 0 and 1, will generate the exact same PE. Only 2 will generate a PE that could have it's .rdata to be ~40 bytes smaller.</td>

<td><a href="/developers/gyp-environment-variables/menu_check.png"><img
alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>

<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
<tr>
<td>remove_webcore_debug_symbols=1</td>
<td>If you don't need to trace into WebKit, you can cut down the size and slowness of debug builds significantly by building WebKit without debug symbols. </td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a> </td>
</tr>
</table>

### Building a release build

To build Chrome in a release build, as well as building in the out/Release
directory, you may add the following flags:

<table>
<tr>

<td>### Variable</td>

<td>### Explanation</td>

<td>### Linux</td>

<td>### Windows</td>

<td>### Mac</td>

</tr>
<tr>
<td>buildtype=Official</td>
<td>Builds the heavily optimized official release build (invalid for builds in out/Debug). Other options include 'Dev', for development/testing. Official builds take <b>*drastically*</b> longer to build, and are most likely not what you want.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a> </td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a> </td>
</tr>
<tr>
<td>branding=Chrome</td>
<td>Changes the branding from 'Chromium' to 'Chrome', for official builds.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a> </td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
</table>

### Use goma distributed build (Googlers only)

See [go/ma](https://sites.google.com/a/google.com/goma/) for more information on
how to set up goma.

### Use the icecc linker (Linux only)

[Icecc](https://github.com/icecc/icecream) is the distributed compiler with a
central scheduler to share build load. Currently, many external contributors use
it. e.g. Intel, Opera, Samsung.

<table>
<tr>

<td>### Variable</td>

<td>### Explanation</td>

<td>### Linux</td>

<td>### Windows</td>

<td>### Mac</td>

</tr>
<tr>
<td>linux_use_bundled_binutils=0</td>
<td>-B option is not supported. See <a href="https://github.com/icecc/icecream/commit/b2ce5b9cc4bd1900f55c3684214e409fa81e7a92">this commit</a> for more details.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
<tr>
<td>linux_use_debug_fission=0</td>
<td><a href="http://gcc.gnu.org/wiki/DebugFission">Debug fission</a> is not supported. See <a href="https://github.com/icecc/icecream/issues/86">this bug</a> for more details.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
<tr>
<td>clang=0</td>
<td>Icecc doesn't support clang yet.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
</table>

### Build ChromeOS on Linux (Linux only)

To build ChromeOS on Linux, use the following gyp variables and the regular
chrome target will run ChromeOS instead of Chrome.

<table>
<tr>

<td>### Variable</td>

<td>### Explanation</td>

<td>### Linux</td>

<td>### Windows</td>

<td>### Mac</td>

</tr>
<tr>
<td>chromeos=1</td>
<td>Build for the ChromeOS platform instead of Linux.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
</table>

### Build Android (Linux only)

To build ChromeOS on Linux, use the following gyp variables and the either the
chrome_shell_apk or webview_instrumentation_apk target.

<table>
<tr>

<td>### Variable</td>

<td>### Explanation</td>

<td>### Linux</td>

<td>### Windows</td>

<td>### Mac</td>

</tr>
<tr>
<td>OS=android</td>
<td>Build for the Android platform instead of Linux.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
<tr>
<td>target_arch=ia32</td>
<td><b>Optional. </b>Use this if building for x86 targets.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
<tr>
<td>target_arch=mipsel</td>
<td><b>Optional. </b>Use this if building for MIPS targets.</td>
<td><a href="/developers/gyp-environment-variables/menu_check.png"><img alt="image" src="/developers/gyp-environment-variables/menu_check.png"></a></td>
</tr>
</table>