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