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