Updating trunk VERSION from 804.0 to 805.0
[chromium-blink-merge.git] / chrome / chrome_exe.gypi
blob238779f2aaecc32f29f6be881e87a1de795535a3
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
6   'target_defaults': {
7     'variables': {
8       'chrome_exe_target': 0,
9     },
10     'target_conditions': [
11       ['chrome_exe_target==1', {
12         'sources': [
13           # .cc, .h, and .mm files under app that are used on all
14           # platforms, including both 32-bit and 64-bit Windows.
15           # Test files are not included.
16           'app/breakpad_win.cc',
17           'app/breakpad_win.h',
18           'app/chrome_exe_main_gtk.cc',
19           'app/chrome_exe_main_mac.mm',
20           'app/chrome_exe_main_win.cc',
21           'app/chrome_exe_resource.h',
22           'app/client_util.cc',
23           'app/client_util.h',
24           'app/hard_error_handler_win.cc',
25           'app/hard_error_handler_win.h',
26           'app/scoped_ole_initializer.h',
27           # TODO(bradnelson): once automatic generation of 64 bit targets on
28           # Windows is ready, take this out and add a dependency on
29           # content_common.gypi.
30           '../content/common/content_switches.cc',
31           '../content/common/content_switches.h',
32         ],
33         'mac_bundle_resources': [
34           'app/app-Info.plist',
35         ],
36         # TODO(mark): Come up with a fancier way to do this.  It should only
37         # be necessary to list app-Info.plist once, not the three times it is
38         # listed here.
39         'mac_bundle_resources!': [
40           'app/app-Info.plist',
41         ],
42         'xcode_settings': {
43           'CHROMIUM_STRIP_SAVE_FILE': 'app/app.saves',
44           'INFOPLIST_FILE': 'app/app-Info.plist',
45         },
46         'conditions': [
47           ['OS=="win"', {
48             'sources': [
49               'app/chrome_exe.rc',
50               'app/chrome_exe_version.rc.version',
51             ],
52             'include_dirs': [
53               '<(SHARED_INTERMEDIATE_DIR)/chrome',
54             ],
55             # TODO(scottbyer): This is a temporary workaround.  The right fix
56             # is to change the output file to be in $(IntDir) for this project
57             # and the .dll project and use the hardlink script to link it back
58             # to $(OutDir).
59             'configurations': {
60               'Debug_Base': {
61                 'msvs_settings': {
62                   'VCLinkerTool': {
63                     'LinkIncremental': '1',
64                   },
65                 },
66               },
67             },
68             'msvs_settings': {
69               'VCLinkerTool': {
70                 'DelayLoadDLLs': [
71                   'dbghelp.dll',
72                   'dwmapi.dll',
73                   'uxtheme.dll',
74                   'ole32.dll',
75                   'oleaut32.dll',
76                 ],
77                 # Set /SUBSYSTEM:WINDOWS for chrome.exe itself.
78                 'SubSystem': '2',
79               },
80               'VCManifestTool': {
81                 'AdditionalManifestFiles': '$(ProjectDir)\\app\\chrome.exe.manifest',
82               },
83             },
84             'actions': [
85               {
86                 'action_name': 'version',
87                 'variables': {
88                   'template_input_path': 'app/chrome_exe_version.rc.version',
89                 },
90                 'conditions': [
91                   [ 'branding == "Chrome"', {
92                     'variables': {
93                        'branding_path': 'app/theme/google_chrome/BRANDING',
94                     },
95                   }, { # else branding!="Chrome"
96                     'variables': {
97                        'branding_path': 'app/theme/chromium/BRANDING',
98                     },
99                   }],
100                 ],
101                 'inputs': [
102                   '<(template_input_path)',
103                   '<(version_path)',
104                   '<(branding_path)',
105                 ],
106                 'outputs': [
107                   '<(SHARED_INTERMEDIATE_DIR)/chrome/chrome_exe_version.rc',
108                 ],
109                 'action': [
110                   'python',
111                   '<(version_py_path)',
112                   '-f', '<(version_path)',
113                   '-f', '<(branding_path)',
114                   '<(template_input_path)',
115                   '<@(_outputs)',
116                 ],
117                 'process_outputs_as_sources': 1,
118                 'message': 'Generating version information in <(_outputs)'
119               },
120               {
121                 'action_name': 'first_run',
122                 'inputs': [
123                     'app/FirstRun',
124                 ],
125                 'outputs': [
126                     '<(PRODUCT_DIR)/First Run',
127                 ],
128                 'action': ['cp', '-f', '<@(_inputs)', '<@(_outputs)'],
129                 'message': 'Copy first run complete sentinel file',
130               },
131             ],
132           }, {  # 'OS!="win"
133             'sources!': [
134               'app/client_util.cc',
135             ]
136           }],
137         ],
138       }],
139     ],
140   },
141   'targets': [
142     {
143       'target_name': 'chrome',
144       'type': 'executable',
145       'mac_bundle': 1,
146       'variables': {
147         'chrome_exe_target': 1,
148         'use_system_xdg_utils%': 0,
149         'disable_pie%': 0,
150       },
151       'conditions': [
152         ['os_posix == 1 and OS != "mac"', {
153           'actions': [
154             {
155               'action_name': 'manpage',
156               'conditions': [
157                 [ 'branding == "Chrome"', {
158                   'variables': {
159                     'name': 'Google Chrome',
160                     'filename': 'google-chrome',
161                     'confdir': 'google-chrome',
162                   },
163                 }, { # else branding!="Chrome"
164                   'variables': {
165                     'name': 'Chromium',
166                     'filename': 'chromium-browser',
167                     'confdir': 'chromium',
168                   },
169                 }],
170               ],
171               'inputs': [
172                 'tools/build/linux/sed.sh',
173                 'app/resources/manpage.1.in',
174               ],
175               'outputs': [
176                 '<(PRODUCT_DIR)/chrome.1',
177               ],
178               'action': [
179                 'tools/build/linux/sed.sh',
180                 'app/resources/manpage.1.in',
181                 '<@(_outputs)',
182                 '-e', 's/@@NAME@@/<(name)/',
183                 '-e', 's/@@FILENAME@@/<(filename)/',
184                 '-e', 's/@@CONFDIR@@/<(confdir)/',
185               ],
186               'message': 'Generating manpage'
187             },
188           ],
189           'conditions': [
190             ['linux_use_tcmalloc==1', {
191                 'dependencies': [
192                   '<(allocator_target)',
193                 ],
194               },
195             ],
196             # TODO(rkc): Remove disable_pie (and instead always use
197             # -pie) once we have a fix for remote gdb and are able to
198             # correctly get section header offsets for pie
199             # executables. Currently -pie breaks remote debugging.
200             ['disable_pie==1', {
201               'ldflags': ['-nopie'],
202             }, {
203               # Building with -pie needs investigating on ARM.
204               # For now, at least use it on Linux Intel.
205               'conditions': [
206                 ['target_arch=="x64" or target_arch=="ia32"', {
207                   'ldflags': ['-pie'],
208                 }],
209               ],
210             }],
211             ['use_system_xdg_utils==0', {
212               'copies': [
213                 {
214                   'destination': '<(PRODUCT_DIR)',
215                   'files': ['tools/build/linux/chrome-wrapper',
216                             '../third_party/xdg-utils/scripts/xdg-mime',
217                             '../third_party/xdg-utils/scripts/xdg-settings',
218                             ],
219                   # The wrapper script above may need to generate a .desktop
220                   # file, which requires an icon. So, copy one next to the
221                   # script.
222                   'conditions': [
223                     ['branding=="Chrome"', {
224                       'files': ['app/theme/google_chrome/product_logo_48.png']
225                     }, { # else: 'branding!="Chrome"
226                       'files': ['app/theme/chromium/product_logo_48.png']
227                     }],
228                   ],
229                 },
230               ],
231             }],
232           ],
233           'dependencies': [
234             # On Linux, link the dependencies (libraries) that make up actual
235             # Chromium functionality directly into the executable.
236             '<@(chromium_dependencies)',
237             # Needed for chrome_main.cc initialization of libraries.
238             '../build/linux/system.gyp:dbus-glib',
239             '../build/linux/system.gyp:gtk',
240             'packed_resources',
241             # Needed to use the master_preferences functions
242             'installer_util',
243           ],
244           'sources': [
245             'app/chrome_dll_resource.h',
246             'app/chrome_main.cc',
247             'app/chrome_main_posix.cc',
248           ],
249         }],
250         ['OS=="mac"', {
251           # 'branding' is a variable defined in common.gypi
252           # (e.g. "Chromium", "Chrome")
253           'conditions': [
254             ['branding=="Chrome"', {
255               'mac_bundle_resources': [
256                 'app/theme/google_chrome/app.icns',
257                 'app/theme/google_chrome/document.icns',
258                 'browser/ui/cocoa/applescript/scripting.sdef',
259               ],
260             }, {  # else: 'branding!="Chrome"
261               'mac_bundle_resources': [
262                 'app/theme/chromium/app.icns',
263                 'app/theme/chromium/document.icns',
264                 'browser/ui/cocoa/applescript/scripting.sdef',
265               ],
266             }],
267             ['mac_breakpad==1', {
268               'variables': {
269                 # A real .dSYM is needed for dump_syms to operate on.
270                 'mac_real_dsym': 1,
271               },
272               'dependencies': [
273                 '../breakpad/breakpad.gyp:dump_syms',
274                 '../breakpad/breakpad.gyp:symupload',
275               ],
276               # The "Dump Symbols" post-build step is in a target_conditions
277               # block so that it will follow the "Strip If Needed" step if that
278               # is also being used.  There is no standard configuration where
279               # both of these steps occur together, but Mark likes to use this
280               # configuraiton sometimes when testing Breakpad-enabled builds
281               # without the time overhead of creating real .dSYM files.  When
282               # both "Dump Symbols" and "Strip If Needed" are present, "Dump
283               # Symbols" must come second because "Strip If Needed" creates
284               # a fake .dSYM that dump_syms needs to fake dump.  Since
285               # "Strip If Needed" is added in a target_conditions block in
286               # common.gypi, "Dump Symbols" needs to be in an (always true)
287               # target_conditions block.
288               'target_conditions': [
289                 ['1 == 1', {
290                   'postbuilds': [
291                     {
292                       'postbuild_name': 'Dump Symbols',
293                       'variables': {
294                         'dump_product_syms_path':
295                             'tools/build/mac/dump_product_syms',
296                       },
297                       'action': ['<(dump_product_syms_path)',
298                                  '<(branding)'],
299                     },
300                   ],
301                 }],
302               ],
303             }],  # mac_breakpad
304           ],
305           'product_name': '<(mac_product_name)',
306           'xcode_settings': {
307             # chrome/app/app-Info.plist has:
308             #   CFBundleIdentifier of CHROMIUM_BUNDLE_ID
309             #   CFBundleName of CHROMIUM_SHORT_NAME
310             #   CFBundleSignature of CHROMIUM_CREATOR
311             # Xcode then replaces these values with the branded values we set
312             # as settings on the target.
313             'CHROMIUM_BUNDLE_ID': '<(mac_bundle_id)',
314             'CHROMIUM_CREATOR': '<(mac_creator)',
315             'CHROMIUM_SHORT_NAME': '<(branding)',
316           },
317           'dependencies': [
318             'helper_app',
319             'infoplist_strings_tool',
320             'chrome_manifest_bundle',
321           ],
322           'mac_bundle_resources': [
323             '<(PRODUCT_DIR)/<(mac_bundle_id).manifest',
324           ],
325           'actions': [
326             {
327               # Generate the InfoPlist.strings file
328               'action_name': 'Generate InfoPlist.strings files',
329               'variables': {
330                 'tool_path': '<(PRODUCT_DIR)/infoplist_strings_tool',
331                 # Unique dir to write to so the [lang].lproj/InfoPlist.strings
332                 # for the main app and the helper app don't name collide.
333                 'output_path': '<(INTERMEDIATE_DIR)/app_infoplist_strings',
334               },
335               'conditions': [
336                 [ 'branding == "Chrome"', {
337                   'variables': {
338                      'branding_name': 'google_chrome_strings',
339                   },
340                 }, { # else branding!="Chrome"
341                   'variables': {
342                      'branding_name': 'chromium_strings',
343                   },
344                 }],
345               ],
346               'inputs': [
347                 '<(tool_path)',
348                 '<(version_path)',
349                 # TODO: remove this helper when we have loops in GYP
350                 '>!@(<(apply_locales_cmd) \'<(grit_out_dir)/<(branding_name)_ZZLOCALE.pak\' <(locales))',
351               ],
352               'outputs': [
353                 # TODO: remove this helper when we have loops in GYP
354                 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/InfoPlist.strings\' <(locales))',
355               ],
356               'action': [
357                 '<(tool_path)',
358                 '-b', '<(branding_name)',
359                 '-v', '<(version_path)',
360                 '-g', '<(grit_out_dir)',
361                 '-o', '<(output_path)',
362                 '-t', 'main',
363                 '<@(locales)',
364               ],
365               'message': 'Generating the language InfoPlist.strings files',
366               'process_outputs_as_mac_bundle_resources': 1,
367             },
368           ],
369           'copies': [
370             {
371               'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Versions/<(version_full)',
372               'files': [
373                 '<(PRODUCT_DIR)/<(mac_product_name) Helper.app',
374               ],
375             },
376           ],
377           'postbuilds': [
378             {
379               'postbuild_name': 'Copy <(mac_product_name) Framework.framework',
380               'action': [
381                 'tools/build/mac/copy_framework_unversioned',
382                 '${BUILT_PRODUCTS_DIR}/<(mac_product_name) Framework.framework',
383                 '${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Versions/<(version_full)',
384               ],
385             },
386             {
387               # Modify the Info.plist as needed.  The script explains why this
388               # is needed.  This is also done in the helper_app and chrome_dll
389               # targets.  Use -b0 to not include any Breakpad information; that
390               # all goes into the framework's Info.plist.  Keystone information
391               # is included if Keystone is enabled.  The application reads
392               # Keystone keys from this plist and not the framework's, and
393               # the ticket will reference this Info.plist to determine the tag
394               # of the installed product.  Use -s1 to include Subversion
395               # information.  The -p flag controls whether to insert PDF as a
396               # supported type identifier that can be opened.
397               'postbuild_name': 'Tweak Info.plist',
398               'action': ['<(tweak_info_plist_path)',
399                          '-b0',
400                          '-k<(mac_keystone)',
401                          '-s1',
402                          '-p<(internal_pdf)',
403                          '<(branding)',
404                          '<(mac_bundle_id)'],
405             },
406             {
407               'postbuild_name': 'Clean up old versions',
408               'action': [
409                 'tools/build/mac/clean_up_old_versions',
410                 '<(version_full)'
411               ],
412             },
413           ],  # postbuilds
414         }],
415         ['OS=="linux"', {
416           'conditions': [
417             ['branding=="Chrome"', {
418               'dependencies': [
419                 'linux_installer_configs',
420               ],
421             }],
422             ['selinux==0', {
423               'dependencies': [
424                 '../sandbox/sandbox.gyp:sandbox',
425               ],
426             }],
427           ],
428         }],
429         ['OS != "mac"', {
430           'conditions': [
431             # TODO:  add a:
432             #   'product_name': 'chromium'
433             # whenever we convert the rest of the infrastructure
434             # (buildbots etc.) to understand the branding gyp define.
435             # NOTE: chrome/app/theme/chromium/BRANDING and
436             # chrome/app/theme/google_chrome/BRANDING have the short name
437             # "chrome" etc.; should we try to extract from there instead?
439             # On Mac, this is done in chrome_dll.gypi.
440             ['internal_pdf', {
441               'dependencies': [
442                 '../pdf/pdf.gyp:pdf',
443               ],
444             }],
445           ],
446           'dependencies': [
447             'packed_extra_resources',
448             # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
449             # file decide what to do on a per-OS basis; on Mac, internal plugins
450             # go inside the framework, so this dependency is in chrome_dll.gypi.
451             '../third_party/adobe/flash/flash_player.gyp:flash_player',
452           ],
453         }],
454         ['OS=="mac" or OS=="win"', {
455           'dependencies': [
456             # On Windows and Mac, make sure we've built chrome_dll, which
457             # contains all of the library code with Chromium functionality.
458             'chrome_dll',
459           ],
460         }],
461         ['OS=="win"', {
462           'dependencies': [
463             'installer_util',
464             'installer_util_strings',
465             '../base/base.gyp:base',
466             '../breakpad/breakpad.gyp:breakpad_handler',
467             '../breakpad/breakpad.gyp:breakpad_sender',
468             '../sandbox/sandbox.gyp:sandbox',
469             'app/locales/locales.gyp:*',
470             'app/policy/cloud_policy_codegen.gyp:policy',
471           ],
472           'msvs_settings': {
473             'VCLinkerTool': {
474               'ImportLibrary': '$(OutDir)\\lib\\chrome_exe.lib',
475               'ProgramDatabaseFile': '$(OutDir)\\chrome_exe.pdb',
476             },
477           },
478         }],
479       ],
480     },
481   ],
482   'conditions': [
483     ['OS=="win"', {
484       'targets': [
485         {
486           'target_name': 'chrome_nacl_win64',
487           'type': 'executable',
488           'product_name': 'nacl64',
489           'variables': {
490             'chrome_exe_target': 1,
491           },
492           'dependencies': [
493             # On Windows make sure we've built Win64 version of chrome_dll,
494             # which contains all of the library code with Chromium
495             # functionality.
496             'chrome_dll_nacl_win64',
497             'common_constants_win64',
498             'installer_util_nacl_win64',
499             'app/policy/cloud_policy_codegen.gyp:policy_win64',
500             '../breakpad/breakpad.gyp:breakpad_handler_win64',
501             '../breakpad/breakpad.gyp:breakpad_sender_win64',
502             '../base/base.gyp:base_nacl_win64',
503             '../sandbox/sandbox.gyp:sandbox_win64',
504           ],
505           'defines': [
506             '<@(nacl_win64_defines)',
507           ],
508           'include_dirs': [
509             '<(SHARED_INTERMEDIATE_DIR)/chrome',
510           ],
511           'msvs_settings': {
512             'VCLinkerTool': {
513               'ImportLibrary': '$(OutDir)\\lib\\nacl64_exe.lib',
514               'ProgramDatabaseFile': '$(OutDir)\\nacl64_exe.pdb',
515             },
516           },
517           'configurations': {
518             'Common_Base': {
519               'msvs_target_platform': 'x64',
520             },
521           },
522         },
523       ],
524     }],
525   ],