Fix build break
[chromium-blink-merge.git] / chrome / chrome_exe.gypi
blob247b4bcde5bb0c6c865c1e5921f78adb444088a0
1 # Copyright (c) 2012 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   'targets': [
7     {
8       'target_name': 'chrome',
9       'type': 'executable',
10       'mac_bundle': 1,
11       'variables': {
12         'use_system_xdg_utils%': 0,
13         'enable_wexit_time_destructors': 1,
14       },
15       'sources': [
16         'app/breakpad_field_trial_win.cc',
17         'app/breakpad_field_trial_win.h',
18         'app/breakpad_win.cc',
19         'app/breakpad_win.h',
20         'app/chrome_exe_main_aura.cc',
21         'app/chrome_exe_main_gtk.cc',
22         'app/chrome_exe_main_mac.cc',
23         'app/chrome_exe_main_win.cc',
24         'app/chrome_exe_resource.h',
25         'app/client_util.cc',
26         'app/client_util.h',
27         'app/hard_error_handler_win.cc',
28         'app/hard_error_handler_win.h',
29         'app/metro_driver_win.cc',
30         'app/metro_driver_win.h',
31         '../content/app/startup_helper_win.cc',
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         ['component == "shared_library"', {
48           'msvs_settings': {
49             'VCManifestTool': {
50               'EmbedManifest': 'false',
51             },
52           },
53         }],
54         ['order_profiling!=0 and (chromeos==1 or OS=="linux")', {
55           'dependencies' : [
56             '../tools/cygprofile/cygprofile.gyp:cygprofile',
57           ],
58         }],
59         ['order_text_section!=""', {
60           'target_conditions' : [
61             ['_toolset=="target"', {
62               'ldflags': [
63                 '-Wl,-section-ordering-file=<(order_text_section)' ],
64             }],
65           ]
66         }],
67         ['OS == "android"', {
68           # Don't put the 'chrome' target in 'all' on android
69           'suppress_wildcard': 1,
70         }],
71         ['os_posix == 1 and OS != "mac" and OS != "android"', {
72           'actions': [
73             {
74               'action_name': 'manpage',
75               'conditions': [
76                 [ 'branding == "Chrome"', {
77                   'variables': {
78                     'name': 'Google Chrome',
79                     'filename': 'google-chrome',
80                     'confdir': 'google-chrome',
81                   },
82                 }, { # else branding!="Chrome"
83                   'variables': {
84                     'name': 'Chromium',
85                     'filename': 'chromium-browser',
86                     'confdir': 'chromium',
87                   },
88                 }],
89               ],
90               'inputs': [
91                 'tools/build/linux/sed.sh',
92                 'app/resources/manpage.1.in',
93               ],
94               'outputs': [
95                 '<(PRODUCT_DIR)/chrome.1',
96               ],
97               'action': [
98                 'tools/build/linux/sed.sh',
99                 'app/resources/manpage.1.in',
100                 '<@(_outputs)',
101                 '-e', 's/@@NAME@@/<(name)/',
102                 '-e', 's/@@FILENAME@@/<(filename)/',
103                 '-e', 's/@@CONFDIR@@/<(confdir)/',
104               ],
105               'message': 'Generating manpage'
106             },
107           ],
108           'conditions': [
109             ['linux_use_tcmalloc==1', {
110                 'dependencies': [
111                   '<(allocator_target)',
112                 ],
113               },
114             ],
115             ['profiling==0 and linux_disable_pie==0', {
116               'ldflags': [
117                 '-pie',
118               ],
119             }],
120             ['use_system_xdg_utils==0', {
121               'copies': [
122                 {
123                   'destination': '<(PRODUCT_DIR)',
124                   'files': ['tools/build/linux/chrome-wrapper',
125                             '../third_party/xdg-utils/scripts/xdg-mime',
126                             '../third_party/xdg-utils/scripts/xdg-settings',
127                             ],
128                   # The wrapper script above may need to generate a .desktop
129                   # file, which requires an icon. So, copy one next to the
130                   # script.
131                   'conditions': [
132                     ['branding=="Chrome"', {
133                       'files': ['app/theme/google_chrome/product_logo_48.png']
134                     }, { # else: 'branding!="Chrome"
135                       'files': ['app/theme/chromium/product_logo_48.png']
136                     }],
137                   ],
138                 },
139               ],
140             }],
141             ['toolkit_uses_gtk == 1', {
142               'dependencies': [
143                 # On Linux, link the dependencies (libraries) that make up actual
144                 # Chromium functionality directly into the executable.
145                 '<@(chromium_dependencies)',
146                 # Needed for chrome_main.cc initialization of libraries.
147                 '../build/linux/system.gyp:gtk',
148                 # Needed to use the master_preferences functions
149                 'installer_util',
150               ],
151             }, { # else toolkit_uses_gtk == 1
152               'dependencies': [
153                 # On Linux, link the dependencies (libraries) that make up actual
154                 # Chromium functionality directly into the executable.
155                 '<@(chromium_dependencies)',
156                 # Needed for chrome_main.cc initialization of libraries.
157                 '../build/linux/system.gyp:x11',
158                 '../build/linux/system.gyp:pangocairo',
159                 '../build/linux/system.gyp:xext',
160                 # Needed to use the master_preferences functions
161                 'installer_util',
162               ],
163             }],
164           ],
165           'sources': [
166             'app/chrome_dll_resource.h',
167             'app/chrome_main.cc',
168             'app/chrome_main_delegate.cc',
169             'app/chrome_main_delegate.h',
170           ],
171         }],
172         ['OS=="mac"', {
173           # 'branding' is a variable defined in common.gypi
174           # (e.g. "Chromium", "Chrome")
175           'conditions': [
176             ['branding=="Chrome"', {
177               'mac_bundle_resources': [
178                 'app/theme/google_chrome/app.icns',
179                 'app/theme/google_chrome/document.icns',
180                 'browser/ui/cocoa/applescript/scripting.sdef',
181               ],
182             }, {  # else: 'branding!="Chrome"
183               'mac_bundle_resources': [
184                 'app/theme/chromium/app.icns',
185                 'app/theme/chromium/document.icns',
186                 'browser/ui/cocoa/applescript/scripting.sdef',
187               ],
188             }],
189             ['mac_breakpad==1', {
190               'variables': {
191                 # A real .dSYM is needed for dump_syms to operate on.
192                 'mac_real_dsym': 1,
193               },
194               'xcode_settings': {
195                 # With mac_real_dsym set, strip_from_xcode won't be used.
196                 # Specify CHROMIUM_STRIP_SAVE_FILE directly to Xcode.
197                 'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)',
198               },
199               'dependencies': [
200                 '../breakpad/breakpad.gyp:dump_syms',
201                 '../breakpad/breakpad.gyp:symupload',
203                 # In order to process symbols for the Remoting Host plugin,
204                 # that plugin needs to be built beforehand.  Since the
205                 # "Dump Symbols" step hangs off this target, that plugin also
206                 # needs to be added as a dependency.
207                 '../remoting/remoting.gyp:remoting_host_plugin',
208               ],
209               # The "Dump Symbols" post-build step is in a target_conditions
210               # block so that it will follow the "Strip If Needed" step if that
211               # is also being used.  There is no standard configuration where
212               # both of these steps occur together, but Mark likes to use this
213               # configuration sometimes when testing Breakpad-enabled builds
214               # without the time overhead of creating real .dSYM files.  When
215               # both "Dump Symbols" and "Strip If Needed" are present, "Dump
216               # Symbols" must come second because "Strip If Needed" creates
217               # a fake .dSYM that dump_syms needs to fake dump.  Since
218               # "Strip If Needed" is added in a target_conditions block in
219               # common.gypi, "Dump Symbols" needs to be in an (always true)
220               # target_conditions block.
221               'target_conditions': [
222                 ['1 == 1', {
223                   'postbuilds': [
224                     {
225                       'postbuild_name': 'Dump Symbols',
226                       'variables': {
227                         'dump_product_syms_path':
228                             'tools/build/mac/dump_product_syms',
229                       },
230                       'action': ['<(dump_product_syms_path)',
231                                  '<(branding)'],
232                     },
233                   ],
234                 }],
235               ],
236             }],  # mac_breakpad
237           ],
238           'product_name': '<(mac_product_name)',
239           'xcode_settings': {
240             # chrome/app/app-Info.plist has:
241             #   CFBundleIdentifier of CHROMIUM_BUNDLE_ID
242             #   CFBundleName of CHROMIUM_SHORT_NAME
243             #   CFBundleSignature of CHROMIUM_CREATOR
244             # Xcode then replaces these values with the branded values we set
245             # as settings on the target.
246             'CHROMIUM_BUNDLE_ID': '<(mac_bundle_id)',
247             'CHROMIUM_CREATOR': '<(mac_creator)',
248             'CHROMIUM_SHORT_NAME': '<(branding)',
249           },
250           'dependencies': [
251             'helper_app',
252             'infoplist_strings_tool',
253             'interpose_dependency_shim',
254             'chrome_manifest_bundle',
255             # On Mac, make sure we've built chrome_dll, which contains all of
256             # the library code with Chromium functionality.
257             'chrome_dll',
258           ],
259           'mac_bundle_resources': [
260             '<(PRODUCT_DIR)/<(mac_bundle_id).manifest',
261           ],
262           'actions': [
263             {
264               # Generate the InfoPlist.strings file
265               'action_name': 'Generate InfoPlist.strings files',
266               'variables': {
267                 'tool_path': '<(PRODUCT_DIR)/infoplist_strings_tool',
268                 # Unique dir to write to so the [lang].lproj/InfoPlist.strings
269                 # for the main app and the helper app don't name collide.
270                 'output_path': '<(INTERMEDIATE_DIR)/app_infoplist_strings',
271               },
272               'conditions': [
273                 [ 'branding == "Chrome"', {
274                   'variables': {
275                      'branding_name': 'google_chrome_strings',
276                   },
277                 }, { # else branding!="Chrome"
278                   'variables': {
279                      'branding_name': 'chromium_strings',
280                   },
281                 }],
282               ],
283               'inputs': [
284                 '<(tool_path)',
285                 '<(version_path)',
286                 # TODO: remove this helper when we have loops in GYP
287                 '>!@(<(apply_locales_cmd) \'<(grit_out_dir)/<(branding_name)_ZZLOCALE.pak\' <(locales))',
288               ],
289               'outputs': [
290                 # TODO: remove this helper when we have loops in GYP
291                 '>!@(<(apply_locales_cmd) -d \'<(output_path)/ZZLOCALE.lproj/InfoPlist.strings\' <(locales))',
292               ],
293               'action': [
294                 '<(tool_path)',
295                 '-b', '<(branding_name)',
296                 '-v', '<(version_path)',
297                 '-g', '<(grit_out_dir)',
298                 '-o', '<(output_path)',
299                 '-t', 'main',
300                 '<@(locales)',
301               ],
302               'message': 'Generating the language InfoPlist.strings files',
303               'process_outputs_as_mac_bundle_resources': 1,
304             },
305           ],
306           'copies': [
307             {
308               'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Versions/<(version_full)',
309               'files': [
310                 '<(PRODUCT_DIR)/<(mac_product_name) Helper.app',
311                 '<(PRODUCT_DIR)/libplugin_carbon_interpose.dylib',
312               ],
313             },
314           ],
315           'postbuilds': [
316             {
317               'postbuild_name': 'Copy <(mac_product_name) Framework.framework',
318               'action': [
319                 '../build/mac/copy_framework_unversioned.sh',
320                 '${BUILT_PRODUCTS_DIR}/<(mac_product_name) Framework.framework',
321                 '${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Versions/<(version_full)',
322               ],
323             },
324             {
325               # Modify the Info.plist as needed.  The script explains why this
326               # is needed.  This is also done in the helper_app and chrome_dll
327               # targets.  Use --breakpad=0 to not include any Breakpad
328               # information; that all goes into the framework's Info.plist.
329               # Keystone information is included if Keystone is enabled.  The
330               # application reads Keystone keys from this plist and not the
331               # framework's, and the ticket will reference this Info.plist to
332               # determine the tag of the installed product.  Use --scm=1 to
333               # include SCM information.  The --pdf flag controls whether
334               # to insert PDF as a supported type identifier that can be
335               # opened.
336               'postbuild_name': 'Tweak Info.plist',
337               'action': ['<(tweak_info_plist_path)',
338                          '--breakpad=0',
339                          '--keystone=<(mac_keystone)',
340                          '--scm=1',
341                          '--pdf=<(internal_pdf)',
342                          '--bundle_id=<(mac_bundle_id)'],
343             },
344             {
345               'postbuild_name': 'Clean up old versions',
346               'action': [
347                 'tools/build/mac/clean_up_old_versions',
348                 '<(version_full)'
349               ],
350             },
351             {
352               # This postbuid step is responsible for creating the following
353               # helpers:
354               #
355               # For unofficial Chromium branding, Chromium Helper EH.app and
356               # Chromium Helper NP.app are created from Chromium Helper.app.
357               # For official Google Chrome branding, Google Chrome Helper
358               # EH.app and Google Chrome Helper NP.app are created from
359               # Google Chrome Helper.app.
360               #
361               # The EH helper is marked for an executable heap. The NP helper
362               # is marked for no PIE (ASLR).
363               #
364               # Normally, applications shipping as part of offical builds with
365               # Google Chrome branding have dsymutil (dwarf-with-dsym,
366               # mac_real_dsym) and dump_syms (mac_breakpad) run on them to
367               # produce a .dSYM bundle and a Breakpad .sym file. This is
368               # unnecessary for the "More Helpers" because they're identical
369               # to the original helper except for the bits in their Mach-O
370               # headers that change to enable or disable special features.
371               # Each .dSYM is identified by UUID stored in a Mach-O file's
372               # LC_UUID load command. Because the "More Helpers" share a UUID
373               # with the original helper, there's no need to run dsymutil
374               # again. All helpers can share the same .dSYM. Special handling
375               # is performed in chrome/tools/build/mac/dump_product_syms to
376               # prepare their Breakpad symbol files.
377               'postbuild_name': 'Make More Helpers',
378               'action': [
379                 '../build/mac/make_more_helpers.sh',
380                 'Versions/<(version_full)',
381                 '<(mac_product_name)',
382               ],
383             },
384             {
385               # Make sure there isn't any Objective-C in the browser app's
386               # executable.
387               'postbuild_name': 'Verify No Objective-C',
388               'action': [
389                 '../build/mac/verify_no_objc.sh',
390               ],
391             },
392           ],  # postbuilds
393         }, {  # OS != "mac"
394           'conditions': [
395             # TODO:  add a:
396             #   'product_name': 'chromium'
397             # whenever we convert the rest of the infrastructure
398             # (buildbots etc.) to understand the branding gyp define.
399             # NOTE: chrome/app/theme/chromium/BRANDING and
400             # chrome/app/theme/google_chrome/BRANDING have the short name
401             # "chrome" etc.; should we try to extract from there instead?
403             # On Mac, this is done in chrome_dll.gypi.
404             ['internal_pdf', {
405               'dependencies': [
406                 '../pdf/pdf.gyp:pdf',
407               ],
408               'conditions': [
409                 # CrOS does this in a separate build step.
410                 ['OS=="linux" and chromeos==0 and linux_dump_symbols==1', {
411                   'dependencies': [
412                     '../pdf/pdf.gyp:pdf_linux_symbols',
413                   ],
414                 }], # OS=="linux" and chromeos==0 and linux_dump_symbols==1
415               ],
416             }], # internal_pdf
417           ],
418           'dependencies': [
419             'chrome_resources.gyp:packed_extra_resources',
420             'chrome_resources.gyp:packed_resources',
421             # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
422             # file decide what to do on a per-OS basis; on Mac, internal plugins
423             # go inside the framework, so this dependency is in chrome_dll.gypi.
424             '../third_party/adobe/flash/flash_player.gyp:flapper_binaries',
425             # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
426             # file decide what to do on a per-OS basis; on Mac, internal plugins
427             # go inside the framework, so this dependency is in chrome_dll.gypi.
428             '../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter',
429           ],
430         }],
431         ['OS=="mac" and asan==1', {
432           'xcode_settings': {
433             # Override the outer definition of CHROMIUM_STRIP_SAVE_FILE.
434             'CHROMIUM_STRIP_SAVE_FILE': 'app/app_asan.saves',
435           },
436         }],
437         ['OS=="linux"', {
438           'conditions': [
439             ['branding=="Chrome"', {
440               'dependencies': [
441                 'linux_installer_configs',
442               ],
443             }],
444             ['selinux==0', {
445               'dependencies': [
446                 '../sandbox/sandbox.gyp:sandbox',
447               ],
448             }],
449             # For now, do not build nacl_helper when disable_nacl=1
450             # http://code.google.com/p/gyp/issues/detail?id=239
451             ['disable_nacl==0 and coverage==0', {
452               'dependencies': [
453                 '../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp:nacl_helper_bootstrap',
454                 'nacl_helper',
455                 ],
456             }],
457           ],
458         }],
459         ['OS=="win"', {
460           'dependencies': [
461             'chrome_dll',
462             'chrome_nacl_win64',
463             'chrome_version_resources',
464             'installer_util',
465             'image_pre_reader',
466             '../base/base.gyp:base',
467             '../breakpad/breakpad.gyp:breakpad_handler',
468             '../breakpad/breakpad.gyp:breakpad_sender',
469             '../sandbox/sandbox.gyp:sandbox',
470             'app/policy/cloud_policy_codegen.gyp:policy',
471           ],
472           'sources': [
473             'app/chrome_exe.rc',
474             'common/crash_keys.cc',
475             'common/crash_keys.h',
476             '<(SHARED_INTERMEDIATE_DIR)/chrome_version/chrome_exe_version.rc',
477           ],
478           'msvs_settings': {
479             'VCLinkerTool': {
480               'ImportLibrary': '$(OutDir)\\lib\\chrome_exe.lib',
481               'DelayLoadDLLs': [
482                 'dbghelp.dll',
483                 'dwmapi.dll',
484                 'uxtheme.dll',
485                 'ole32.dll',
486                 'oleaut32.dll',
487               ],
488               # Set /SUBSYSTEM:WINDOWS for chrome.exe itself.
489               'SubSystem': '2',
490             },
491             'VCManifestTool': {
492               'AdditionalManifestFiles': '$(ProjectDir)\\app\\chrome.exe.manifest',
493             },
494           },
495           'actions': [
496             {
497               'action_name': 'first_run',
498               'inputs': [
499                   'app/FirstRun',
500               ],
501               'outputs': [
502                   '<(PRODUCT_DIR)/First Run',
503               ],
504               'action': ['cp', '-f', '<@(_inputs)', '<@(_outputs)'],
505               'message': 'Copy first run complete sentinel file',
506               'msvs_cygwin_shell': 1,
507             },
508           ],
509         }, {  # 'OS!="win"
510           'sources!': [
511             'app/client_util.cc',
512           ],
513         }],
514         ['OS=="win" and component=="shared_library"', {
515           'defines': ['COMPILE_CONTENT_STATICALLY'],
516         }],
517         ['OS=="win"', {
518           'dependencies': [
519             '../win8/metro_driver/metro_driver.gyp:*',
520             '../win8/delegate_execute/delegate_execute.gyp:*',
521           ],
522         }],
523       ],
524     },
525   ],
526   'conditions': [
527     ['OS=="win"', {
528       'targets': [
529         {
530           'target_name': 'image_pre_reader',
531           'type': 'static_library',
532           'sources': [
533             'app/image_pre_reader_win.cc',
534             'app/image_pre_reader_win.h',
535           ],
536           'dependencies': [
537              '../base/base.gyp:base',
538           ],
539         },
540       ],
541       'conditions': [
542         ['disable_nacl!=1 and target_arch=="ia32"', {
543           'targets': [
544             {
545               'target_name': 'chrome_nacl_win64',
546               'type': 'executable',
547               'product_name': 'nacl64',
548               'sources': [
549                 'app/breakpad_win.cc',
550                 'app/hard_error_handler_win.cc',
551                 'common/crash_keys.cc',
552                 'nacl/nacl_exe_win_64.cc',
553                 '../content/app/startup_helper_win.cc',
554                 '../content/common/sandbox_init_win.cc',
555                 '../content/common/sandbox_win.cc',
556                 '../content/public/common/content_switches.cc',
557                 '<(SHARED_INTERMEDIATE_DIR)/chrome_version/nacl64_exe_version.rc',
558               ],
559               'dependencies': [
560                 'app/policy/cloud_policy_codegen.gyp:policy_win64',
561                 'chrome_version_resources',
562                 'installer_util_nacl_win64',
563                 'nacl_win64',
564                 '../breakpad/breakpad.gyp:breakpad_handler_win64',
565                 '../breakpad/breakpad.gyp:breakpad_sender_win64',
566                 '../base/base.gyp:base_i18n_nacl_win64',
567                 '../base/base.gyp:base_nacl_win64',
568                 '../base/base.gyp:base_static_win64',
569                 '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
570                 '../chrome/common_constants.gyp:common_constants_win64',
571                 '../crypto/crypto.gyp:crypto_nacl_win64',
572                 '../ipc/ipc.gyp:ipc_win64',
573                 '../sandbox/sandbox.gyp:sandbox_win64',
574               ],
575               'defines': [
576                 '<@(nacl_win64_defines)',
577                 'COMPILE_CONTENT_STATICALLY',
578               ],
579               'include_dirs': [
580                 '<(SHARED_INTERMEDIATE_DIR)/chrome',
581               ],
582               'msvs_settings': {
583                 'VCLinkerTool': {
584                   'ImportLibrary': '$(OutDir)\\lib\\nacl64_exe.lib',
585                   'SubSystem': '2',         # Set /SUBSYSTEM:WINDOWS
586                 },
587               },
588               'configurations': {
589                 'Common_Base': {
590                   'msvs_target_platform': 'x64',
591                 },
592               },
593             },
594           ],
595         }, {  # else (disable_nacl==1)
596           'targets': [
597             {
598               'target_name': 'chrome_nacl_win64',
599               'type': 'none',
600               'sources': [],
601             },
602           ],
603         }],
604       ],
605     }],
606     ['test_isolation_mode != "noop"', {
607       'targets': [
608         {
609           'target_name': 'chrome_run',
610           'type': 'none',
611           'dependencies': [
612             'chrome',
613           ],
614           'includes': [
615             '../build/isolate.gypi',
616             'chrome.isolate',
617           ],
618           'sources': [
619             'chrome.isolate',
620           ],
621           'conditions': [
622             ['OS=="win"', {
623               'dependencies': [
624                 'chrome_nacl_win64',
625               ],
626             }],
627           ],
628         },
629       ],
630     }],
631   ],