Fix app list and overflow icon drawing problems
[chromium-blink-merge.git] / chrome / chrome_exe.gypi
blob431d1367915c7ff0574b8d2a2a9d2b174e72af6a
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:flash_player',
425             '../third_party/adobe/flash/flash_player.gyp:flapper_binaries',
426           ],
427         }],
428         ['OS=="mac" and asan==1', {
429           'xcode_settings': {
430             # Override the outer definition of CHROMIUM_STRIP_SAVE_FILE.
431             'CHROMIUM_STRIP_SAVE_FILE': 'app/app_asan.saves',
432           },
433         }],
434         ['OS=="linux"', {
435           'conditions': [
436             ['branding=="Chrome"', {
437               'dependencies': [
438                 'linux_installer_configs',
439               ],
440             }],
441             ['selinux==0', {
442               'dependencies': [
443                 '../sandbox/sandbox.gyp:sandbox',
444               ],
445             }],
446             # For now, do not build nacl_helper when disable_nacl=1
447             # or when arm is enabled
448             # http://code.google.com/p/gyp/issues/detail?id=239
449             ['disable_nacl==0 and target_arch!="arm" and coverage==0', {
450               'dependencies': [
451                 '../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp:nacl_helper_bootstrap',
452                 'nacl_helper',
453                 ],
454             }],
455           ],
456         }],
457         ['OS=="win"', {
458           'dependencies': [
459             'chrome_dll',
460             'chrome_version_resources',
461             'installer_util',
462             'image_pre_reader',
463             '../base/base.gyp:base',
464             '../breakpad/breakpad.gyp:breakpad_handler',
465             '../breakpad/breakpad.gyp:breakpad_sender',
466             '../sandbox/sandbox.gyp:sandbox',
467             'app/policy/cloud_policy_codegen.gyp:policy',
468           ],
469           'sources': [
470             'app/chrome_exe.rc',
471             '<(SHARED_INTERMEDIATE_DIR)/chrome_version/chrome_exe_version.rc',
472           ],
473           'msvs_settings': {
474             'VCLinkerTool': {
475               'ImportLibrary': '$(OutDir)\\lib\\chrome_exe.lib',
476               'ProgramDatabaseFile': '$(OutDir)\\chrome_exe.pdb',
477               'DelayLoadDLLs': [
478                 'dbghelp.dll',
479                 'dwmapi.dll',
480                 'uxtheme.dll',
481                 'ole32.dll',
482                 'oleaut32.dll',
483               ],
484               # Set /SUBSYSTEM:WINDOWS for chrome.exe itself.
485               'SubSystem': '2',
486             },
487             'VCManifestTool': {
488               'AdditionalManifestFiles': '$(ProjectDir)\\app\\chrome.exe.manifest',
489             },
490           },
491           'actions': [
492             {
493               'action_name': 'first_run',
494               'inputs': [
495                   'app/FirstRun',
496               ],
497               'outputs': [
498                   '<(PRODUCT_DIR)/First Run',
499               ],
500               'action': ['cp', '-f', '<@(_inputs)', '<@(_outputs)'],
501               'message': 'Copy first run complete sentinel file',
502             },
503           ],
504         }, {  # 'OS!="win"
505           'sources!': [
506             'app/client_util.cc',
507           ],
508         }],
509         ['OS=="win" and component=="shared_library"', {
510           'defines': ['COMPILE_CONTENT_STATICALLY'],
511         }],
512         ['OS=="win" and (MSVS_VERSION=="2010" or MSVS_VERSION=="2010e")', {
513           'dependencies': [
514             '../win8/metro_driver/metro_driver.gyp:*',
515             '../win8/delegate_execute/delegate_execute.gyp:*',
516           ],
517         }],
518       ],
519     },
520   ],
521   'conditions': [
522     ['OS=="win"', {
523       'targets': [
524         {
525           'target_name': 'image_pre_reader',
526           'type': 'static_library',
527           'sources': [
528             'app/image_pre_reader_win.cc',
529             'app/image_pre_reader_win.h',
530           ],
531           'dependencies': [
532              '../base/base.gyp:base',
533           ],
534         },
535       ],
536       'conditions': [
537         ['disable_nacl!=1', {
538           'targets': [
539             {
540               'target_name': 'chrome_nacl_win64',
541               'type': 'executable',
542               'product_name': 'nacl64',
543               'sources': [
544                 'app/breakpad_win.cc',
545                 'app/hard_error_handler_win.cc',
546                 'nacl/nacl_exe_win_64.cc',
547                 '../content/app/startup_helper_win.cc',
548                 '../content/common/debug_flags.cc',  # Needed for sandbox_policy.cc
549                 '../content/common/sandbox_init_win.cc',
550                 '../content/common/sandbox_policy.cc',
551                 '../content/public/common/content_switches.cc',
552                 '<(SHARED_INTERMEDIATE_DIR)/chrome_version/nacl64_exe_version.rc',
553               ],
554               'dependencies': [
555                 'app/policy/cloud_policy_codegen.gyp:policy_win64',
556                 'chrome_version_resources',
557                 'common_constants_win64',
558                 'installer_util_nacl_win64',
559                 'nacl_win64',
560                 '../breakpad/breakpad.gyp:breakpad_handler_win64',
561                 '../breakpad/breakpad.gyp:breakpad_sender_win64',
562                 '../base/base.gyp:base_i18n_nacl_win64',
563                 '../base/base.gyp:base_nacl_win64',
564                 '../base/base.gyp:base_static_win64',
565                 '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
566                 '../crypto/crypto.gyp:crypto_nacl_win64',
567                 '../ipc/ipc.gyp:ipc_win64',
568                 '../sandbox/sandbox.gyp:sandbox_win64',
569               ],
570               'defines': [
571                 '<@(nacl_win64_defines)',
572                 'COMPILE_CONTENT_STATICALLY',
573               ],
574               'include_dirs': [
575                 '<(SHARED_INTERMEDIATE_DIR)/chrome',
576               ],
577               'msvs_settings': {
578                 'VCLinkerTool': {
579                   'ImportLibrary': '$(OutDir)\\lib\\nacl64_exe.lib',
580                   'ProgramDatabaseFile': '$(OutDir)\\nacl64_exe.pdb',
581                   'SubSystem': '2',         # Set /SUBSYSTEM:WINDOWS
582                 },
583               },
584               'configurations': {
585                 'Common_Base': {
586                   'msvs_target_platform': 'x64',
587                 },
588               },
589             },
590           ],
591         }, {  # else (disable_nacl==1)
592           'targets': [
593             {
594               'target_name': 'chrome_nacl_win64',
595               'type': 'none',
596               'sources': [],
597             },
598           ],
599         }],
600       ],
601     }],
602   ],