Fix Linux compile for swarm bots.
[chromium-blink-merge.git] / content / content_shell.gypi
blobb47450c036017acc125c077b108312bc449e5060
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   'variables': {
7     'content_shell_product_name': 'Content Shell',
8   },
9   'targets': [
10     {
11       'target_name': 'content_shell_lib',
12       'type': 'static_library',
13       'defines!': ['CONTENT_IMPLEMENTATION'],
14       'variables': {
15         'chromium_code': 1,
16       },
17       'dependencies': [
18         'content_app',
19         'content_browser',
20         'content_common',
21         'content_gpu',
22         'content_plugin',
23         'content_ppapi_plugin',
24         'content_renderer',
25         'content_shell_resources',
26         'content_utility',
27         'content_worker',
28         'content_resources.gyp:content_resources',
29         '../base/base.gyp:base',
30         '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
31         '../build/temp_gyp/googleurl.gyp:googleurl',
32         '../ipc/ipc.gyp:ipc',
33         '../media/media.gyp:media',
34         '../net/net.gyp:net',
35         '../net/net.gyp:net_resources',
36         '../skia/skia.gyp:skia',
37         '../ui/ui.gyp:ui',
38         '../v8/tools/gyp/v8.gyp:v8',
39         '../webkit/support/webkit_support.gyp:webkit_support',
40         '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit',
41         '<(webkit_src_dir)/Source/WebKit/chromium/WebKit.gyp:webkit_test_support',
42       ],
43       'include_dirs': [
44         '..',
45       ],
46       'sources': [
47         'shell/geolocation/shell_access_token_store.cc',
48         'shell/geolocation/shell_access_token_store.h',
49         'shell/paths_mac.h',
50         'shell/paths_mac.mm',
51         'shell/shell.cc',
52         'shell/shell.h',
53         'shell/shell_android.cc',
54         'shell/shell_aura.cc',
55         'shell/shell_gtk.cc',
56         'shell/shell_mac.mm',
57         'shell/shell_win.cc',
58         'shell/shell_application_mac.h',
59         'shell/shell_application_mac.mm',
60         'shell/shell_browser_context.cc',
61         'shell/shell_browser_context.h',
62         'shell/shell_browser_main.cc',
63         'shell/shell_browser_main.h',
64         'shell/shell_browser_main_parts.cc',
65         'shell/shell_browser_main_parts.h',
66         'shell/shell_browser_main_parts_mac.mm',
67         'shell/shell_content_browser_client.cc',
68         'shell/shell_content_browser_client.h',
69         'shell/shell_content_client.cc',
70         'shell/shell_content_client.h',
71         'shell/shell_content_renderer_client.cc',
72         'shell/shell_content_renderer_client.h',
73         'shell/shell_devtools_delegate.cc',
74         'shell/shell_devtools_delegate.h',
75         'shell/shell_download_manager_delegate.cc',
76         'shell/shell_download_manager_delegate.h',
77         'shell/shell_javascript_dialog_creator.cc',
78         'shell/shell_javascript_dialog_creator.h',
79         'shell/shell_javascript_dialog_gtk.cc',
80         'shell/shell_javascript_dialog_mac.mm',
81         'shell/shell_javascript_dialog_win.cc',
82         'shell/shell_javascript_dialog.h',
83         'shell/shell_login_dialog_gtk.cc',
84         'shell/shell_login_dialog_mac.mm',
85         'shell/shell_login_dialog.cc',
86         'shell/shell_login_dialog.h',
87         'shell/shell_main_delegate.cc',
88         'shell/shell_main_delegate.h',
89         'shell/shell_messages.cc',
90         'shell/shell_messages.h',
91         'shell/shell_network_delegate.cc',
92         'shell/shell_network_delegate.h',
93         'shell/shell_render_process_observer.cc',
94         'shell/shell_render_process_observer.h',
95         'shell/shell_resource_context.cc',
96         'shell/shell_resource_context.h',
97         'shell/shell_resource_dispatcher_host_delegate.cc',
98         'shell/shell_resource_dispatcher_host_delegate.h',
99         'shell/shell_stacking_client_ash.cc',
100         'shell/shell_stacking_client_ash.h',
101         'shell/shell_switches.cc',
102         'shell/shell_switches.h',
103         'shell/shell_url_request_context_getter.cc',
104         'shell/shell_url_request_context_getter.h',
105         'shell/shell_web_contents_view_delegate_creator.h',
106         'shell/shell_web_contents_view_delegate_gtk.cc',
107         'shell/shell_web_contents_view_delegate_mac.mm',
108         'shell/shell_web_contents_view_delegate_win.cc',
109         'shell/shell_web_contents_view_delegate.h',
110         'shell/webkit_test_platform_support.h',
111         'shell/webkit_test_platform_support_android.cc',
112         'shell/webkit_test_platform_support_linux.cc',
113         'shell/webkit_test_platform_support_mac.mm',
114         'shell/webkit_test_platform_support_win.cc',
115         'shell/webkit_test_runner.cc',
116         'shell/webkit_test_runner.h',
117         'shell/webkit_test_runner_bindings.cc',
118         'shell/webkit_test_runner_bindings.h',
119         'shell/webkit_test_runner_host.cc',
120         'shell/webkit_test_runner_host.h',
121       ],
122       'msvs_settings': {
123         'VCLinkerTool': {
124           'SubSystem': '2',  # Set /SUBSYSTEM:WINDOWS
125         },
126       },
127       'conditions': [
128         ['OS=="win" and win_use_allocator_shim==1', {
129           'dependencies': [
130             '../base/allocator/allocator.gyp:allocator',
131           ],
132         }],
133         ['OS=="win"', {
134           'resource_include_dirs': [
135             '<(SHARED_INTERMEDIATE_DIR)/webkit',
136           ],
137           'dependencies': [
138             '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_resources',
139             '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_strings',
140           ],
141           'configurations': {
142             'Debug_Base': {
143               'msvs_settings': {
144                 'VCLinkerTool': {
145                   'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
146                 },
147               },
148             },
149           },
150         }],  # OS=="win"
151         ['OS=="android"', {
152           'dependencies': [
153             'content_shell_jni_headers',
154           ],
155           'include_dirs': [
156             '<(SHARED_INTERMEDIATE_DIR)/content/shell',
157           ],
158         }, {  # else: OS!="android"
159           'dependencies': [
160             # This dependency is for running DRT against the content shell, and
161             # this combination is not yet supported on Android.
162             '../webkit/support/webkit_support.gyp:webkit_support',
163           ],
164         }],  # OS=="android"
165         ['os_posix==1 and use_aura==1 and linux_use_tcmalloc==1', {
166           'dependencies': [
167             # This is needed by content/app/content_main_runner.cc
168             '../base/allocator/allocator.gyp:allocator',
169           ],
170         }],
171         ['use_aura==1', {
172           'dependencies': [
173             '../ui/aura/aura.gyp:aura',
174             '../ui/base/strings/ui_strings.gyp:ui_strings',
175             '../ui/views/controls/webview/webview.gyp:webview',
176             '../ui/views/views.gyp:views',
177             '../ui/views/views.gyp:views_test_support',
178             '../ui/ui.gyp:ui_resources',
179           ],
180           'sources/': [
181             ['exclude', 'shell/shell_gtk.cc'],
182             ['exclude', 'shell/shell_win.cc'],
183           ],
184         }],  # use_aura==1
185         ['chromeos==1', {
186           'dependencies': [
187             '../chromeos/chromeos.gyp:chromeos',
188            ],
189         }], # chromeos==1
190       ],
191     },
192     {
193       'target_name': 'content_shell_resources',
194       'type': 'none',
195       'dependencies': [
196         'generate_content_shell_resources',
197       ],
198       'variables': {
199         'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/content',
200       },
201       'includes': [ '../build/grit_target.gypi' ],
202       'copies': [
203         {
204           'destination': '<(PRODUCT_DIR)',
205           'files': [
206             '<(SHARED_INTERMEDIATE_DIR)/content/shell_resources.pak'
207           ],
208         },
209       ],
210     },
211     {
212       'target_name': 'generate_content_shell_resources',
213       'type': 'none',
214       'variables': {
215         'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/content',
216       },
217       'actions': [
218         {
219           'action_name': 'content_shell_resources',
220           'variables': {
221             'grit_grd_file': 'shell/shell_resources.grd',
222           },
223           'includes': [ '../build/grit_action.gypi' ],
224         },
225       ],
226     },
227     {
228       # We build a minimal set of resources so WebKit in content_shell has
229       # access to necessary resources.
230       'target_name': 'content_shell_pak',
231       'type': 'none',
232       'dependencies': [
233         'browser/debugger/devtools_resources.gyp:devtools_resources',
234         'content_shell_resources',
235         '<(DEPTH)/ui/ui.gyp:ui_resources',
236       ],
237       'variables': {
238         'repack_path': '<(DEPTH)/tools/grit/grit/format/repack.py',
239       },
240       'actions': [
241         {
242           'action_name': 'repack_content_shell_pack',
243           'variables': {
244             'pak_inputs': [
245               '<(SHARED_INTERMEDIATE_DIR)/content/content_resources.pak',
246               '<(SHARED_INTERMEDIATE_DIR)/content/shell_resources.pak',
247               '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
248               '<(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings/app_locale_settings_en-US.pak',
249               '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources_100_percent.pak',
250               '<(SHARED_INTERMEDIATE_DIR)/ui/ui_strings/ui_strings_en-US.pak',
251               '<(SHARED_INTERMEDIATE_DIR)/webkit/devtools_resources.pak',
252               '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
253               '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources_100_percent.pak',
254               '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.pak',
255             ],
256           },
257           'inputs': [
258             '<(repack_path)',
259             '<@(pak_inputs)',
260           ],
261           'action': ['python', '<(repack_path)', '<@(_outputs)',
262                      '<@(pak_inputs)'],
263           'conditions': [
264             ['OS!="android"', {
265               'outputs': [
266                 '<(PRODUCT_DIR)/content_shell.pak',
267               ],
268             }, {
269               'outputs': [
270                 '<(PRODUCT_DIR)/content_shell/assets/content_shell.pak',
271               ],
272             }],
273           ],
274         },
275       ],
276     },
277     {
278       'target_name': 'content_shell',
279       'type': 'executable',
280       'mac_bundle': 1,
281       'defines!': ['CONTENT_IMPLEMENTATION'],
282       'variables': {
283         'chromium_code': 1,
284       },
285       'dependencies': [
286         'content_shell_lib',
287         'content_shell_pak',
288         '../third_party/mesa/mesa.gyp:osmesa',
289         '<(webkit_src_dir)/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:TestRunner_resources',
290       ],
291       'include_dirs': [
292         '..',
293       ],
294       'sources': [
295         'app/startup_helper_win.cc',
296         'shell/shell_main.cc',
297       ],
298       'mac_bundle_resources': [
299         'shell/mac/app.icns',
300         'shell/mac/app-Info.plist',
301       ],
302       # TODO(mark): Come up with a fancier way to do this.  It should only
303       # be necessary to list app-Info.plist once, not the three times it is
304       # listed here.
305       'mac_bundle_resources!': [
306         'shell/mac/app-Info.plist',
307       ],
308       'xcode_settings': {
309         'INFOPLIST_FILE': 'shell/mac/app-Info.plist',
310       },
311       'msvs_settings': {
312         'VCLinkerTool': {
313           'SubSystem': '2',  # Set /SUBSYSTEM:WINDOWS
314         },
315       },
316       'conditions': [
317         ['OS=="win" and win_use_allocator_shim==1', {
318           'dependencies': [
319             '../base/allocator/allocator.gyp:allocator',
320           ],
321         }],
322         ['OS=="win"', {
323           'sources': [
324             'shell/shell.rc',
325           ],
326           'configurations': {
327             'Debug_Base': {
328               'msvs_settings': {
329                 'VCLinkerTool': {
330                   'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
331                 },
332               },
333             },
334           },
335         }],  # OS=="win"
336         ['OS == "win" or (toolkit_uses_gtk == 1 and selinux == 0)', {
337           'dependencies': [
338             '../sandbox/sandbox.gyp:sandbox',
339           ],
340         }],  # OS=="win" or (toolkit_uses_gtk == 1 and selinux == 0)
341         ['toolkit_uses_gtk == 1', {
342           'dependencies': [
343             '<(DEPTH)/build/linux/system.gyp:gtk',
344           ],
345         }],  # toolkit_uses_gtk
346         ['OS=="mac"', {
347           'product_name': '<(content_shell_product_name)',
348           'dependencies!': [
349             'content_shell_lib',
350           ],
351           'dependencies': [
352             'content_shell_framework',
353             'content_shell_helper_app',
354           ],
355           'copies': [
356             {
357               'destination': '<(PRODUCT_DIR)/<(content_shell_product_name).app/Contents/Frameworks',
358               'files': [
359                 '<(PRODUCT_DIR)/<(content_shell_product_name) Helper.app',
360               ],
361             },
362           ],
363           'postbuilds': [
364             {
365               'postbuild_name': 'Copy <(content_shell_product_name) Framework.framework',
366               'action': [
367                 '../build/mac/copy_framework_unversioned.sh',
368                 '${BUILT_PRODUCTS_DIR}/<(content_shell_product_name) Framework.framework',
369                 '${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Frameworks',
370               ],
371             },
372             {
373               'postbuild_name': 'Fix Framework Link',
374               'action': [
375                 'install_name_tool',
376                 '-change',
377                 '/Library/Frameworks/<(content_shell_product_name) Framework.framework/Versions/A/<(content_shell_product_name) Framework',
378                 '@executable_path/../Frameworks/<(content_shell_product_name) Framework.framework/<(content_shell_product_name) Framework',
379                 '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
380               ],
381             },
382             {
383               # Modify the Info.plist as needed.
384               'postbuild_name': 'Tweak Info.plist',
385               'action': ['../build/mac/tweak_info_plist.py',
386                          '--scm=1'],
387             },
388             {
389               # This postbuid step is responsible for creating the following
390               # helpers:
391               #
392               # Content Shell Helper EH.app and Content Shell Helper NP.app are
393               # created from Content Shell Helper.app.
394               #
395               # The EH helper is marked for an executable heap. The NP helper
396               # is marked for no PIE (ASLR).
397               'postbuild_name': 'Make More Helpers',
398               'action': [
399                 '../build/mac/make_more_helpers.sh',
400                 'Frameworks',
401                 '<(content_shell_product_name)',
402               ],
403             },
404             {
405               # Make sure there isn't any Objective-C in the shell's
406               # executable.
407               'postbuild_name': 'Verify No Objective-C',
408               'action': [
409                 '../build/mac/verify_no_objc.sh',
410               ],
411             },
412           ],
413         }],  # OS=="mac"
414       ],
415     },
416     {
417       'target_name': 'content_shell_builder',
418       'type': 'none',
419       'dependencies': [
420         'content_shell',
421       ],
422     },
423   ],
424   'conditions': [
425     ['OS=="mac"', {
426       'targets': [
427         {
428           'target_name': 'content_shell_framework',
429           'type': 'shared_library',
430           'product_name': '<(content_shell_product_name) Framework',
431           'mac_bundle': 1,
432           'mac_bundle_resources': [
433             'shell/mac/English.lproj/HttpAuth.xib',
434             'shell/mac/English.lproj/MainMenu.xib',
435             '<(PRODUCT_DIR)/content_shell.pak'
436           ],
437           'dependencies': [
438             'content_shell_lib',
439           ],
440           'include_dirs': [
441             '..',
442           ],
443           'sources': [
444             'shell/shell_content_main.cc',
445             'shell/shell_content_main.h',
446           ],
447           'copies': [
448             {
449               # Copy FFmpeg binaries for audio/video support.
450               'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries',
451               'files': [
452                 '<(PRODUCT_DIR)/ffmpegsumo.so',
453               ],
454             },
455           ],
456         },  # target content_shell_framework
457         {
458           'target_name': 'content_shell_helper_app',
459           'type': 'executable',
460           'variables': { 'enable_wexit_time_destructors': 1, },
461           'product_name': '<(content_shell_product_name) Helper',
462           'mac_bundle': 1,
463           'dependencies': [
464             'content_shell_framework',
465           ],
466           'sources': [
467             'shell/shell_main.cc',
468             'shell/mac/helper-Info.plist',
469           ],
470           # TODO(mark): Come up with a fancier way to do this.  It should only
471           # be necessary to list helper-Info.plist once, not the three times it
472           # is listed here.
473           'mac_bundle_resources!': [
474             'shell/mac/helper-Info.plist',
475           ],
476           # TODO(mark): For now, don't put any resources into this app.  Its
477           # resources directory will be a symbolic link to the browser app's
478           # resources directory.
479           'mac_bundle_resources/': [
480             ['exclude', '.*'],
481           ],
482           'xcode_settings': {
483             'INFOPLIST_FILE': 'shell/mac/helper-Info.plist',
484           },
485           'postbuilds': [
486             {
487               # The framework defines its load-time path
488               # (DYLIB_INSTALL_NAME_BASE) relative to the main executable
489               # (chrome).  A different relative path needs to be used in
490               # content_shell_helper_app.
491               'postbuild_name': 'Fix Framework Link',
492               'action': [
493                 'install_name_tool',
494                 '-change',
495                 '/Library/Frameworks/<(content_shell_product_name) Framework.framework/Versions/A/<(content_shell_product_name) Framework',
496                 '@executable_path/../../../../Frameworks/<(content_shell_product_name) Framework.framework/<(content_shell_product_name) Framework',
497                 '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
498               ],
499             },
500             {
501               # Modify the Info.plist as needed.  The script explains why this
502               # is needed.  This is also done in the chrome and chrome_dll
503               # targets.  In this case, --breakpad=0, --keystone=0, and --scm=0
504               # are used because Breakpad, Keystone, and SCM keys are
505               # never placed into the helper.
506               'postbuild_name': 'Tweak Info.plist',
507               'action': ['../build/mac/tweak_info_plist.py',
508                          '--breakpad=0',
509                          '--keystone=0',
510                          '--scm=0'],
511             },
512             {
513               # Make sure there isn't any Objective-C in the helper app's
514               # executable.
515               'postbuild_name': 'Verify No Objective-C',
516               'action': [
517                 '../build/mac/verify_no_objc.sh',
518               ],
519             },
520           ],
521           'conditions': [
522             ['component=="shared_library"', {
523               'xcode_settings': {
524                 'LD_RUNPATH_SEARCH_PATHS': [
525                   # Get back from Content Shell.app/Contents/Frameworks/
526                   #                                 Helper.app/Contents/MacOS
527                   '@loader_path/../../../../../..',
528                 ],
529               },
530             }],
531           ],
532         },  # target content_shell_helper_app
533       ],
534     }],  # OS=="mac"
535     ['OS=="android"', {
536       'targets': [
537         {
538           # TODO(jrg): Update this action and other jni generators to only
539           # require specifying the java directory and generate the rest.
540           'target_name': 'content_shell_jni_headers',
541           'type': 'none',
542           'sources': [
543             'shell/android/java/src/org/chromium/content_shell/ShellManager.java',
544             'shell/android/java/src/org/chromium/content_shell/Shell.java',
545           ],
546           'variables': {
547             'jni_gen_dir': 'content/shell',
548           },
549           'includes': [ '../build/jni_generator.gypi' ],
550         },
551         {
552           'target_name': 'libcontent_shell_content_view',
553           'type': 'shared_library',
554           'dependencies': [
555             'content_shell_jni_headers',
556             'content_shell_lib',
557             'content_shell_pak',
558             # Skia is necessary to ensure the dependencies needed by
559             # WebContents are included.
560             '../skia/skia.gyp:skia',
561             '<(DEPTH)/media/media.gyp:player_android',
562           ],
563           'include_dirs': [
564             '<(SHARED_INTERMEDIATE_DIR)/content/shell',
565           ],
566           'sources': [
567             'shell/android/shell_library_loader.cc',
568             'shell/android/shell_library_loader.h',
569             'shell/android/shell_manager.cc',
570             'shell/android/shell_manager.h',
571           ],
572           'sources!': [
573             'shell/shell_main.cc',
574             'shell/shell_main.h',
575           ],
576           'conditions': [
577             ['android_build_type==1', {
578               'ldflags': [
579                 '-lgabi++',  # For rtti
580               ],
581             }],
582           ],
583         },
584         {
585           # content_shell_apk creates a .jar as a side effect. Any java targets
586           # that need that .jar in their classpath should depend on this target,
587           # content_shell_java.
588           'target_name': 'content_shell_java',
589           'type': 'none',
590           'variables': {
591             'output_jar': '<(PRODUCT_DIR)/lib.java/chromium_apk_content_shell.jar'
592           },
593           'outputs': ['<(output_jar)'],
594           'dependencies': [
595             'content_java',
596             'content_shell_apk',
597             '../base/base.gyp:base_java',
598             '../media/media.gyp:media_java',
599             '../net/net.gyp:net_java',
600             '../ui/ui.gyp:ui_java',
601           ],
602           # This all_dependent_settings is used for java targets only. This will
603           # add the content_shell jar to the classpath of dependent java
604           # targets.
605           'all_dependent_settings': {
606             'variables': {
607               'input_jars_paths': ['<(output_jar)'],
608             },
609           },
610           # Add an action with the appropriate output. This allows the generated
611           # buildfiles to determine which target the output corresponds to.
612           'actions': [
613             {
614               'action_name': 'fake_generate_jar',
615               'inputs': [],
616               'outputs': ['<(output_jar)'],
617               'action': [],
618             },
619           ],
620         },
621         {
622           'target_name': 'content_shell_apk',
623           'type': 'none',
624           'dependencies': [
625             'content_java',
626             '../base/base.gyp:base_java',
627             '../media/media.gyp:media_java',
628             '../net/net.gyp:net_java',
629             '../ui/ui.gyp:ui_java',
630           ],
631           'variables': {
632             'package_name': 'content_shell',
633             'apk_name': 'ContentShell',
634             'manifest_package_name': 'org.chromium.content_shell',
635             'java_in_dir': 'shell/android/java',
636             # TODO(cjhopman): The resource directory of all apks should be in
637             # <java_in_dir>/res.
638             'resource_dir': '../res',
639             'native_libs_paths': ['<(SHARED_LIB_DIR)/libcontent_shell_content_view.so'],
640             'additional_input_paths': ['<(PRODUCT_DIR)/content_shell/assets/content_shell.pak'],
641           },
642           'includes': [ '../build/java_apk.gypi' ],
643         },
644       ],
645     }],  # OS=="android"
646   ]