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