Add test for the TermsOfServiceURL policy
[chromium-blink-merge.git] / chrome / chrome_exe.gypi
blob9479b024eadd0d0957736989a5b162e6dc081817
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 == "win" and use_aura==1', {
68           'sources!': [
69             # We still want the _win entry point for sandbox, etc.
70             'app/chrome_exe_main_aura.cc',
71           ],
72         }],
73         ['OS == "android"', {
74           # Don't put the 'chrome' target in 'all' on android
75           'suppress_wildcard': 1,
76         }],
77         ['os_posix == 1 and OS != "mac" and OS != "android"', {
78           'actions': [
79             {
80               'action_name': 'manpage',
81               'conditions': [
82                 [ 'branding == "Chrome"', {
83                   'variables': {
84                     'name': 'Google Chrome',
85                     'filename': 'google-chrome',
86                     'confdir': 'google-chrome',
87                   },
88                 }, { # else branding!="Chrome"
89                   'variables': {
90                     'name': 'Chromium',
91                     'filename': 'chromium-browser',
92                     'confdir': 'chromium',
93                   },
94                 }],
95               ],
96               'inputs': [
97                 'tools/build/linux/sed.sh',
98                 'app/resources/manpage.1.in',
99               ],
100               'outputs': [
101                 '<(PRODUCT_DIR)/chrome.1',
102               ],
103               'action': [
104                 'tools/build/linux/sed.sh',
105                 'app/resources/manpage.1.in',
106                 '<@(_outputs)',
107                 '-e', 's/@@NAME@@/<(name)/',
108                 '-e', 's/@@FILENAME@@/<(filename)/',
109                 '-e', 's/@@CONFDIR@@/<(confdir)/',
110               ],
111               'message': 'Generating manpage'
112             },
113           ],
114           'conditions': [
115             ['linux_use_tcmalloc==1', {
116                 'dependencies': [
117                   '<(allocator_target)',
118                 ],
119               },
120             ],
121             ['profiling==0 and linux_disable_pie==0', {
122               'ldflags': [
123                 '-pie',
124               ],
125             }],
126             ['use_system_xdg_utils==0', {
127               'copies': [
128                 {
129                   'destination': '<(PRODUCT_DIR)',
130                   'files': ['tools/build/linux/chrome-wrapper',
131                             '../third_party/xdg-utils/scripts/xdg-mime',
132                             '../third_party/xdg-utils/scripts/xdg-settings',
133                             ],
134                   # The wrapper script above may need to generate a .desktop
135                   # file, which requires an icon. So, copy one next to the
136                   # script.
137                   'conditions': [
138                     ['branding=="Chrome"', {
139                       'files': ['app/theme/google_chrome/product_logo_48.png']
140                     }, { # else: 'branding!="Chrome"
141                       'files': ['app/theme/chromium/product_logo_48.png']
142                     }],
143                   ],
144                 },
145               ],
146             }],
147             ['toolkit_uses_gtk == 1', {
148               'dependencies': [
149                 # On Linux, link the dependencies (libraries) that make up actual
150                 # Chromium functionality directly into the executable.
151                 '<@(chromium_browser_dependencies)',
152                 '<@(chromium_child_dependencies)',
153                 # Needed for chrome_main.cc initialization of libraries.
154                 '../build/linux/system.gyp:gtk',
155                 # Needed to use the master_preferences functions
156                 'installer_util',
157               ],
158             }, { # else toolkit_uses_gtk == 1
159               'dependencies': [
160                 # On Linux, link the dependencies (libraries) that make up actual
161                 # Chromium functionality directly into the executable.
162                 '<@(chromium_browser_dependencies)',
163                 '<@(chromium_child_dependencies)',
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         ['OS=="mac" and asan==1', {
440           'xcode_settings': {
441             # Override the outer definition of CHROMIUM_STRIP_SAVE_FILE.
442             'CHROMIUM_STRIP_SAVE_FILE': 'app/app_asan.saves',
443           },
444         }],
445         ['OS=="linux"', {
446           'conditions': [
447             ['branding=="Chrome"', {
448               'dependencies': [
449                 'linux_installer_configs',
450               ],
451             }],
452             # For now, do not build nacl_helper when disable_nacl=1
453             # http://code.google.com/p/gyp/issues/detail?id=239
454             ['disable_nacl==0 and coverage==0', {
455               'dependencies': [
456                 '../native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp:nacl_helper_bootstrap',
457                 'nacl_helper',
458                 ],
459             }],
460           ],
461           'dependencies': [
462             '../sandbox/sandbox.gyp:sandbox',
463           ],
464         }],
465         ['OS=="win"', {
466           'dependencies': [
467             'chrome_dll',
468             'chrome_nacl_win64',
469             'chrome_process_finder',
470             'chrome_version_resources',
471             'installer_util',
472             'image_pre_reader',
473             '../base/base.gyp:base',
474             '../breakpad/breakpad.gyp:breakpad_handler',
475             '../breakpad/breakpad.gyp:breakpad_sender',
476             '../sandbox/sandbox.gyp:sandbox',
477             'app/policy/cloud_policy_codegen.gyp:policy',
478           ],
479           'sources': [
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': '$(ProjectDir)\\app\\chrome.exe.manifest',
500             },
501           },
502           'actions': [
503             {
504               'action_name': 'first_run',
505               'inputs': [
506                   'app/FirstRun',
507               ],
508               'outputs': [
509                   '<(PRODUCT_DIR)/First Run',
510               ],
511               'action': ['cp', '-f', '<@(_inputs)', '<@(_outputs)'],
512               'message': 'Copy first run complete sentinel file',
513               'msvs_cygwin_shell': 1,
514             },
515           ],
516         }, {  # 'OS!="win"
517           'sources!': [
518             'app/client_util.cc',
519           ],
520         }],
521         ['OS=="win" and component=="shared_library"', {
522           'defines': ['COMPILE_CONTENT_STATICALLY'],
523         }],
524         ['OS=="win"', {
525           'dependencies': [
526             '../win8/metro_driver/metro_driver.gyp:*',
527             '../win8/delegate_execute/delegate_execute.gyp:*',
528           ],
529         }],
530       ],
531     },
532   ],
533   'conditions': [
534     ['OS=="win"', {
535       'targets': [
536         {
537           'target_name': 'image_pre_reader',
538           'type': 'static_library',
539           'sources': [
540             'app/image_pre_reader_win.cc',
541             'app/image_pre_reader_win.h',
542           ],
543           'dependencies': [
544              '../base/base.gyp:base',
545           ],
546         },
547       ],
548       'conditions': [
549         ['disable_nacl!=1 and target_arch=="ia32"', {
550           'targets': [
551             {
552               'target_name': 'chrome_nacl_win64',
553               'type': 'executable',
554               'product_name': 'nacl64',
555               'sources': [
556                 'app/breakpad_win.cc',
557                 'app/hard_error_handler_win.cc',
558                 'common/crash_keys.cc',
559                 'nacl/nacl_exe_win_64.cc',
560                 '../content/app/startup_helper_win.cc',
561                 '../content/common/sandbox_init_win.cc',
562                 '../content/common/sandbox_win.cc',
563                 '../content/public/common/content_switches.cc',
564                 '<(SHARED_INTERMEDIATE_DIR)/chrome_version/nacl64_exe_version.rc',
565               ],
566               'dependencies': [
567                 'app/policy/cloud_policy_codegen.gyp:policy_win64',
568                 'chrome_version_resources',
569                 'installer_util_nacl_win64',
570                 'nacl_win64',
571                 '../breakpad/breakpad.gyp:breakpad_handler_win64',
572                 '../breakpad/breakpad.gyp:breakpad_sender_win64',
573                 '../base/base.gyp:base_i18n_nacl_win64',
574                 '../base/base.gyp:base_nacl_win64',
575                 '../base/base.gyp:base_static_win64',
576                 '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations_win64',
577                 '../chrome/common_constants.gyp:common_constants_win64',
578                 '../crypto/crypto.gyp:crypto_nacl_win64',
579                 '../ipc/ipc.gyp:ipc_win64',
580                 '../sandbox/sandbox.gyp:sandbox_win64',
581               ],
582               'defines': [
583                 '<@(nacl_win64_defines)',
584                 'COMPILE_CONTENT_STATICALLY',
585               ],
586               'include_dirs': [
587                 '<(SHARED_INTERMEDIATE_DIR)/chrome',
588               ],
589               'msvs_settings': {
590                 'VCLinkerTool': {
591                   'ImportLibrary': '$(OutDir)\\lib\\nacl64_exe.lib',
592                   'SubSystem': '2',         # Set /SUBSYSTEM:WINDOWS
593                 },
594               },
595               'configurations': {
596                 'Common_Base': {
597                   'msvs_target_platform': 'x64',
598                 },
599               },
600             },
601           ],
602         }, {  # else (disable_nacl==1)
603           'targets': [
604             {
605               'target_name': 'chrome_nacl_win64',
606               'type': 'none',
607               'sources': [],
608             },
609           ],
610         }],
611       ],
612     }],
613     ['test_isolation_mode != "noop"', {
614       'targets': [
615         {
616           'target_name': 'chrome_run',
617           'type': 'none',
618           'dependencies': [
619             'chrome',
620           ],
621           'includes': [
622             '../build/isolate.gypi',
623             'chrome.isolate',
624           ],
625           'sources': [
626             'chrome.isolate',
627           ],
628           'conditions': [
629             ['OS=="win"', {
630               'dependencies': [
631                 'chrome_nacl_win64',
632               ],
633             }],
634           ],
635         },
636       ],
637     }],
638   ],