4af2e9a7feec3f533b607c2e6865062e12a4f91e
[WebKit-https.git] / Source / WebCore / WebCore.gyp / WebCore.gyp
1 #
2 # Copyright (C) 2009 Google Inc. All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
7 #
8 #     * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 #     * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
13 # distribution.
14 #     * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #
30
31 {
32   'includes': [
33     # FIXME: Sense whether upstream or downstream build, and
34     # include the right features.gypi
35     '../../../Source/WebKit/chromium/features.gypi',
36     '../WebCore.gypi',
37   ],
38   # Location of the chromium src directory.
39   'conditions': [
40     ['inside_chromium_build==0', {
41       # Webkit is being built outside of the full chromium project.
42       'variables': {
43         'chromium_src_dir': '../../../Source/WebKit/chromium',
44         'libjpeg_gyp_path': '<(chromium_src_dir)/third_party/libjpeg/libjpeg.gyp',
45       },
46     },{
47       # WebKit is checked out in src/chromium/third_party/WebKit
48       'variables': {
49         'chromium_src_dir': '../../../../..',
50       },
51     }],
52     ['OS == "mac"', {
53       'targets': [
54         {
55           # On the Mac, libWebKitSystemInterface*.a is used to help WebCore
56           # interface with the system.  This library is supplied as a static
57           # library in binary format.  At present, it contains many global
58           # symbols not marked private_extern.  It should be considered an
59           # implementation detail of WebCore, and does not need these symbols
60           # to be exposed so widely.
61           #
62           # This target contains an action that cracks open the existing
63           # static library and rebuilds it with these global symbols
64           # transformed to private_extern.
65           'target_name': 'webkit_system_interface',
66           'type': 'static_library',
67           'variables': {
68             'adjusted_library_path':
69                 '<(PRODUCT_DIR)/libWebKitSystemInterfaceLeopardPrivateExtern.a',
70           },
71           'sources': [
72             # An empty source file is needed to convince Xcode to produce
73             # output for this target.  The resulting library won't actually
74             # contain anything.  The library at adjusted_library_path will,
75             # and that library is pushed to dependents of this target below.
76             'mac/Empty.cpp',
77           ],
78           'actions': [
79             {
80               'action_name': 'Adjust Visibility',
81               'inputs': [
82                 'mac/adjust_visibility.sh',
83                 '../../../WebKitLibraries/libWebKitSystemInterfaceLeopard.a',
84               ],
85               'outputs': [
86                 '<(adjusted_library_path)',
87               ],
88               'action': [
89                 '<@(_inputs)',
90                 '<@(_outputs)',
91                 '<(INTERMEDIATE_DIR)/adjust_visibility',  # work directory
92               ],
93             },
94           ],  # actions
95           'link_settings': {
96             'libraries': [
97               '<(adjusted_library_path)',
98             ],
99           },  # link_settings
100         },  # target webkit_system_interface
101       ],  # targets
102     }],  # condition OS == "mac"
103     ['OS!="win" and remove_webcore_debug_symbols==1', {
104       # Remove -g from all targets defined here.
105       'target_defaults': {
106         'cflags!': ['-g'],
107       },
108     }],
109     ['OS=="linux" and target_arch=="arm"', {
110       # Due to a bug in gcc arm, we get warnings about uninitialized timesNewRoman.unstatic.3258
111       # and colorTransparent.unstatic.4879.
112       'target_defaults': {
113         'cflags': ['-Wno-uninitialized'],
114       },
115     }],
116   ],  # conditions
117
118   'variables': {
119     # If set to 1, doesn't compile debug symbols into webcore reducing the
120     # size of the binary and increasing the speed of gdb.  gcc only.
121     'remove_webcore_debug_symbols%': 0,
122
123     # If set to 0, doesn't build SVG support, reducing the size of the
124     # binary and increasing the speed of gdb.
125     'enable_svg%': 1,
126
127     # Use v8 as default JavaScript engine. This makes sure that javascript_engine variable
128     # is set for both inside_chromium_build 0 and 1 cases.
129     'javascript_engine%': 'v8',
130
131     'webcore_include_dirs': [
132       '../',
133       '../accessibility',
134       '../accessibility/chromium',
135       '../bindings',
136       '../bindings/generic',
137       '../bindings/v8',
138       '../bindings/v8/custom',
139       '../bindings/v8/specialization',
140       '../css',
141       '../dom',
142       '../dom/default',
143       '../editing',
144       '../fileapi',
145       '../history',
146       '../html',
147       '../html/canvas',
148       '../html/parser',
149       '../html/shadow',
150       '../inspector',
151       '../loader',
152       '../loader/appcache',
153       '../loader/archive',
154       '../loader/cache',
155       '../loader/icon',
156       '../mathml',
157       '../notifications',
158       '../page',
159       '../page/animation',
160       '../page/chromium',
161       '../platform',
162       '../platform/animation',
163       '../platform/audio',
164       '../platform/audio/chromium',
165       '../platform/chromium',
166       '../platform/graphics',
167       '../platform/graphics/chromium',
168       '../platform/graphics/filters',
169       '../platform/graphics/gpu',
170       '../platform/graphics/opentype',
171       '../platform/graphics/skia',
172       '../platform/graphics/transforms',
173       '../platform/image-decoders',
174       '../platform/image-decoders/bmp',
175       '../platform/image-decoders/gif',
176       '../platform/image-decoders/ico',
177       '../platform/image-decoders/jpeg',
178       '../platform/image-decoders/png',
179       '../platform/image-decoders/skia',
180       '../platform/image-decoders/xbm',
181       '../platform/image-decoders/webp',
182       '../platform/image-encoders/skia',
183       '../platform/mock',
184       '../platform/network',
185       '../platform/network/chromium',
186       '../platform/sql',
187       '../platform/text',
188       '../platform/text/transcoder',
189       '../plugins',
190       '../plugins/chromium',
191       '../rendering',
192       '../rendering/style',
193       '../rendering/svg',
194       '../storage',
195       '../storage/chromium',
196       '../svg',
197       '../svg/animation',
198       '../svg/graphics',
199       '../svg/graphics/filters',
200       '../svg/properties',
201       '../thirdparty/glu',
202       '../webaudio',
203       '../websockets',
204       '../workers',
205       '../xml',
206     ],
207
208     'bindings_idl_files': [
209       '<@(webcore_bindings_idl_files)',
210     ],
211
212     'bindings_idl_files!': [
213       # Custom bindings in bindings/v8/custom exist for these.
214       '../dom/EventListener.idl',
215       '../dom/EventTarget.idl',
216       '../html/VoidCallback.idl',
217
218       # Bindings with custom Objective-C implementations.
219       '../page/AbstractView.idl',
220
221       # These bindings are excluded, as they're only used through inheritance and don't define constants that would need a constructor.
222       '../svg/ElementTimeControl.idl',
223       '../svg/SVGExternalResourcesRequired.idl',
224       '../svg/SVGFilterPrimitiveStandardAttributes.idl',
225       '../svg/SVGFitToViewBox.idl',
226
227       '../svg/SVGLangSpace.idl',
228       '../svg/SVGLocatable.idl',
229       '../svg/SVGStylable.idl',
230       '../svg/SVGTests.idl',
231       '../svg/SVGTransformable.idl',
232       '../svg/SVGViewSpec.idl',
233       '../svg/SVGZoomAndPan.idl',
234
235       # FIXME: I don't know why these are excluded, either.
236       # Someone (me?) should figure it out and add appropriate comments.
237       '../css/CSSUnknownRule.idl',
238     ],
239
240     'conditions': [
241       # TODO(maruel): Move it in its own project or generate it anyway?
242       ['enable_svg!=0', {
243         'bindings_idl_files': [
244           '<@(webcore_svg_bindings_idl_files)',
245         ],
246       }],
247       ['OS=="mac"', {
248         'webcore_include_dirs+': [
249           # platform/graphics/cg and cocoa need to come before
250           # platform/graphics/chromium so that the Mac build picks up the
251           # version of ImageBufferData.h in the cg directory and
252           # FontPlatformData.h in the cocoa directory.  The + prepends this
253           # directory to the list.
254           # FIXME: This shouldn't need to be prepended.
255           '../platform/graphics/cocoa',
256           '../platform/graphics/cg',
257         ],
258         'webcore_include_dirs': [
259           # FIXME: Eliminate dependency on platform/mac and related
260           # directories.
261           # FIXME: Eliminate dependency on platform/graphics/mac and
262           # related directories.
263           # platform/graphics/cg may need to stick around, though.
264           '../platform/audio/mac',
265           '../platform/graphics/mac',
266           '../platform/mac',
267           '../platform/text/mac',
268         ],
269       }],
270       ['OS=="win"', {
271         'webcore_include_dirs': [
272           '../page/win',
273           '../platform/audio/win',
274           '../platform/graphics/win',
275           '../platform/text/win',
276           '../platform/win',
277         ],
278       },{
279         # enable -Wall and -Werror, just for Mac and Linux builds for now
280         # FIXME: Also enable this for Windows after verifying no warnings
281         'chromium_code': 1,
282       }],
283       ['OS=="win" and buildtype=="Official"', {
284         # On windows official release builds, we try to preserve symbol space.
285         'derived_sources_aggregate_files': [
286           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSourcesAll.cpp',
287         ],
288       },{
289         'derived_sources_aggregate_files': [
290           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSources1.cpp',
291           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSources2.cpp',
292           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSources3.cpp',
293           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSources4.cpp',
294           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSources5.cpp',
295           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSources6.cpp',
296           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSources7.cpp',
297           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8DerivedSources8.cpp',
298         ],
299       }],
300     ],
301   },
302   'targets': [
303     {
304       'target_name': 'inspector_protocol_sources',
305       'type': 'none',
306       'actions': [
307         {
308           'action_name': 'generateInspectorProtocolSources',
309           # The second input item will be used as item name in vcproj.
310           # It is not possible to put Inspector.idl there because
311           # all idl files are marking as excluded by gyp generator.
312           'inputs': [
313             '../bindings/scripts/generate-bindings.pl',
314             '../inspector/CodeGeneratorInspector.pm',
315             '../bindings/scripts/CodeGenerator.pm',
316             '../bindings/scripts/IDLParser.pm',
317             '../bindings/scripts/IDLStructure.pm',
318             '../inspector/Inspector.idl',
319           ],
320           'outputs': [
321             '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendDispatcher.cpp',
322             '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendStub.js',
323             '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorBackendDispatcher.h',
324             '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorFrontend.cpp',
325             '<(SHARED_INTERMEDIATE_DIR)/webkit/InspectorFrontend.h',
326           ],
327           'variables': {
328             'generator_include_dirs': [
329             ],
330           },
331           'action': [
332             'python',
333             'scripts/rule_binding.py',
334             '../inspector/Inspector.idl',
335             '<(SHARED_INTERMEDIATE_DIR)/webcore',
336             '<(SHARED_INTERMEDIATE_DIR)/webkit',
337             '--',
338             '<@(_inputs)',
339             '--',
340             '--defines', '<(feature_defines) LANGUAGE_JAVASCRIPT',
341             '--generator', 'Inspector',
342             '<@(generator_include_dirs)'
343           ],
344           'message': 'Generating Inspector protocol sources from Inspector.idl',
345         },
346       ]
347     },
348     {
349       'target_name': 'injected_script_source',
350       'type': 'none',
351       'actions': [
352         {
353           'action_name': 'generateInjectedScriptSource',
354           'inputs': [
355             '../inspector/InjectedScriptSource.js',
356           ],
357           'outputs': [
358             '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptSource.h',
359           ],
360           'action': [
361             'perl',
362             '../inspector/xxd.pl',
363             'InjectedScriptSource_js',
364             '../inspector/InjectedScriptSource.js',
365             '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptSource.h'
366           ],
367           'message': 'Generating InjectedScriptSource.h from InjectedScriptSource.js',
368         },
369       ]
370     },
371     {
372       'target_name': 'webcore_bindings_sources',
373       'type': 'none',
374       'hard_dependency': 1,
375       'sources': [
376         # bison rule
377         '../css/CSSGrammar.y',
378         '../xml/XPathGrammar.y',
379
380         # gperf rule
381         '../html/DocTypeStrings.gperf',
382         '../platform/ColorData.gperf',
383
384         # idl rules
385         '<@(bindings_idl_files)',
386       ],
387       'actions': [
388         # Actions to build derived sources.
389         {
390           'action_name': 'HTMLEntityTable',
391           'inputs': [
392             '../html/parser/HTMLEntityNames.in',
393           ],
394           'outputs': [
395             '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLEntityTable.cpp'
396           ],
397           'action': [
398             'python',
399             '../html/parser/create-html-entity-table',
400             '-o',
401             '<@(_outputs)',
402             '<@(_inputs)'
403           ],
404         },
405         {
406           'action_name': 'CSSPropertyNames',
407           'inputs': [
408             '../css/makeprop.pl',
409             '../css/CSSPropertyNames.in',
410           ],
411           'outputs': [
412             '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSPropertyNames.cpp',
413             '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSPropertyNames.h',
414           ],
415           'action': [
416             'python',
417             'scripts/action_csspropertynames.py',
418             '<@(_outputs)',
419             '--',
420             '<@(_inputs)'
421           ],
422           'conditions': [
423             # TODO(maruel): Move it in its own project or generate it anyway?
424             ['enable_svg!=0', {
425               'inputs': [
426                 '../css/SVGCSSPropertyNames.in',
427               ],
428             }],
429           ],
430         },
431         {
432           'action_name': 'CSSValueKeywords',
433           'inputs': [
434             '../css/makevalues.pl',
435             '../css/CSSValueKeywords.in',
436           ],
437           'outputs': [
438             '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.cpp',
439             '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.h',
440           ],
441           'action': [
442             'python',
443             'scripts/action_cssvaluekeywords.py',
444             '<@(_outputs)',
445             '--',
446             '<@(_inputs)'
447           ],
448           'conditions': [
449             # TODO(maruel): Move it in its own project or generate it anyway?
450             ['enable_svg!=0', {
451               'inputs': [
452                 '../css/SVGCSSValueKeywords.in',
453               ],
454             }],
455           ],
456         },
457         {
458           'action_name': 'HTMLNames',
459           'inputs': [
460             '../dom/make_names.pl',
461             '../html/HTMLTagNames.in',
462             '../html/HTMLAttributeNames.in',
463           ],
464           'outputs': [
465             '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.cpp',
466             '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.h',
467             '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLElementFactory.cpp',
468             '<(SHARED_INTERMEDIATE_DIR)/webkit/V8HTMLElementWrapperFactory.cpp',
469             '<(SHARED_INTERMEDIATE_DIR)/webkit/V8HTMLElementWrapperFactory.h',
470           ],
471           'action': [
472             'python',
473             'scripts/action_makenames.py',
474             '<@(_outputs)',
475             '--',
476             '<@(_inputs)',
477             '--',
478             '--factory',
479             '--wrapperFactoryV8',
480             '--extraDefines', '<(feature_defines)'
481           ],
482         },
483         {
484           'action_name': 'SVGNames',
485           'inputs': [
486             '../dom/make_names.pl',
487             '../svg/svgtags.in',
488             '../svg/svgattrs.in',
489           ],
490           'outputs': [
491             '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGNames.cpp',
492             '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGNames.h',
493             '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGElementFactory.cpp',
494             '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGElementFactory.h',
495             '<(SHARED_INTERMEDIATE_DIR)/webkit/V8SVGElementWrapperFactory.cpp',
496             '<(SHARED_INTERMEDIATE_DIR)/webkit/V8SVGElementWrapperFactory.h',
497           ],
498           'action': [
499             'python',
500             'scripts/action_makenames.py',
501             '<@(_outputs)',
502             '--',
503             '<@(_inputs)',
504             '--',
505             '--factory',
506             '--wrapperFactoryV8',
507             '--extraDefines', '<(feature_defines)'
508           ],
509         },
510         {
511           'action_name': 'MathMLNames',
512           'inputs': [
513             '../dom/make_names.pl',
514             '../mathml/mathtags.in',
515             '../mathml/mathattrs.in',
516           ],
517           'outputs': [
518             '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLNames.cpp',
519             '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLNames.h',
520             '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLElementFactory.cpp',
521             '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLElementFactory.h',
522           ],
523           'action': [
524             'python',
525             'scripts/action_makenames.py',
526             '<@(_outputs)',
527             '--',
528             '<@(_inputs)',
529             '--',
530             '--factory',
531             '--extraDefines', '<(feature_defines)'
532           ],
533         },
534         {
535           'action_name': 'UserAgentStyleSheets',
536           'inputs': [
537             '../css/make-css-file-arrays.pl',
538             '../css/html.css',
539             '../css/quirks.css',
540             '../css/view-source.css',
541             '../css/themeChromiumLinux.css',
542             '../css/themeChromiumSkia.css',
543             '../css/themeWin.css',
544             '../css/themeWinQuirks.css',
545             '../css/svg.css',
546             '../css/mathml.css',
547             '../css/mediaControls.css',
548             '../css/mediaControlsChromium.css',
549           ],
550           'outputs': [
551             '<(SHARED_INTERMEDIATE_DIR)/webkit/UserAgentStyleSheets.h',
552             '<(SHARED_INTERMEDIATE_DIR)/webkit/UserAgentStyleSheetsData.cpp',
553           ],
554           'action': [
555             'python',
556             'scripts/action_useragentstylesheets.py',
557             '<@(_outputs)',
558             '--',
559             '<@(_inputs)'
560           ],
561         },
562         {
563           'action_name': 'XLinkNames',
564           'inputs': [
565             '../dom/make_names.pl',
566             '../svg/xlinkattrs.in',
567           ],
568           'outputs': [
569             '<(SHARED_INTERMEDIATE_DIR)/webkit/XLinkNames.cpp',
570             '<(SHARED_INTERMEDIATE_DIR)/webkit/XLinkNames.h',
571           ],
572           'action': [
573             'python',
574             'scripts/action_makenames.py',
575             '<@(_outputs)',
576             '--',
577             '<@(_inputs)',
578             '--',
579             '--extraDefines', '<(feature_defines)'
580           ],
581         },
582         {
583           'action_name': 'XMLNSNames',
584           'inputs': [
585             '../dom/make_names.pl',
586             '../xml/xmlnsattrs.in',
587           ],
588           'outputs': [
589             '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNSNames.cpp',
590             '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNSNames.h',
591           ],
592           'action': [
593             'python',
594             'scripts/action_makenames.py',
595             '<@(_outputs)',
596             '--',
597             '<@(_inputs)',
598             '--',
599             '--extraDefines', '<(feature_defines)'
600           ],
601         },
602         {
603           'action_name': 'XMLNames',
604           'inputs': [
605             '../dom/make_names.pl',
606             '../xml/xmlattrs.in',
607           ],
608           'outputs': [
609             '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNames.cpp',
610             '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNames.h',
611           ],
612           'action': [
613             'python',
614             'scripts/action_makenames.py',
615             '<@(_outputs)',
616             '--',
617             '<@(_inputs)',
618             '--',
619             '--extraDefines', '<(feature_defines)'
620           ],
621         },
622         {
623           'action_name': 'tokenizer',
624           'inputs': [
625             '../css/maketokenizer',
626             '../css/tokenizer.flex',
627           ],
628           'outputs': [
629             '<(SHARED_INTERMEDIATE_DIR)/webkit/tokenizer.cpp',
630           ],
631           'action': [
632             'python',
633             'scripts/action_maketokenizer.py',
634             '<@(_outputs)',
635             '--',
636             '<@(_inputs)'
637           ],
638         },
639         {
640           'action_name': 'derived_sources_all_in_one',
641           'variables': {
642             # Write sources into a file, so that the action command line won't
643             # exceed OS limites.
644             'idls_list_temp_file': '<|(idls_list_temp_file.tmp <@(bindings_idl_files))',
645           },
646           'inputs': [
647             'scripts/action_derivedsourcesallinone.py',
648             '<(idls_list_temp_file)',
649             '<!@(cat <(idls_list_temp_file))',
650           ],
651           'outputs': [
652             '<@(derived_sources_aggregate_files)',
653           ],
654           'action': [
655             'python',
656             'scripts/action_derivedsourcesallinone.py',
657             '<(idls_list_temp_file)',
658             '--',
659             '<@(derived_sources_aggregate_files)',
660           ],
661         },
662       ],
663       'rules': [
664         # Rules to build derived sources.
665         {
666           'rule_name': 'bison',
667           'extension': 'y',
668           'outputs': [
669             '<(SHARED_INTERMEDIATE_DIR)/webkit/<(RULE_INPUT_ROOT).cpp',
670             '<(SHARED_INTERMEDIATE_DIR)/webkit/<(RULE_INPUT_ROOT).h'
671           ],
672           'action': [
673             'python',
674             'scripts/rule_bison.py',
675             '<(RULE_INPUT_PATH)',
676             '<(SHARED_INTERMEDIATE_DIR)/webkit'
677           ],
678         },
679         {
680           'rule_name': 'gperf',
681           'extension': 'gperf',
682           #
683           # gperf outputs are generated by WebCore/make-hash-tools.pl
684           #
685           'outputs': [
686             '<(SHARED_INTERMEDIATE_DIR)/webkit/<(RULE_INPUT_ROOT).cpp',
687           ],
688           'inputs': [
689             '../make-hash-tools.pl',
690           ],
691           'action': [
692             'perl',
693             '../make-hash-tools.pl',
694             '<(SHARED_INTERMEDIATE_DIR)/webkit',
695             '<(RULE_INPUT_PATH)',
696           ],
697         },
698         # Rule to build generated JavaScript (V8) bindings from .idl source.
699         {
700           'rule_name': 'binding',
701           'extension': 'idl',
702           'msvs_external_rule': 1,
703           'inputs': [
704             '../bindings/scripts/generate-bindings.pl',
705             '../bindings/scripts/CodeGenerator.pm',
706             '../bindings/scripts/CodeGeneratorV8.pm',
707             '../bindings/scripts/IDLParser.pm',
708             '../bindings/scripts/IDLStructure.pm',
709           ],
710           'outputs': [
711             # FIXME:  The .cpp file should be in webkit/bindings once
712             # we coax GYP into supporting it (see 'action' below).
713             '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings/V8<(RULE_INPUT_ROOT).cpp',
714             '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings/V8<(RULE_INPUT_ROOT).h',
715           ],
716           'variables': {
717             'generator_include_dirs': [
718               '--include', '../css',
719               '--include', '../dom',
720               '--include', '../fileapi',
721               '--include', '../html',
722               '--include', '../notifications',
723               '--include', '../page',
724               '--include', '../plugins',
725               '--include', '../storage',
726               '--include', '../svg',
727               '--include', '../webaudio',
728               '--include', '../websockets',
729               '--include', '../workers',
730               '--include', '../xml',
731             ],
732           },
733           # FIXME:  Note that we put the .cpp files in webcore/bindings
734           # but the .h files in webkit/bindings.  This is to work around
735           # the unfortunate fact that GYP strips duplicate arguments
736           # from lists.  When we have a better GYP way to suppress that
737           # behavior, change the output location.
738           'action': [
739             'python',
740             'scripts/rule_binding.py',
741             '<(RULE_INPUT_PATH)',
742             '<(SHARED_INTERMEDIATE_DIR)/webcore/bindings',
743             '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings',
744             '--',
745             '<@(_inputs)',
746             '--',
747             '--defines', '<(feature_defines) LANGUAGE_JAVASCRIPT V8_BINDING',
748             '--generator', 'V8',
749             '<@(generator_include_dirs)'
750           ],
751           'message': 'Generating binding from <(RULE_INPUT_PATH)',
752         },
753       ],
754     },
755     {
756       'target_name': 'webcore_bindings',
757       'type': '<(library)',
758       'hard_dependency': 1,
759       'dependencies': [
760         'webcore_bindings_sources',
761         'inspector_protocol_sources',
762         'injected_script_source',
763         '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:yarr',
764         '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
765         '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
766         '<(chromium_src_dir)/skia/skia.gyp:skia',
767         '<(chromium_src_dir)/third_party/iccjpeg/iccjpeg.gyp:iccjpeg',
768         '<(chromium_src_dir)/third_party/libpng/libpng.gyp:libpng',
769         '<(chromium_src_dir)/third_party/libxml/libxml.gyp:libxml',
770         '<(chromium_src_dir)/third_party/libxslt/libxslt.gyp:libxslt',
771         '<(chromium_src_dir)/third_party/libwebp/libwebp.gyp:libwebp',
772         '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
773         '<(chromium_src_dir)/third_party/sqlite/sqlite.gyp:sqlite',
774         '<(libjpeg_gyp_path):libjpeg',
775       ],
776       'include_dirs': [
777         '<(INTERMEDIATE_DIR)',
778         # FIXME:  Remove <(SHARED_INTERMEDIATE_DIR)/webcore when we
779         # can entice gyp into letting us put both the .cpp and .h
780         # files in the same output directory.
781         '<(SHARED_INTERMEDIATE_DIR)/webcore',
782         '<(SHARED_INTERMEDIATE_DIR)/webkit',
783         '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings',
784         '<@(webcore_include_dirs)',
785       ],
786       'direct_dependent_settings': {
787         'include_dirs': [
788           '<(SHARED_INTERMEDIATE_DIR)/webkit',
789           '<(SHARED_INTERMEDIATE_DIR)/webkit/bindings',
790         ],
791       },
792       'sources': [
793         # These files include all the .cpp files generated from the .idl files
794         # in webcore_files.
795         '<@(derived_sources_aggregate_files)',
796
797         # Additional .cpp files for HashTools.h
798         '<(SHARED_INTERMEDIATE_DIR)/webkit/DocTypeStrings.cpp',
799         '<(SHARED_INTERMEDIATE_DIR)/webkit/ColorData.cpp',
800         '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSPropertyNames.cpp',
801         '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSValueKeywords.cpp',
802
803         # Additional .cpp files from webcore_bindings_sources actions.
804         '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLElementFactory.cpp',
805         '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.cpp',
806         '<(SHARED_INTERMEDIATE_DIR)/webkit/UserAgentStyleSheetsData.cpp',
807         '<(SHARED_INTERMEDIATE_DIR)/webkit/V8HTMLElementWrapperFactory.cpp',
808         '<(SHARED_INTERMEDIATE_DIR)/webkit/XLinkNames.cpp',
809         '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNSNames.cpp',
810         '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNames.cpp',
811         '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGNames.cpp',
812         '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLElementFactory.cpp',
813         '<(SHARED_INTERMEDIATE_DIR)/webkit/MathMLNames.cpp',
814
815         # Generated from HTMLEntityNames.in
816         '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLEntityTable.cpp',
817
818         # Additional .cpp files from the webcore_bindings_sources rules.
819         '<(SHARED_INTERMEDIATE_DIR)/webkit/CSSGrammar.cpp',
820         '<(SHARED_INTERMEDIATE_DIR)/webkit/XPathGrammar.cpp',
821
822         # Additional .cpp files from the webcore_inspector_sources list.
823         '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorFrontend.cpp',
824         '<(SHARED_INTERMEDIATE_DIR)/webcore/InspectorBackendDispatcher.cpp',
825       ],
826       'conditions': [
827         ['javascript_engine=="v8"', {
828           'dependencies': [
829             '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
830           ],
831           'conditions': [
832             ['inside_chromium_build==1 and OS=="win" and component=="shared_library"', {
833               'defines': [
834                 'USING_V8_SHARED',
835               ],
836             }],
837           ],
838         }],
839         # TODO(maruel): Move it in its own project or generate it anyway?
840         ['enable_svg!=0', {
841           'sources': [
842             '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGElementFactory.cpp',
843             '<(SHARED_INTERMEDIATE_DIR)/webkit/V8SVGElementWrapperFactory.cpp',
844          ],
845         }],
846         ['OS=="mac"', {
847           'include_dirs': [
848             '../../../WebKitLibraries',
849           ],
850         }],
851         ['OS=="win"', {
852           'dependencies': [
853             '<(chromium_src_dir)/build/win/system.gyp:cygwin'
854           ],
855           'defines': [
856             'WEBCORE_NAVIGATOR_PLATFORM="Win32"',
857             '__PRETTY_FUNCTION__=__FUNCTION__',
858           ],
859           # This is needed because Event.h in this directory is blocked
860           # by a system header on windows.
861           'include_dirs++': ['../dom'],
862           'direct_dependent_settings': {
863             'include_dirs+++': ['../dom'],
864           },
865         }],
866         # FIXME: (kbr) ideally this target should just depend on webcore_prerequisites
867         # to pick up these include directories, but I'm nervous about making that change.
868         ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_MKL=1" in feature_defines', {
869           'include_dirs': [
870             '<(chromium_src_dir)/third_party/mkl/include',
871           ],
872         }],
873         ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
874           'include_dirs': [
875             '<(chromium_src_dir)/third_party/fftw/api',
876           ],
877         }],
878       ],
879     },
880     {
881       # We'll soon split libwebcore in multiple smaller libraries.
882       # webcore_prerequisites will be the 'base' target of every sub-target.
883       'target_name': 'webcore_prerequisites',
884       'type': 'none',
885       'dependencies': [
886         'webcore_bindings',
887         '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:yarr',
888         '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
889         '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
890         '<(chromium_src_dir)/skia/skia.gyp:skia',
891         '<(chromium_src_dir)/third_party/iccjpeg/iccjpeg.gyp:iccjpeg',
892         '<(chromium_src_dir)/third_party/libwebp/libwebp.gyp:libwebp',
893         '<(chromium_src_dir)/third_party/libpng/libpng.gyp:libpng',
894         '<(chromium_src_dir)/third_party/libxml/libxml.gyp:libxml',
895         '<(chromium_src_dir)/third_party/libxslt/libxslt.gyp:libxslt',
896         '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
897         '<(chromium_src_dir)/third_party/ots/ots.gyp:ots',
898         '<(chromium_src_dir)/third_party/sqlite/sqlite.gyp:sqlite',
899         '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:translator_common',
900         '<(libjpeg_gyp_path):libjpeg',
901       ],
902       'export_dependent_settings': [
903         'webcore_bindings',
904         '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:yarr',
905         '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
906         '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
907         '<(chromium_src_dir)/skia/skia.gyp:skia',
908         '<(chromium_src_dir)/third_party/iccjpeg/iccjpeg.gyp:iccjpeg',
909         '<(chromium_src_dir)/third_party/libwebp/libwebp.gyp:libwebp',
910         '<(chromium_src_dir)/third_party/libpng/libpng.gyp:libpng',
911         '<(chromium_src_dir)/third_party/libxml/libxml.gyp:libxml',
912         '<(chromium_src_dir)/third_party/libxslt/libxslt.gyp:libxslt',
913         '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
914         '<(chromium_src_dir)/third_party/ots/ots.gyp:ots',
915         '<(chromium_src_dir)/third_party/sqlite/sqlite.gyp:sqlite',
916         '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:translator_common',
917         '<(libjpeg_gyp_path):libjpeg',
918       ],
919       # This is needed for mac because of webkit_system_interface. It'd be nice
920       # if this hard dependency could be split off the rest.
921       'hard_dependency': 1,
922       'direct_dependent_settings': {
923         'defines': [
924           'WEBCORE_NAVIGATOR_VENDOR="Google Inc."',
925         ],
926         'include_dirs': [
927           '<(INTERMEDIATE_DIR)',
928           '<@(webcore_include_dirs)',
929           '<(chromium_src_dir)/gpu',
930           '<(chromium_src_dir)/third_party/angle/include/GLSLANG',
931         ],
932         'mac_framework_dirs': [
933           '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework/Frameworks',
934         ],
935         'msvs_disabled_warnings': [
936           4138, 4244, 4291, 4305, 4344, 4355, 4521, 4099,
937         ],
938         'scons_line_length' : 1,
939         'xcode_settings': {
940           # Some Mac-specific parts of WebKit won't compile without having this
941           # prefix header injected.
942           # FIXME: make this a first-class setting.
943           'GCC_PREFIX_HEADER': '../WebCorePrefix.h',
944         },
945       },
946       'conditions': [
947         ['javascript_engine=="v8"', {
948           'dependencies': [
949             '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
950           ],
951           'export_dependent_settings': [
952             '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
953           ],
954           'conditions': [
955             ['inside_chromium_build==1 and OS=="win" and component=="shared_library"', {
956               'direct_dependent_settings': {
957                 'defines': [
958                   'USING_V8_SHARED',
959                 ],
960               },
961             }],
962           ],
963         }],
964         ['use_accelerated_compositing==1', {
965           'dependencies': [
966             '<(chromium_src_dir)/gpu/gpu.gyp:gles2_c_lib',
967           ],
968           'export_dependent_settings': [
969             '<(chromium_src_dir)/gpu/gpu.gyp:gles2_c_lib',
970           ],
971         }],
972         ['OS=="linux" or OS=="freebsd"', {
973           'dependencies': [
974             '<(chromium_src_dir)/build/linux/system.gyp:fontconfig',
975             '<(chromium_src_dir)/build/linux/system.gyp:gtk',
976           ],
977           'export_dependent_settings': [
978             '<(chromium_src_dir)/build/linux/system.gyp:fontconfig',
979             '<(chromium_src_dir)/build/linux/system.gyp:gtk',
980           ],
981           'direct_dependent_settings': {
982             'cflags': [
983               # WebCore does not work with strict aliasing enabled.
984               # https://bugs.webkit.org/show_bug.cgi?id=25864
985               '-fno-strict-aliasing',
986             ],
987           },
988         }],
989         ['OS=="linux"', {
990           'direct_dependent_settings': {
991             'defines': [
992               # Mozilla on Linux effectively uses uname -sm, but when running
993               # 32-bit x86 code on an x86_64 processor, it uses
994               # "Linux i686 (x86_64)".  Matching that would require making a
995               # run-time determination.
996               'WEBCORE_NAVIGATOR_PLATFORM="Linux i686"',
997             ],
998           },
999         }],
1000         ['OS=="mac"', {
1001           'dependencies': [
1002             'webkit_system_interface',
1003           ],
1004           'export_dependent_settings': [
1005             'webkit_system_interface',
1006           ],
1007           'direct_dependent_settings': {
1008             'defines': [
1009               # Match Safari and Mozilla on Mac x86.
1010               'WEBCORE_NAVIGATOR_PLATFORM="MacIntel"',
1011
1012               # Chromium's version of WebCore includes the following Objective-C
1013               # classes. The system-provided WebCore framework may also provide
1014               # these classes. Because of the nature of Objective-C binding
1015               # (dynamically at runtime), it's possible for the
1016               # Chromium-provided versions to interfere with the system-provided
1017               # versions.  This may happen when a system framework attempts to
1018               # use WebCore.framework, such as when converting an HTML-flavored
1019               # string to an NSAttributedString.  The solution is to force
1020               # Objective-C class names that would conflict to use alternate
1021               # names.
1022               #
1023               # This list will hopefully shrink but may also grow.  Its
1024               # performance is monitored by the "Check Objective-C Rename"
1025               # postbuild step, and any suspicious-looking symbols not handled
1026               # here or whitelisted in that step will cause a build failure.
1027               #
1028               # If this is unhandled, the console will receive log messages
1029               # such as:
1030               # com.google.Chrome[] objc[]: Class ScrollbarPrefsObserver is implemented in both .../Google Chrome.app/Contents/Versions/.../Google Chrome Helper.app/Contents/MacOS/../../../Google Chrome Framework.framework/Google Chrome Framework and /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/WebCore. One of the two will be used. Which one is undefined.
1031               'ScrollbarPrefsObserver=ChromiumWebCoreObjCScrollbarPrefsObserver',
1032               'WebCoreRenderThemeNotificationObserver=ChromiumWebCoreObjCWebCoreRenderThemeNotificationObserver',
1033               'WebFontCache=ChromiumWebCoreObjCWebFontCache',
1034             ],
1035             'include_dirs': [
1036               '../../../WebKitLibraries',
1037             ],
1038             'postbuilds': [
1039               {
1040                 # This step ensures that any Objective-C names that aren't
1041                 # redefined to be "safe" above will cause a build failure.
1042                 'postbuild_name': 'Check Objective-C Rename',
1043                 'variables': {
1044                   'class_whitelist_regex':
1045                       'ChromiumWebCoreObjC|TCMVisibleView|RTCMFlippedView',
1046                   'category_whitelist_regex':
1047                       'TCMInterposing',
1048                 },
1049                 'action': [
1050                   'mac/check_objc_rename.sh',
1051                   '<(class_whitelist_regex)',
1052                   '<(category_whitelist_regex)',
1053                 ],
1054               },
1055             ],
1056           },
1057         }],
1058         ['OS=="win"', {
1059           'dependencies': [
1060             '<(chromium_src_dir)/build/win/system.gyp:cygwin'
1061           ],
1062           'export_dependent_settings': [
1063             '<(chromium_src_dir)/build/win/system.gyp:cygwin'
1064           ],
1065           'direct_dependent_settings': {
1066             'defines': [
1067               # Match Safari and Mozilla on Windows.
1068               'WEBCORE_NAVIGATOR_PLATFORM="Win32"',
1069               '__PRETTY_FUNCTION__=__FUNCTION__',
1070             ],
1071             # This is needed because Event.h in this directory is blocked
1072             # by a system header on windows.
1073             'include_dirs++': ['../dom'],
1074           },
1075         }],
1076         ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_MKL=1" in feature_defines', {
1077           # This directory needs to be on the include path for multiple sub-targets of webcore.
1078           'direct_dependent_settings': {
1079             'include_dirs': [
1080               '<(chromium_src_dir)/third_party/mkl/include',
1081             ],
1082           },
1083         }],
1084         ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
1085           # This directory needs to be on the include path for multiple sub-targets of webcore.
1086           'direct_dependent_settings': {
1087             'include_dirs': [
1088               '<(chromium_src_dir)/third_party/fftw/api',
1089             ],
1090           },
1091         }],
1092       ],
1093     },
1094     {
1095       'target_name': 'webcore_html',
1096       'type': '<(library)',
1097       'dependencies': [
1098         'webcore_prerequisites',
1099       ],
1100       'sources': [
1101         '<@(webcore_files)',
1102       ],
1103       'sources/': [
1104         # Start by excluding everything then include html files only.
1105         ['exclude', '.*'],
1106         ['include', 'html/'],
1107       ],
1108     },
1109     {
1110       'target_name': 'webcore_svg',
1111       'type': '<(library)',
1112       'dependencies': [
1113         'webcore_prerequisites',
1114       ],
1115       'sources': [
1116         '<@(webcore_files)',
1117       ],
1118       'sources/': [
1119         # Start by excluding everything then include svg files only. Note that
1120         # css/SVG* and bindings/v8/custom/V8SVG* are still built in
1121         # webcore_remaining.
1122         ['exclude', '.*'],
1123         ['include', 'svg/'],
1124         ['include', 'css/svg/'],
1125         ['include', 'rendering/style/SVG'],
1126         ['include', 'rendering/RenderSVG'],
1127         ['include', 'rendering/SVG'],
1128         ['exclude', 'svg/SVGAllInOne\\.cpp$'],
1129       ],
1130     },
1131     {
1132       'target_name': 'webcore_platform',
1133       'type': '<(library)',
1134       'dependencies': [
1135         'webcore_prerequisites',
1136       ],
1137       # This is needed for mac because of webkit_system_interface. It'd be nice
1138       # if this hard dependency could be split off the rest.
1139       'hard_dependency': 1,
1140       'sources': [
1141         '<@(webcore_files)',
1142
1143         # For WebCoreSystemInterface, Mac-only.
1144         '../../../Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm',
1145       ],
1146       'sources/': [
1147         # Start by excluding everything then include platform files only.
1148         ['exclude', '.*'],
1149         ['include', 'platform/'],
1150
1151         # Exclude things that don't apply to the Chromium platform on the basis
1152         # of their enclosing directories and tags at the ends of their
1153         # filenames.
1154         ['exclude', '(android|cairo|cf|cg|curl|fftw|gtk|haiku|linux|mac|mkl|opentype|posix|qt|soup|svg|symbian|win|wx)/'],
1155         ['exclude', '(?<!Chromium)(Android|Cairo|CF|CG|Curl|Gtk|Linux|Mac|OpenType|POSIX|Posix|Qt|Safari|Soup|Symbian|Win|Wx)\\.(cpp|mm?)$'],
1156
1157         # A few things can't be excluded by patterns.  List them individually.
1158
1159         ['include', 'platform/graphics/opentype/OpenTypeSanitizer\\.cpp$'],
1160
1161         # Exclude some DB-related files.
1162         ['exclude', 'platform/sql/SQLiteFileSystem\\.cpp$'],
1163
1164         # Use platform/KURLGoogle.cpp instead.
1165         ['exclude', 'platform/KURL\\.cpp$'],
1166
1167         # Use platform/MIMETypeRegistryChromium.cpp instead.
1168         ['exclude', 'platform/MIMETypeRegistry\\.cpp$'],
1169
1170         # Theme.cpp is used only if we're using USE_NEW_THEME. We are not for
1171         # Windows and Linux. We manually include Theme.cpp for the Mac below.
1172         ['exclude', 'platform/Theme\\.cpp$'],
1173
1174         # Use LinkHashChromium.cpp instead
1175         ['exclude', 'platform/LinkHash\\.cpp$'],
1176
1177         ['include', 'thirdparty/glu/libtess/'],
1178       ],
1179       'conditions': [
1180         ['OS=="linux" or OS=="freebsd"', {
1181           'sources/': [
1182             # Cherry-pick files excluded by the broader regular expressions above.
1183             ['include', 'platform/chromium/KeyCodeConversionGtk\\.cpp$'],
1184             ['include', 'platform/graphics/chromium/ComplexTextControllerLinux\\.cpp$'],
1185             ['include', 'platform/graphics/chromium/FontCacheLinux\\.cpp$'],
1186             ['include', 'platform/graphics/chromium/FontLinux\\.cpp$'],
1187             ['include', 'platform/graphics/chromium/FontPlatformDataLinux\\.cpp$'],
1188             ['include', 'platform/graphics/chromium/SimpleFontDataLinux\\.cpp$'],
1189           ],
1190           'dependencies': [
1191             '<(chromium_src_dir)/third_party/harfbuzz/harfbuzz.gyp:harfbuzz',
1192           ],
1193         }],
1194         ['OS=="mac"', {
1195           # Necessary for Mac .mm stuff.
1196           'include_dirs': [
1197             '../../../WebKitLibraries',
1198           ],
1199           'dependencies': [
1200             'webkit_system_interface',
1201           ],
1202           'actions': [
1203             {
1204               # Allow framework-style #include of
1205               # <WebCore/WebCoreSystemInterface.h>.
1206               'action_name': 'WebCoreSystemInterface.h',
1207               'inputs': [
1208                 '../platform/mac/WebCoreSystemInterface.h',
1209               ],
1210               'outputs': [
1211                 '<(INTERMEDIATE_DIR)/WebCore/WebCoreSystemInterface.h',
1212               ],
1213               'action': ['cp', '<@(_inputs)', '<@(_outputs)'],
1214             },
1215           ],
1216           'sources/': [
1217             # Additional files from the WebCore Mac build that are presently
1218             # used in the WebCore Chromium Mac build too.
1219
1220             # The Mac build is USE(CF) but does not use CFNetwork.
1221             ['include', 'CF\\.cpp$'],
1222             ['exclude', 'network/cf/'],
1223
1224             # The Mac build is PLATFORM_CG too.  platform/graphics/cg is the
1225             # only place that CG files we want to build are located, and not
1226             # all of them even have a CG suffix, so just add them by a
1227             # regexp matching their directory.
1228             ['include', 'platform/graphics/cg/[^/]*(?<!Win)?\\.(cpp|mm?)$'],
1229
1230             # Use native Mac font code from WebCore.
1231             ['include', 'platform/(graphics/)?mac/[^/]*Font[^/]*\\.(cpp|mm?)$'],
1232             ['include', 'platform/graphics/mac/ComplexText[^/]*\\.(cpp|h)$'],
1233
1234             # We can use this for the fast Accelerate.framework FFT.
1235             ['include', 'platform/audio/mac/FFTFrameMac\\.cpp$'],
1236
1237             # Cherry-pick some files that can't be included by broader regexps.
1238             # Some of these are used instead of Chromium platform files, see
1239             # the specific exclusions in the "sources!" list below.
1240             ['include', 'rendering/RenderThemeMac\\.mm$'],
1241             ['include', 'platform/graphics/mac/ColorMac\\.mm$'],
1242             ['include', 'platform/graphics/mac/FloatPointMac\\.mm$'],
1243             ['include', 'platform/graphics/mac/FloatRectMac\\.mm$'],
1244             ['include', 'platform/graphics/mac/FloatSizeMac\\.mm$'],
1245             ['include', 'platform/graphics/mac/GlyphPageTreeNodeMac\\.cpp$'],
1246             ['include', 'platform/graphics/mac/GraphicsContextMac\\.mm$'],
1247             ['include', 'platform/graphics/mac/IntRectMac\\.mm$'],
1248             ['include', 'platform/mac/BlockExceptions\\.mm$'],
1249             ['include', 'platform/mac/KillRingMac\\.mm$'],
1250             ['include', 'platform/mac/LocalCurrentGraphicsContext\\.mm$'],
1251             ['include', 'platform/mac/PurgeableBufferMac\\.cpp$'],
1252             ['include', 'platform/mac/WebCoreSystemInterface\\.mm$'],
1253             ['include', 'platform/mac/WebCoreTextRenderer\\.mm$'],
1254             ['include', 'platform/text/mac/ShapeArabic\\.c$'],
1255             ['include', 'platform/text/mac/String(Impl)?Mac\\.mm$'],
1256             # Use USE_NEW_THEME on Mac.
1257             ['include', 'platform/Theme\\.cpp$'],
1258
1259             ['include', 'Source/WebKit/mac/WebCoreSupport/WebSystemInterface\\.mm$'],
1260
1261             # Chromium Mac does not use skia.
1262             ['exclude', 'platform/graphics/skia/[^/]*Skia\\.(cpp|h)$'],
1263
1264             # The Mac uses platform/mac/KillRingMac.mm instead of the dummy
1265             # implementation.
1266             ['exclude', 'platform/KillRingNone\\.cpp$'],
1267
1268             # The Mac currently uses FontCustomPlatformData.cpp from
1269             # platform/graphics/mac, included by regex above, instead.
1270             ['exclude', 'platform/graphics/skia/FontCustomPlatformData\\.cpp$'],
1271
1272             # The Mac currently uses ScrollbarThemeChromiumMac.mm, which is not
1273             # related to ScrollbarThemeChromium.cpp.
1274             ['exclude', 'platform/chromium/ScrollbarThemeChromium\\.cpp$'],
1275
1276             # The Mac currently uses ImageChromiumMac.mm from
1277             # platform/graphics/chromium, included by regex above, instead.
1278             ['exclude', 'platform/graphics/chromium/ImageChromium\\.cpp$'],
1279
1280             # The Mac does not use ImageSourceCG.cpp from platform/graphics/cg
1281             # even though it is included by regex above.
1282             ['exclude', 'platform/graphics/cg/ImageSourceCG\\.cpp$'],
1283             ['exclude', 'platform/graphics/cg/PDFDocumentImage\\.cpp$'],
1284
1285             # ImageDecoderSkia is not used on mac.  ImageDecoderCG is used instead.
1286             ['exclude', 'platform/image-decoders/skia/ImageDecoderSkia\\.cpp$'],
1287             ['include', 'platform/image-decoders/cg/ImageDecoderCG\\.cpp$'],
1288
1289             # Again, Skia is not used on Mac.
1290             ['exclude', 'platform/chromium/DragImageChromiumSkia\\.cpp$'],
1291           ],
1292         }],
1293         ['OS!="linux" and OS!="freebsd"', {
1294           'sources/': [
1295             ['exclude', '(Gtk|Linux)\\.cpp$'],
1296             ['exclude', 'Harfbuzz[^/]+\\.(cpp|h)$'],
1297             ['exclude', 'VDMX[^/]+\\.(cpp|h)$'],
1298           ],
1299         }],
1300         ['OS!="mac"', {
1301           'sources/': [['exclude', 'Mac\\.(cpp|mm?)$']]
1302         }],
1303         ['OS!="win"', {
1304           'sources/': [
1305             ['exclude', 'Win\\.cpp$'],
1306             ['exclude', '/(Windows|Uniscribe)[^/]*\\.cpp$']
1307           ],
1308         }],
1309         ['OS=="win"', {
1310           'sources/': [
1311             ['exclude', 'Posix\\.cpp$'],
1312
1313             # The Chromium Win currently uses GlyphPageTreeNodeChromiumWin.cpp from
1314             # platform/graphics/chromium, included by regex above, instead.
1315             ['exclude', 'platform/graphics/skia/GlyphPageTreeNodeSkia\\.cpp$']
1316           ],
1317         }],
1318         ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_MKL=1" in feature_defines', {
1319           'sources/': [
1320             ['include', 'platform/audio/mkl/FFTFrameMKL\\.cpp$'],
1321           ],
1322         }],
1323         ['(OS=="linux" or OS=="win") and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
1324           'sources/': [
1325             ['include', 'platform/audio/fftw/FFTFrameFFTW\\.cpp$'],
1326           ],
1327         }],
1328       ],
1329     },
1330     {
1331       'target_name': 'webcore_rendering',
1332       'type': '<(library)',
1333       'dependencies': [
1334         'webcore_prerequisites',
1335       ],
1336       'sources': [
1337         '<@(webcore_files)',
1338       ],
1339       'sources/': [
1340         # Start by excluding everything then include rendering files only.
1341         ['exclude', '.*'],
1342         ['include', 'rendering/'],
1343
1344         # Exclude things that don't apply to the Chromium platform on the basis
1345         # of their enclosing directories and tags at the ends of their
1346         # filenames.
1347         ['exclude', '(android|cairo|cf|cg|curl|gtk|haiku|html|linux|mac|opentype|platform|posix|qt|soup|svg|symbian|win|wx)/'],
1348         ['exclude', '(?<!Chromium)(Android|Cairo|CF|CG|Curl|Gtk|Linux|Mac|OpenType|POSIX|Posix|Qt|Safari|Soup|Symbian|Win|Wx)\\.(cpp|mm?)$'],
1349
1350         # Exclude most of SVG except css and javascript bindings.
1351         ['exclude', 'rendering/style/SVG[^/]+.(cpp|h)$'],
1352         ['exclude', 'rendering/RenderSVG[^/]+.(cpp|h)$'],
1353         ['exclude', 'rendering/SVG[^/]+.(cpp|h)$'],
1354       ],
1355       'conditions': [
1356         ['OS=="win"', {
1357           'sources/': [
1358             ['exclude', 'Posix\\.cpp$'],
1359           ],
1360         }],
1361         ['OS=="mac"', {
1362           'sources/': [
1363             # RenderThemeChromiumSkia is not used on mac since RenderThemeChromiumMac
1364             # does not reference the Skia code that is used by Windows and Linux.
1365             ['exclude', 'rendering/RenderThemeChromiumSkia\\.cpp$'],
1366           ],
1367         }],
1368         ['(OS=="linux" or OS=="freebsd" or OS=="openbsd") and gcc_version==42', {
1369           # Due to a bug in gcc 4.2.1 (the current version on hardy), we get
1370           # warnings about uninitialized this.
1371           'cflags': ['-Wno-uninitialized'],
1372         }],
1373         ['OS!="linux" and OS!="freebsd"', {
1374           'sources/': [
1375             ['exclude', '(Gtk|Linux)\\.cpp$'],
1376           ],
1377         }],
1378         ['OS!="mac"', {
1379           'sources/': [['exclude', 'Mac\\.(cpp|mm?)$']]
1380         }],
1381         ['OS!="win"', {
1382           'sources/': [
1383             ['exclude', 'Win\\.cpp$'],
1384           ],
1385         }],
1386       ],
1387     },
1388     {
1389       'target_name': 'webcore_remaining',
1390       'type': '<(library)',
1391       'dependencies': [
1392         'webcore_prerequisites',
1393       ],
1394       # This is needed for mac because of webkit_system_interface. It'd be nice
1395       # if this hard dependency could be split off the rest.
1396       'hard_dependency': 1,
1397       'sources': [
1398         '<@(webcore_files)',
1399       ],
1400       'sources/': [
1401         # Exclude JSC custom bindings.
1402         ['exclude', 'bindings/js'],
1403
1404         # Fortunately, many things can be excluded by using broad patterns.
1405
1406         # Exclude things that don't apply to the Chromium platform on the basis
1407         # of their enclosing directories and tags at the ends of their
1408         # filenames.
1409         ['exclude', '(android|cairo|cf|cg|curl|gtk|haiku|html|linux|mac|opentype|platform|posix|qt|rendering|soup|svg|symbian|win|wx)/'],
1410         ['exclude', '(?<!Chromium)(Android|Cairo|CF|CG|Curl|Gtk|Linux|Mac|OpenType|POSIX|Posix|Qt|Safari|Soup|Symbian|Win|Wx)\\.(cpp|mm?)$'],
1411
1412         # JSC-only.
1413         ['exclude', 'inspector/JavaScript[^/]*\\.cpp$'],
1414
1415         # ENABLE_OFFLINE_WEB_APPLICATIONS, exclude most of webcore's impl
1416         ['exclude', 'loader/appcache/'],
1417         ['include', 'loader/appcache/ApplicationCacheHost\.h$'],
1418         ['include', 'loader/appcache/DOMApplicationCache\.(h|cpp)$'],
1419
1420         # Exclude some DB-related files.
1421         ['exclude', 'storage/DatabaseTracker\\.cpp$'],
1422         ['exclude', 'storage/DatabaseTrackerClient\\.h$'],
1423         ['exclude', 'storage/OriginQuotaManager\\.(cpp|h)$'],
1424         ['exclude', 'storage/OriginUsageRecord\\.(cpp|h)$'],
1425         ['exclude', 'storage/SQLTransactionClient\\.cpp$'],
1426
1427         # Don't build StorageNamespace.  We have our own implementation.
1428         ['exclude', 'storage/StorageNamespace\\.cpp$'],
1429
1430         # Don't build StorageEventDispatcher.  We have our own implementation.
1431         ['exclude', 'storage/StorageEventDispatcher\\.cpp$'],
1432
1433         # Don't build IDBFactoryBackendInterface.  We have our own implementation.
1434         ['exclude', 'storage/IDBFactoryBackendInterface\\.cpp$'],
1435
1436         # Don't build IDBKeyPathBackendImpl.  We have our own implementation.
1437         ['exclude', 'storage/IDBKeyPathBackendImpl\\.cpp$'],
1438
1439         # Don't build files needed for WebArchive support, since we disable
1440         # this feature.
1441         ['exclude', 'loader/archive/cf/LegacyWebArchive\\.cpp$'],
1442         ['exclude', 'loader/archive/cf/LegacyWebArchiveMac\\.mm$'],
1443         ['exclude', 'loader/archive/ArchiveFactory\\.cpp$'],
1444
1445         # Use loader/icon/IconDatabaseNone.cpp instead.
1446         ['exclude', 'loader/icon/IconDatabase\\.cpp$'],
1447
1448         # Exclude some, but not all, of plugins.
1449         ['exclude', 'plugins/PluginDatabase\\.cpp$'],
1450         ['exclude', 'plugins/PluginMainThreadScheduler\\.cpp$'],
1451         ['exclude', 'plugins/PluginPackage\\.cpp$'],
1452         ['exclude', 'plugins/PluginStream\\.cpp$'],
1453         ['exclude', 'plugins/PluginView\\.cpp$'],
1454         ['exclude', 'plugins/npapi\\.cpp$'],
1455
1456         # FIXME: I don't know exactly why these are excluded.  It would
1457         # be nice to provide more explicit comments.  Some of these do actually
1458         # compile.
1459         ['exclude', 'dom/StaticStringList\\.cpp$'],
1460         ['exclude', 'loader/UserStyleSheetLoader\\.cpp$'],
1461
1462         # We use a multi-process version from the WebKit API.
1463         ['exclude', 'dom/default/PlatformMessagePortChannel\\.(cpp|h)$'],
1464       ],
1465       'link_settings': {
1466         'mac_bundle_resources': [
1467           '../Resources/aliasCursor.png',
1468           '../Resources/cellCursor.png',
1469           '../Resources/contextMenuCursor.png',
1470           '../Resources/copyCursor.png',
1471           '../Resources/crossHairCursor.png',
1472           '../Resources/eastResizeCursor.png',
1473           '../Resources/eastWestResizeCursor.png',
1474           '../Resources/helpCursor.png',
1475           '../Resources/linkCursor.png',
1476           '../Resources/missingImage.png',
1477           '../Resources/moveCursor.png',
1478           '../Resources/noDropCursor.png',
1479           '../Resources/noneCursor.png',
1480           '../Resources/northEastResizeCursor.png',
1481           '../Resources/northEastSouthWestResizeCursor.png',
1482           '../Resources/northResizeCursor.png',
1483           '../Resources/northSouthResizeCursor.png',
1484           '../Resources/northWestResizeCursor.png',
1485           '../Resources/northWestSouthEastResizeCursor.png',
1486           '../Resources/notAllowedCursor.png',
1487           '../Resources/progressCursor.png',
1488           '../Resources/southEastResizeCursor.png',
1489           '../Resources/southResizeCursor.png',
1490           '../Resources/southWestResizeCursor.png',
1491           '../Resources/verticalTextCursor.png',
1492           '../Resources/waitCursor.png',
1493           '../Resources/westResizeCursor.png',
1494           '../Resources/zoomInCursor.png',
1495           '../Resources/zoomOutCursor.png',
1496         ],
1497       },
1498       'conditions': [
1499         ['OS=="win"', {
1500           'sources/': [
1501             ['exclude', 'Posix\\.cpp$'],
1502             ['include', '/opentype/'],
1503             ['include', '/ScrollAnimatorWin\\.cpp$'],
1504             ['include', '/ScrollAnimatorWin\\.h$'],
1505             ['include', '/SkiaFontWin\\.cpp$'],
1506             ['include', '/TransparencyWin\\.cpp$'],
1507           ],
1508         }],
1509         ['(OS=="linux" or OS=="freebsd" or OS=="openbsd") and gcc_version==42', {
1510           # Due to a bug in gcc 4.2.1 (the current version on hardy), we get
1511           # warnings about uninitialized this.
1512           'cflags': ['-Wno-uninitialized'],
1513         }],
1514         ['OS!="linux" and OS!="freebsd"', {
1515           'sources/': [
1516             ['exclude', '(Gtk|Linux)\\.cpp$'],
1517           ],
1518         }],
1519         ['OS!="mac"', {
1520           'sources/': [['exclude', 'Mac\\.(cpp|mm?)$']]
1521         }],
1522         ['OS!="win"', {
1523           'sources/': [
1524             ['exclude', 'Win\\.cpp$'],
1525             ['exclude', '/(Windows|Uniscribe)[^/]*\\.cpp$']
1526           ],
1527         }],
1528         ['javascript_engine=="v8"', {
1529           'dependencies': [
1530             '<(chromium_src_dir)/v8/src/extensions/experimental/experimental.gyp:i18n_api',
1531           ],
1532         }],
1533       ],
1534     },
1535     {
1536       'target_name': 'webcore',
1537       'type': 'none',
1538       'dependencies': [
1539         'webcore_html',
1540         'webcore_platform',
1541         'webcore_remaining',
1542         'webcore_rendering',
1543         # Exported.
1544         'webcore_bindings',
1545         '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
1546         '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
1547         '<(chromium_src_dir)/skia/skia.gyp:skia',
1548         '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
1549       ],
1550       'export_dependent_settings': [
1551         'webcore_bindings',
1552         '../../JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
1553         '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
1554         '<(chromium_src_dir)/skia/skia.gyp:skia',
1555         '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
1556       ],
1557       'direct_dependent_settings': {
1558         'include_dirs': [
1559           '<@(webcore_include_dirs)',
1560         ],
1561         'mac_framework_dirs': [
1562           '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework/Frameworks',
1563           '$(SDKROOT)/System/Library/Frameworks/Accelerate.framework',
1564           '$(SDKROOT)/System/Library/Frameworks/CoreServices.framework',
1565           '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
1566           '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
1567           '$(SDKROOT)/System/Library/Frameworks/AudioToolbox.framework',
1568           '$(SDKROOT)/System/Library/Frameworks/AudioUnit.framework',
1569           '$(SDKROOT)/System/Library/Frameworks/CoreAudio.framework',
1570         ],
1571       },
1572       'conditions': [
1573         ['javascript_engine=="v8"', {
1574           'dependencies': [
1575             '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
1576           ],
1577           'export_dependent_settings': [
1578             '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
1579           ],
1580         }],
1581         ['OS=="mac"', {
1582           'direct_dependent_settings': {
1583             'include_dirs': [
1584               '../../../WebKitLibraries',
1585               '../../../Source/WebKit/mac/WebCoreSupport',
1586             ],
1587           },
1588         }],
1589         ['OS=="win"', {
1590           'direct_dependent_settings': {
1591             'include_dirs+++': ['../dom'],
1592           },
1593         }],
1594         ['OS=="win" and "WTF_USE_WEBAUDIO_MKL=1" in feature_defines', {
1595           # FIXME: (kbr) figure out how to make these dependencies
1596           # work in a cross-platform way. Attempts to use
1597           # "link_settings" and "libraries" in conjunction with the
1598           # msvs-specific settings didn't work so far.
1599           'all_dependent_settings': {
1600             'msvs_settings': {
1601               'VCLinkerTool': {
1602                 'AdditionalLibraryDirectories': [
1603                   # This is a hack to make this directory correct
1604                   # relative to targets like chrome_dll. Should use
1605                   # <(chromium_src_dir).
1606                   '../third_party/mkl/lib/win/ia32',
1607                 ],
1608                 'AdditionalDependencies': [
1609                   'mkl_intel_c.lib',
1610                   'mkl_sequential.lib',
1611                   'mkl_core.lib',
1612                 ],
1613               },
1614             },
1615           },
1616         }],
1617         ['OS=="linux" and "WTF_USE_WEBAUDIO_FFTW=1" in feature_defines', {
1618           # FIXME: (kbr) figure out how to make these dependencies
1619           # work in a cross-platform way. Attempts to use
1620           # "link_settings" and "libraries" in conjunction with the
1621           # msvs-specific settings didn't work so far.
1622           'all_dependent_settings': {
1623             'ldflags': [
1624               # FIXME: (kbr) build the FFTW into PRODUCT_DIR using GYP.
1625               '-Lthird_party/fftw/.libs',
1626             ],
1627             'link_settings': {
1628               'libraries': [
1629                 '-lfftw3f'
1630               ],
1631             },
1632           },
1633         }],
1634         ['enable_svg!=0', {
1635           'dependencies': [
1636             'webcore_svg',
1637           ],
1638         }],
1639       ],
1640     },
1641   ],  # targets
1642 }