[sessions]: Componentize TabRestore code
[chromium-blink-merge.git] / chrome / chrome_exe.gypi
blob5d6ed4ea721ec1dc6cd876debf46ba33b26d1655
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': 'none',
10       'dependencies': [ 'chrome_initial', ],
11       'conditions': [
12         ['OS == "win"', {
13           'actions': [
14             {
15               'variables': {
16                 'reorder_py_path': '<(DEPTH)/build/win/reorder-imports.py',
17                 # See comment in chrome_dll.gypi in the hardlink_to_output
18                 # target for why this cannot be 'initial' like the DLL.
19                 'exe_input_path':'$(OutDir)\\initialexe',
20                 'exe_output_path':'<(PRODUCT_DIR)',
21               },
22               'action_name': 'reorder_imports',
23               'inputs': [
24                 '<(reorder_py_path)',
25                 '$(OutDir)\\initialexe\\chrome.exe',
26               ],
27               'outputs': [
28                 '<(PRODUCT_DIR)\\chrome.exe',
29                 '<(PRODUCT_DIR)\\chrome.exe.pdb',
30               ],
31               'action': [
32                 'python',
33                 '<(reorder_py_path)',
34                 '-i', '<(exe_input_path)',
35                 '-o', '<(exe_output_path)',
36                 '-a', '<(target_arch)',
37               ],
38               'message': 'Reordering Imports',
39             },
40           ],
41         }],
42       ],
43     },
44     {
45       # GN version: //chrome
46       'target_name': 'chrome_initial',
47       'type': 'executable',
48       # Name the exe chrome.exe, not chrome_initial.exe.
49       'product_name': 'chrome',
50       'mac_bundle': 1,
51       'variables': {
52         'use_system_xdg_utils%': 0,
53         'enable_wexit_time_destructors': 1,
54       },
55       'sources': [
56         # Note that due to InitializeSandboxInfo, this must be directly linked
57         # into chrome.exe, not into a dependent.
58         '<(DEPTH)/content/app/startup_helper_win.cc',
59         '<(DEPTH)/content/public/common/content_switches.cc',
60         'app/chrome_exe_load_config_win.cc',
61         'app/chrome_exe_main_aura.cc',
62         'app/chrome_exe_main_mac.cc',
63         'app/chrome_exe_main_win.cc',
64         'app/chrome_exe_resource.h',
65         'app/chrome_watcher_client_win.cc',
66         'app/chrome_watcher_client_win.h',
67         'app/chrome_watcher_command_line_win.cc',
68         'app/chrome_watcher_command_line_win.h',
69         'app/client_util.cc',
70         'app/client_util.h',
71         'app/kasko_client.cc',
72         'app/kasko_client.h',
73         'app/signature_validator_win.cc',
74         'app/signature_validator_win.h',
75       ],
76       'mac_bundle_resources': [
77         'app/app-Info.plist',
78       ],
79       # TODO(mark): Come up with a fancier way to do this.  It should only
80       # be necessary to list app-Info.plist once, not the three times it is
81       # listed here.
82       'mac_bundle_resources!': [
83         'app/app-Info.plist',
84       ],
85       'xcode_settings': {
86         'CHROMIUM_STRIP_SAVE_FILE': 'app/app.saves',
87         'INFOPLIST_FILE': 'app/app-Info.plist',
88       },
89       'conditions': [
90         ['order_text_section!=""', {
91           'target_conditions' : [
92             ['_toolset=="target"', {
93               'ldflags': [
94                 '-Wl,-section-ordering-file=<(order_text_section)' ],
95             }],
96           ]
97         }],
98         ['OS == "win"', {
99           'dependencies': [
100             'chrome_watcher',
101             'chrome_watcher_client',
102             '../components/components.gyp:browser_watcher_client',
103           ],
104           'conditions': [
105             ['kasko==1', {
106               'dependencies': [
107                 'kasko_dll',
108               ],
109             }],
110           ],
111         }],
112         ['OS == "android"', {
113           # Don't put the 'chrome' target in 'all' on android
114           'suppress_wildcard': 1,
115         }],
116         ['os_posix == 1 and OS != "mac" and OS != "android"', {
117           'actions': [
118             {
119               'action_name': 'manpage',
120               'conditions': [
121                 [ 'branding == "Chrome"', {
122                   'variables': {
123                     'name': 'Google Chrome',
124                     'filename': 'google-chrome',
125                     'confdir': 'google-chrome',
126                   },
127                 }, { # else branding!="Chrome"
128                   'variables': {
129                     'name': 'Chromium',
130                     'filename': 'chromium-browser',
131                     'confdir': 'chromium',
132                   },
133                 }],
134               ],
135               'inputs': [
136                 'tools/build/linux/sed.py',
137                 'app/resources/manpage.1.in',
138               ],
139               'outputs': [
140                 '<(PRODUCT_DIR)/chrome.1',
141               ],
142               'action': [
143                 'python',
144                 'tools/build/linux/sed.py',
145                 'app/resources/manpage.1.in',
146                 '<@(_outputs)',
147                 '-e', 's/@@NAME@@/<(name)/',
148                 '-e', 's/@@FILENAME@@/<(filename)/',
149                 '-e', 's/@@CONFDIR@@/<(confdir)/',
150               ],
151               'message': 'Generating manpage'
152             },
153           ],
154           'conditions': [
155             ['use_allocator!="none"', {
156                 'dependencies': [
157                   '<(allocator_target)',
158                 ],
159               },
160             ],
161             ['profiling==0 and linux_disable_pie==0', {
162               'ldflags': [
163                 '-pie',
164               ],
165             }],
166             ['use_system_xdg_utils==0', {
167               'copies': [
168                 {
169                   'destination': '<(PRODUCT_DIR)',
170                   'files': ['tools/build/linux/chrome-wrapper',
171                             '../third_party/xdg-utils/scripts/xdg-mime',
172                             '../third_party/xdg-utils/scripts/xdg-settings',
173                             'app/theme/<(branding_path_component)/product_logo_48.png',
174                             ],
175                 },
176               ],
177             }],
178             # x11 build. Needed for chrome_main.cc initialization of libraries.
179             ['use_x11==1', {
180               'dependencies': [
181                 '../build/linux/system.gyp:x11',
182                 '../build/linux/system.gyp:xext',
183               ],
184             }],
185             ['OS=="linux" and enable_plugins==1', {
186               'dependencies': [
187                 '../pdf/pdf.gyp:pdf',
188               ],
189             }],
190           ],
191           'sources': [
192             'app/chrome_dll_resource.h',
193             'app/chrome_main.cc',
194             'app/chrome_main_delegate.cc',
195             'app/chrome_main_delegate.h',
196           ],
197           'dependencies': [
198             # On Linux, link the dependencies (libraries) that make up actual
199             # Chromium functionality directly into the executable.
200             '<@(chromium_browser_dependencies)',
201             '<@(chromium_child_dependencies)',
202             '../content/content.gyp:content_app_both',
203             # Needed for chrome_main.cc initialization of libraries.
204             '../build/linux/system.gyp:pangocairo',
205             # Needed to use the master_preferences functions
206             'installer_util',
207           ],
208         }],
209         ['OS=="mac"', {
210           'conditions': [
211             ['mac_breakpad==1', {
212               'variables': {
213                 # A real .dSYM is needed for dump_syms to operate on.
214                 'mac_real_dsym': 1,
215               },
216               'xcode_settings': {
217                 # With mac_real_dsym set, strip_from_xcode won't be used.
218                 # Specify CHROMIUM_STRIP_SAVE_FILE directly to Xcode.
219                 'STRIPFLAGS': '-s $(CHROMIUM_STRIP_SAVE_FILE)',
220               },
221               'dependencies': [
222                 '../breakpad/breakpad.gyp:dump_syms',
223                 '../breakpad/breakpad.gyp:symupload',
224               ],
225               # The "Dump Symbols" post-build step is in a target_conditions
226               # block so that it will follow the "Strip If Needed" step if that
227               # is also being used.  There is no standard configuration where
228               # both of these steps occur together, but Mark likes to use this
229               # configuration sometimes when testing Breakpad-enabled builds
230               # without the time overhead of creating real .dSYM files.  When
231               # both "Dump Symbols" and "Strip If Needed" are present, "Dump
232               # Symbols" must come second because "Strip If Needed" creates
233               # a fake .dSYM that dump_syms needs to fake dump.  Since
234               # "Strip If Needed" is added in a target_conditions block in
235               # common.gypi, "Dump Symbols" needs to be in an (always true)
236               # target_conditions block.
237               'target_conditions': [
238                 ['1 == 1', {
239                   'postbuilds': [
240                     {
241                       'postbuild_name': 'Dump Symbols',
242                       'variables': {
243                         'dump_product_syms_path':
244                             'tools/build/mac/dump_product_syms',
245                       },
246                       'action': ['<(dump_product_syms_path)',
247                                  '<(branding)'],
248                     },
249                   ],
250                 }],
251               ],
252             }],  # mac_breakpad
253           ],
254           'product_name': '<(mac_product_name)',
255           'xcode_settings': {
256             # chrome/app/app-Info.plist has:
257             #   CFBundleIdentifier of CHROMIUM_BUNDLE_ID
258             #   CFBundleName of CHROMIUM_SHORT_NAME
259             #   CFBundleSignature of CHROMIUM_CREATOR
260             # Xcode then replaces these values with the branded values we set
261             # as settings on the target.
262             'CHROMIUM_BUNDLE_ID': '<(mac_bundle_id)',
263             'CHROMIUM_CREATOR': '<(mac_creator)',
264             'CHROMIUM_SHORT_NAME': '<(branding)',
265           },
266           'dependencies': [
267             '../components/components.gyp:chrome_manifest_bundle',
268             'helper_app',
269             'infoplist_strings_tool',
270             # On Mac, make sure we've built chrome_dll, which contains all of
271             # the library code with Chromium functionality.
272             'chrome_dll',
273           ],
274           'mac_bundle_resources': [
275             'app/theme/<(branding_path_component)/mac/app.icns',
276             'app/theme/<(branding_path_component)/mac/document.icns',
277             'browser/ui/cocoa/applescript/scripting.sdef',
278             '<(PRODUCT_DIR)/<(mac_bundle_id).manifest',
279           ],
280           'actions': [
281             {
282               # Generate the InfoPlist.strings file
283               'action_name': 'Generate InfoPlist.strings files',
284               'variables': {
285                 'tool_path': '<(PRODUCT_DIR)/infoplist_strings_tool',
286                 # Unique dir to write to so the [lang].lproj/InfoPlist.strings
287                 # for the main app and the helper app don't name collide.
288                 'output_path': '<(INTERMEDIATE_DIR)/app_infoplist_strings',
289                 'branding_name': '<(branding_path_component)_strings',
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               ],
320             },
321           ],
322           'postbuilds': [
323             {
324               'postbuild_name': 'Copy <(mac_product_name) Framework.framework',
325               'action': [
326                 '../build/mac/copy_framework_unversioned.sh',
327                 '${BUILT_PRODUCTS_DIR}/<(mac_product_name) Framework.framework',
328                 '${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Versions/<(version_full)',
329               ],
330             },
331             {
332               # Modify the Info.plist as needed.  The script explains why this
333               # is needed.  This is also done in the helper_app and chrome_dll
334               # targets.  Use --breakpad=0 to not include any Breakpad
335               # information; that all goes into the framework's Info.plist.
336               # Keystone information is included if Keystone is enabled.  The
337               # application reads Keystone keys from this plist and not the
338               # framework's, and the ticket will reference this Info.plist to
339               # determine the tag of the installed product.  Use --scm=1 to
340               # include SCM information.
341               'postbuild_name': 'Tweak Info.plist',
342               'action': ['<(tweak_info_plist_path)',
343                          '--breakpad=0',
344                          '--keystone=<(mac_keystone)',
345                          '--scm=1',
346                          '--bundle_id=<(mac_bundle_id)'],
347             },
348             {
349               'postbuild_name': 'Clean up old versions',
350               'action': [
351                 'tools/build/mac/clean_up_old_versions',
352                 '<(version_full)'
353               ],
354             },
355             {
356               # This postbuid step is responsible for creating the following
357               # helpers:
358               #
359               # Currently no helpers are produced (crbug.com/520680), but
360               # more will be added soon (crbug.com/497190).
361               #
362               # Normally, applications shipping as part of offical builds with
363               # Google Chrome branding have dsymutil (dwarf-with-dsym,
364               # mac_real_dsym) and dump_syms (mac_breakpad) run on them to
365               # produce a .dSYM bundle and a Breakpad .sym file. This is
366               # unnecessary for the "More Helpers" because they're identical
367               # to the original helper except for the bits in their Mach-O
368               # headers that change to enable or disable special features.
369               # Each .dSYM is identified by UUID stored in a Mach-O file's
370               # LC_UUID load command. Because the "More Helpers" share a UUID
371               # with the original helper, there's no need to run dsymutil
372               # again. All helpers can share the same .dSYM. Special handling
373               # is performed in chrome/tools/build/mac/dump_product_syms to
374               # prepare their Breakpad symbol files.
375               'postbuild_name': 'Make More Helpers',
376               'action': [
377                 '../build/mac/make_more_helpers.sh',
378                 'Versions/<(version_full)',
379                 '<(mac_product_name)',
380               ],
381             },
382             {
383               # Make sure there isn't any Objective-C in the browser app's
384               # executable.
385               'postbuild_name': 'Verify No Objective-C',
386               'action': [
387                 '../build/mac/verify_no_objc.sh',
388               ],
389             },
390           ],  # postbuilds
391         }, {  # OS != "mac"
392           'conditions': [
393             # TODO:  add a:
394             #   'product_name': 'chromium'
395             # whenever we convert the rest of the infrastructure
396             # (buildbots etc.) to understand the branding gyp define.
397             # NOTE: chrome/app/theme/chromium/BRANDING and
398             # chrome/app/theme/google_chrome/BRANDING have the short name
399             # "chrome" etc.; should we try to extract from there instead?
400           ],
401           'dependencies': [
402             '../components/components.gyp:startup_metric_utils',
403             'chrome_resources.gyp:packed_extra_resources',
404             'chrome_resources.gyp:packed_resources',
405             # Copy Flash Player files to PRODUCT_DIR if applicable. Let the .gyp
406             # file decide what to do on a per-OS basis; on Mac, internal plugins
407             # go inside the framework, so this dependency is in chrome_dll.gypi.
408             '../third_party/adobe/flash/flash_player.gyp:flapper_binaries',
409             # Copy CDM files to PRODUCT_DIR if applicable. Let the .gyp
410             # file decide what to do on a per-OS basis; on Mac, internal plugins
411             # go inside the framework, so this dependency is in chrome_dll.gypi.
412             '../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmadapter',
413           ],
414         }],
415         ['chrome_multiple_dll', {
416           'defines': ['CHROME_MULTIPLE_DLL'],
417         }],
418         ['OS=="linux"', {
419           'conditions': [
420             ['branding=="Chrome"', {
421               'dependencies': [
422                 'linux_installer_configs',
423               ],
424             }],
425             # For now, do not build nacl_helper when disable_nacl=1
426             # http://code.google.com/p/gyp/issues/detail?id=239
427             ['disable_nacl==0', {
428               'dependencies': [
429                 '../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp:nacl_helper_bootstrap',
430                 '../components/nacl.gyp:nacl_helper',
431                 '../components/nacl_nonsfi.gyp:nacl_helper_nonsfi',
432               ],
433             }],
434           ],
435           'dependencies': [
436             '../sandbox/sandbox.gyp:sandbox',
437           ],
438         }],
439         ['OS=="win"', {
440           'dependencies': [
441             'chrome_dll',
442             'chrome_nacl_win64',
443             'chrome_process_finder',
444             'chrome_version_resources',
445             'installer_util',
446             'image_pre_reader',
447             '../base/base.gyp:base',
448             '../crypto/crypto.gyp:crypto',
449             '../breakpad/breakpad.gyp:breakpad_handler',
450             '../breakpad/breakpad.gyp:breakpad_sender',
451             '../chrome_elf/chrome_elf.gyp:chrome_elf',
452             '../components/components.gyp:crash_component',
453             '../components/components.gyp:crash_keys',
454             '../sandbox/sandbox.gyp:sandbox',
455             '../ui/gfx/gfx.gyp:gfx',
456             '../win8/metro_driver/metro_driver.gyp:metro_driver',
457             '../win8/delegate_execute/delegate_execute.gyp:*',
458           ],
459           'sources': [
460             '<(SHARED_INTERMEDIATE_DIR)/chrome_version/chrome_exe_version.rc',
461             'app/chrome_crash_reporter_client.cc',
462             'app/chrome_crash_reporter_client.h',
463             'app/chrome_exe.rc',
464             'common/crash_keys.cc',
465             'common/crash_keys.h',
466           ],
467           'sources!': [
468             # We still want the _win entry point for sandbox, etc.
469             'app/chrome_exe_main_aura.cc',
470           ],
471           'msvs_settings': {
472             'VCLinkerTool': {
473               'ImportLibrary': '$(OutDir)\\lib\\chrome_exe.lib',
474               'OutputFile': '$(OutDir)\\initialexe\\chrome.exe',
475               'DelayLoadDLLs': [
476                 'dbghelp.dll',
477                 'dwmapi.dll',
478                 'uxtheme.dll',
479                 'ole32.dll',
480                 'oleaut32.dll',
481               ],
482               'AdditionalDependencies': [
483                 'wintrust.lib',
484                 'crypt32.lib'
485               ],
486               'conditions': [
487                 ['asan==0', {
488                   # Set /SUBSYSTEM:WINDOWS for chrome.exe itself, except for the
489                   # AddressSanitizer build where console output is important.
490                   'SubSystem': '2',
491                 }],
492               ],
493             },
494             'VCManifestTool': {
495               'AdditionalManifestFiles': [
496                 '$(ProjectDir)\\app\\chrome.exe.manifest',
497                 '<(SHARED_INTERMEDIATE_DIR)/chrome/app/version_assembly/version_assembly.manifest',
498               ],
499             },
500           },
501           'conditions': [
502             ['configuration_policy==1', {
503               'dependencies': [
504                 '<(DEPTH)/components/components.gyp:policy',
505               ],
506             }],
507           ],
508           'actions': [
509             {
510               'action_name': 'first_run',
511               'inputs': [
512                   'app/FirstRun',
513               ],
514               'outputs': [
515                   '<(PRODUCT_DIR)/First Run',
516               ],
517               'action': ['python', '../build/cp.py', '<@(_inputs)', '<@(_outputs)'],
518               'message': 'Copy first run complete sentinel file',
519             },
520             {
521               # GN version: //chrome/app/version_assembly:chrome_exe_manifest
522               'action_name': 'chrome_exe_manifest',
523               'includes': [
524                   'app/version_assembly/chrome_exe_manifest_action.gypi',
525               ],
526             },
527             {
528               # GN version: //chrome/app/version_assembly:version_assembly_manifest
529               'action_name': 'version_assembly_manifest',
530               'includes': [
531                   'app/version_assembly/version_assembly_manifest_action.gypi',
532               ],
533             },
534           ],
535         }, {  # 'OS!="win"
536           'sources!': [
537             'app/client_util.cc',
538           ],
539         }],
540         ['OS=="win" and component=="shared_library"', {
541           'defines': ['COMPILE_CONTENT_STATICALLY'],
542         }],
543       ],
544     },
545   ],
546   'conditions': [
547     ['OS=="win"', {
548       'targets': [
549         {
550           'target_name': 'image_pre_reader',
551           'type': 'static_library',
552           'sources': [
553             'app/image_pre_reader_win.cc',
554             'app/image_pre_reader_win.h',
555           ],
556           'dependencies': [
557              '../base/base.gyp:base',
558           ],
559         },
560       ],
561       'conditions': [
562         ['disable_nacl!=1 and target_arch=="ia32"', {
563           'targets': [
564             {
565               'target_name': 'chrome_nacl_win64',
566               'type': 'executable',
567               'product_name': 'nacl64',
568               'sources': [
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                 '../content/public/common/sandboxed_process_launcher_delegate.cc',
574                 '<(SHARED_INTERMEDIATE_DIR)/chrome_version/nacl64_exe_version.rc',
575                 'app/chrome_crash_reporter_client.cc',
576                 'common/crash_keys.cc',
577                 'nacl/nacl_exe_win_64.cc',
578               ],
579               'dependencies': [
580                 'chrome_version_resources',
581                 'installer_util_nacl_win64',
582                 '../base/base.gyp:base_i18n_nacl_win64',
583                 '../base/base.gyp:base_win64',
584                 '../base/base.gyp:base_static_win64',
585                 '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
586                 '../breakpad/breakpad.gyp:breakpad_handler_win64',
587                 '../breakpad/breakpad.gyp:breakpad_sender_win64',
588                 '../components/components.gyp:breakpad_win64',
589                 '../components/components.gyp:crash_keys_win64',
590                 '../chrome/common_constants.gyp:common_constants_win64',
591                 '../components/nacl.gyp:nacl_win64',
592                 '../crypto/crypto.gyp:crypto_nacl_win64',
593                 '../ipc/ipc.gyp:ipc_win64',
594                 '../sandbox/sandbox.gyp:sandbox_win64',
595               ],
596               'defines': [
597                 '<@(nacl_win64_defines)',
598                 'COMPILE_CONTENT_STATICALLY',
599               ],
600               'include_dirs': [
601                 '<(SHARED_INTERMEDIATE_DIR)/chrome',
602               ],
603               'msvs_settings': {
604                 'VCLinkerTool': {
605                   'ImportLibrary': '$(OutDir)\\lib\\nacl64_exe.lib',
606                   'SubSystem': '2',         # Set /SUBSYSTEM:WINDOWS
607                 },
608               },
609               'configurations': {
610                 'Common_Base': {
611                   'msvs_target_platform': 'x64',
612                 },
613               },
614               'conditions': [
615                 ['configuration_policy==1', {
616                   'dependencies': [
617                     '<(DEPTH)/components/components.gyp:policy_win64',
618                   ],
619                 }],
620               ],
621             },
622           ],
623         }, {  # else (disable_nacl==1)
624           'targets': [
625             {
626               'target_name': 'chrome_nacl_win64',
627               'type': 'none',
628               'sources': [],
629             },
630           ],
631         }],
632       ],
633     }],
634     ['test_isolation_mode != "noop"', {
635       'targets': [
636         {
637           'target_name': 'chrome_run',
638           'type': 'none',
639           'dependencies': [
640             'chrome',
641             # Runtime dependencies
642             '../third_party/mesa/mesa.gyp:osmesa',
643           ],
644           'includes': [
645             '../build/isolate.gypi',
646           ],
647           'sources': [
648             'chrome.isolate',
649           ],
650           'conditions': [
651             ['OS=="win"', {
652               'dependencies': [
653                 'chrome_nacl_win64',
654               ],
655             }],
656           ],
657         },
658       ],
659     }],
660   ],