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