summaryrefslogtreecommitdiffstats
path: root/WebCore/WebCore.gyp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-12-17 09:55:06 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-12-17 09:55:06 -0800
commitb880d713c04257ca40abfef97c300afdead423b8 (patch)
tree6982576c228bcd1a7efe98afed544d840751094c /WebCore/WebCore.gyp
parente2e7a5c57b53f01e63a0245b4420d54b454cb373 (diff)
parent643ca7872b450ea4efacab6188849e5aac2ba161 (diff)
downloadexternal_webkit-b880d713c04257ca40abfef97c300afdead423b8.zip
external_webkit-b880d713c04257ca40abfef97c300afdead423b8.tar.gz
external_webkit-b880d713c04257ca40abfef97c300afdead423b8.tar.bz2
am 643ca787: Merge webkit.org at r51976 : Initial merge by git.
Merge commit '643ca7872b450ea4efacab6188849e5aac2ba161' into eclair-mr2-plus-aosp * commit '643ca7872b450ea4efacab6188849e5aac2ba161': Merge webkit.org at r51976 : Initial merge by git.
Diffstat (limited to 'WebCore/WebCore.gyp')
-rw-r--r--WebCore/WebCore.gyp/WebCore.gyp59
-rw-r--r--WebCore/WebCore.gyp/scripts/action_csspropertynames.py166
-rw-r--r--WebCore/WebCore.gyp/scripts/action_cssvaluekeywords.py172
-rw-r--r--WebCore/WebCore.gyp/scripts/action_makenames.py174
-rw-r--r--WebCore/WebCore.gyp/scripts/action_maketokenizer.py101
-rw-r--r--WebCore/WebCore.gyp/scripts/action_useragentstylesheets.py102
-rw-r--r--WebCore/WebCore.gyp/scripts/rule_binding.py135
-rw-r--r--WebCore/WebCore.gyp/scripts/rule_bison.py102
-rw-r--r--WebCore/WebCore.gyp/scripts/rule_gperf.py85
9 files changed, 1064 insertions, 32 deletions
diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
index 055e3cb..374d01b 100644
--- a/WebCore/WebCore.gyp/WebCore.gyp
+++ b/WebCore/WebCore.gyp/WebCore.gyp
@@ -130,6 +130,7 @@
'../platform/chromium',
'../platform/graphics',
'../platform/graphics/chromium',
+ '../platform/graphics/filters',
'../platform/graphics/opentype',
'../platform/graphics/skia',
'../platform/graphics/transforms',
@@ -148,12 +149,15 @@
'../platform/sql',
'../platform/text',
'../plugins',
+ '../plugins/chromium',
'../rendering',
'../rendering/style',
'../storage',
+ '../storage/chromium',
'../svg',
'../svg/animation',
'../svg/graphics',
+ '../svg/graphics/filters',
'../websockets',
'../workers',
'../xml',
@@ -212,11 +216,6 @@
# idl rule
'<@(webcore_bindings_idl_files)',
],
- 'sources/': [
- # SVG_FILTERS only.
- ['exclude', 'svg/SVG(FE|Filter)[^/]*\\.idl$'],
-
- ],
'sources!': [
# Custom bindings in bindings/v8/custom exist for these.
'../dom/EventListener.idl',
@@ -226,13 +225,6 @@
# JSC-only.
'../inspector/JavaScriptCallFrame.idl',
- # ENABLE_GEOLOCATION only.
- '../page/Geolocation.idl',
- '../page/Geoposition.idl',
- '../page/PositionCallback.idl',
- '../page/PositionError.idl',
- '../page/PositionErrorCallback.idl',
-
# Bindings with custom Objective-C implementations.
'../page/AbstractView.idl',
@@ -240,7 +232,6 @@
# Extra SVG bindings to exclude.
'../svg/ElementTimeControl.idl',
'../svg/SVGAnimatedPathData.idl',
- '../svg/SVGComponentTransferFunctionElement.idl',
'../svg/SVGExternalResourcesRequired.idl',
'../svg/SVGFitToViewBox.idl',
'../svg/SVGHKernElement.idl',
@@ -272,7 +263,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/action_csspropertynames.py',
+ 'scripts/action_csspropertynames.py',
'<@(_outputs)',
'--',
'<@(_inputs)'
@@ -291,7 +282,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/action_cssvaluekeywords.py',
+ 'scripts/action_cssvaluekeywords.py',
'<@(_outputs)',
'--',
'<@(_inputs)'
@@ -314,7 +305,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/action_makenames.py',
+ 'scripts/action_makenames.py',
'<@(_outputs)',
'--',
'<@(_inputs)',
@@ -341,7 +332,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/action_makenames.py',
+ 'scripts/action_makenames.py',
'<@(_outputs)',
'--',
'<@(_inputs)',
@@ -370,7 +361,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/action_useragentstylesheets.py',
+ 'scripts/action_useragentstylesheets.py',
'<@(_outputs)',
'--',
'<@(_inputs)'
@@ -388,7 +379,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/action_makenames.py',
+ 'scripts/action_makenames.py',
'<@(_outputs)',
'--',
'<@(_inputs)',
@@ -408,7 +399,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/action_makenames.py',
+ 'scripts/action_makenames.py',
'<@(_outputs)',
'--',
'<@(_inputs)',
@@ -427,7 +418,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/action_maketokenizer.py',
+ 'scripts/action_maketokenizer.py',
'<@(_outputs)',
'--',
'<@(_inputs)'
@@ -445,7 +436,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/rule_bison.py',
+ 'scripts/rule_bison.py',
'<(RULE_INPUT_PATH)',
'<(SHARED_INTERMEDIATE_DIR)/webkit'
],
@@ -468,7 +459,7 @@
],
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/rule_gperf.py',
+ 'scripts/rule_gperf.py',
'<(RULE_INPUT_PATH)',
'<(SHARED_INTERMEDIATE_DIR)/webkit'
],
@@ -513,7 +504,7 @@
# behavior, change the output location.
'action': [
'python',
- '<(chromium_src_dir)/webkit/build/rule_binding.py',
+ 'scripts/rule_binding.py',
'<(RULE_INPUT_PATH)',
'<(SHARED_INTERMEDIATE_DIR)/webcore/bindings',
'<(SHARED_INTERMEDIATE_DIR)/webkit/bindings',
@@ -629,6 +620,7 @@
'<(chromium_src_dir)/third_party/libxml/libxml.gyp:libxml',
'<(chromium_src_dir)/third_party/libxslt/libxslt.gyp:libxslt',
'<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
+ '<(chromium_src_dir)/third_party/ots/ots.gyp:ots',
'<(chromium_src_dir)/third_party/sqlite/sqlite.gyp:sqlite',
],
'defines': [
@@ -655,6 +647,7 @@
# filenames.
['exclude', '(android|cairo|cf|cg|curl|gtk|haiku|linux|mac|opentype|posix|qt|soup|symbian|win|wx)/'],
['exclude', '(?<!Chromium)(SVGAllInOne|Android|Cairo|CF|CG|Curl|Gtk|Linux|Mac|OpenType|POSIX|Posix|Qt|Safari|Soup|Symbian|Win|Wx)\\.(cpp|mm?)$'],
+ ['include', 'platform/graphics/opentype/OpenTypeSanitizer\\.cpp$'],
# JSC-only.
['exclude', 'inspector/JavaScript[^/]*\\.cpp$'],
@@ -664,13 +657,15 @@
['include', 'loader/appcache/ApplicationCacheHost\.h$'],
['include', 'loader/appcache/DOMApplicationCache\.(h|cpp)$'],
- # SVG_FILTERS only.
- ['exclude', '(platform|svg)/graphics/filters/'],
- ['exclude', 'svg/Filter[^/]*\\.cpp$'],
- ['exclude', 'svg/SVG(FE|Filter)[^/]*\\.cpp$'],
-
# Exclude some DB-related files.
['exclude', 'platform/sql/SQLiteFileSystem.cpp'],
+ ['exclude', 'storage/DatabaseTracker.cpp'],
+ ['exclude', 'storage/DatabaseTrackerClient.h'],
+ ['exclude', 'storage/OriginQuotaManager.cpp'],
+ ['exclude', 'storage/OriginQuotaManager.h'],
+ ['exclude', 'storage/OriginUsageRecord.cpp'],
+ ['exclude', 'storage/OriginUsageRecord.h'],
+ ['exclude', 'storage/SQLTransactionClient.cpp'],
],
'sources!': [
# A few things can't be excluded by patterns. List them individually.
@@ -891,6 +886,7 @@
# Use native Mac font code from WebCore.
['include', 'platform/(graphics/)?mac/[^/]*Font[^/]*\\.(cpp|mm?)$'],
+ ['include', 'platform/graphics/mac/ComplexText[^/]*\\.(cpp|h)$'],
# Cherry-pick some files that can't be included by broader regexps.
# Some of these are used instead of Chromium platform files, see
@@ -906,7 +902,6 @@
['include', 'platform/mac/BlockExceptions\\.mm$'],
['include', 'platform/mac/LocalCurrentGraphicsContext\\.mm$'],
['include', 'platform/mac/PurgeableBufferMac\\.cpp$'],
- ['include', 'platform/mac/ScrollbarThemeMac\\.mm$'],
['include', 'platform/mac/WebCoreSystemInterface\\.mm$'],
['include', 'platform/mac/WebCoreTextRenderer\\.mm$'],
['include', 'platform/text/mac/ShapeArabic\\.c$'],
@@ -921,8 +916,8 @@
# platform/graphics/mac, included by regex above, instead.
'../platform/graphics/chromium/FontCustomPlatformData.cpp',
- # The Mac currently uses ScrollbarThemeMac.mm, included by regex
- # above, instead of ScrollbarThemeChromium.cpp.
+ # The Mac currently uses ScrollbarThemeChromiumMac.mm, which is not
+ # related to ScrollbarThemeChromium.cpp.
'../platform/chromium/ScrollbarThemeChromium.cpp',
# The Mac uses ImageSourceCG.cpp from platform/graphics/cg, included
diff --git a/WebCore/WebCore.gyp/scripts/action_csspropertynames.py b/WebCore/WebCore.gyp/scripts/action_csspropertynames.py
new file mode 100644
index 0000000..60314d7
--- /dev/null
+++ b/WebCore/WebCore.gyp/scripts/action_csspropertynames.py
@@ -0,0 +1,166 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# action_csspropertynames.py is a harness script to connect actions sections of
+# gyp-based builds to makeprop.pl.
+#
+# usage: action_makenames.py OUTPUTS -- INPUTS
+#
+# Exactly two outputs must be specified: a path to each of CSSPropertyNames.cpp
+# and CSSPropertyNames.h.
+#
+# Multiple inputs may be specified. One input must have a basename of
+# makeprop.pl; this is taken as the path to makeprop.pl. All other inputs are
+# paths to .in files that are used as input to makeprop.pl; at least one,
+# CSSPropertyNames.in, is required.
+
+
+import os
+import posixpath
+import shutil
+import subprocess
+import sys
+
+
+def SplitArgsIntoSections(args):
+ sections = []
+ while len(args) > 0:
+ if not '--' in args:
+ # If there is no '--' left, everything remaining is an entire section.
+ dashes = len(args)
+ else:
+ dashes = args.index('--')
+
+ sections.append(args[:dashes])
+
+ # Next time through the loop, look at everything after this '--'.
+ if dashes + 1 == len(args):
+ # If the '--' is at the end of the list, we won't come back through the
+ # loop again. Add an empty section now corresponding to the nothingness
+ # following the final '--'.
+ args = []
+ sections.append(args)
+ else:
+ args = args[dashes + 1:]
+
+ return sections
+
+
+def main(args):
+ (outputs, inputs) = SplitArgsIntoSections(args[1:])
+
+ # Make all output pathnames absolute so that they can be accessed after
+ # changing directory.
+ for index in xrange(0, len(outputs)):
+ outputs[index] = os.path.abspath(outputs[index])
+
+ outputDir = os.path.dirname(outputs[0])
+
+ # Look at the inputs and figure out which one is makeprop.pl and which are
+ # inputs to that script.
+ makepropInput = None
+ inFiles = []
+ for input in inputs:
+ # Make input pathnames absolute so they can be accessed after changing
+ # directory. On Windows, convert \ to / for inputs to the perl script to
+ # work around the intermix of activepython + cygwin perl.
+ inputAbs = os.path.abspath(input)
+ inputAbsPosix = inputAbs.replace(os.path.sep, posixpath.sep)
+ inputBasename = os.path.basename(input)
+ if inputBasename == 'makeprop.pl':
+ assert makepropInput == None
+ makepropInput = inputAbs
+ elif inputBasename.endswith('.in'):
+ inFiles.append(inputAbsPosix)
+ else:
+ assert False
+
+ assert makepropInput != None
+ assert len(inFiles) >= 1
+
+ # Change to the output directory because makeprop.pl puts output in its
+ # working directory.
+ os.chdir(outputDir)
+
+ # Merge all inFiles into a single file whose name will be the same as the
+ # first listed inFile, but in the output directory.
+ mergedPath = os.path.basename(inFiles[0])
+ merged = open(mergedPath, 'wb') # 'wb' to get \n only on windows
+
+ # Make sure there aren't any duplicate lines in the in files.
+ lineDict = {}
+ for inFilePath in inFiles:
+ inFile = open(inFilePath)
+ for line in inFile:
+ line = line.rstrip()
+ if line.startswith('#'):
+ line = ''
+ if line == '':
+ continue
+ if line in lineDict:
+ raise KeyError, 'Duplicate value %s' % line
+ lineDict[line] = True
+ print >>merged, line
+ inFile.close()
+
+ merged.close()
+
+ # Build up the command.
+ command = ['perl', makepropInput]
+
+ # Do it. checkCall is new in 2.5, so simulate its behavior with call and
+ # assert.
+ returnCode = subprocess.call(command)
+ assert returnCode == 0
+
+ # Don't leave behind the merged file or the .gperf file created by
+ # makeprop.
+ (root, ext) = os.path.splitext(mergedPath)
+ gperfPath = root + '.gperf'
+ os.unlink(gperfPath)
+ os.unlink(mergedPath)
+
+ # Go through the outputs. Any output that belongs in a different directory
+ # is moved. Do a copy and delete instead of rename for maximum portability.
+ # Note that all paths used in this section are still absolute.
+ for output in outputs:
+ thisOutputDir = os.path.dirname(output)
+ if thisOutputDir != outputDir:
+ outputBasename = os.path.basename(output)
+ src = os.path.join(outputDir, outputBasename)
+ dst = os.path.join(thisOutputDir, outputBasename)
+ shutil.copyfile(src, dst)
+ os.unlink(src)
+
+ return returnCode
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/WebCore/WebCore.gyp/scripts/action_cssvaluekeywords.py b/WebCore/WebCore.gyp/scripts/action_cssvaluekeywords.py
new file mode 100644
index 0000000..ebf895b
--- /dev/null
+++ b/WebCore/WebCore.gyp/scripts/action_cssvaluekeywords.py
@@ -0,0 +1,172 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# action_cssvaluekeywords.py is a harness script to connect actions sections of
+# gyp-based builds to makevalues.pl.
+#
+# usage: action_cssvaluekeywords.py OUTPUTS -- INPUTS
+#
+# Exactly two outputs must be specified: a path to each of CSSValueKeywords.c
+# and CSSValueKeywords.h.
+#
+# Multiple inputs may be specified. One input must have a basename of
+# makevalues.pl; this is taken as the path to makevalues.pl. All other inputs
+# are paths to .in files that are used as input to makevalues.pl; at least
+# one, CSSValueKeywords.in, is required.
+
+
+import os
+import posixpath
+import shutil
+import subprocess
+import sys
+
+
+def SplitArgsIntoSections(args):
+ sections = []
+ while len(args) > 0:
+ if not '--' in args:
+ # If there is no '--' left, everything remaining is an entire section.
+ dashes = len(args)
+ else:
+ dashes = args.index('--')
+
+ sections.append(args[:dashes])
+
+ # Next time through the loop, look at everything after this '--'.
+ if dashes + 1 == len(args):
+ # If the '--' is at the end of the list, we won't come back through the
+ # loop again. Add an empty section now corresponding to the nothingness
+ # following the final '--'.
+ args = []
+ sections.append(args)
+ else:
+ args = args[dashes + 1:]
+
+ return sections
+
+
+def main(args):
+ (outputs, inputs) = SplitArgsIntoSections(args[1:])
+
+ # Make all output pathnames absolute so that they can be accessed after
+ # changing directory.
+ for index in xrange(0, len(outputs)):
+ outputs[index] = os.path.abspath(outputs[index])
+
+ outputDir = os.path.dirname(outputs[0])
+
+ # Look at the inputs and figure out which one is makevalues.pl and which are
+ # inputs to that script.
+ makevaluesInput = None
+ inFiles = []
+ for input in inputs:
+ # Make input pathnames absolute so they can be accessed after changing
+ # directory. On Windows, convert \ to / for inputs to the perl script to
+ # work around the intermix of activepython + cygwin perl.
+ inputAbs = os.path.abspath(input)
+ inputAbsPosix = inputAbs.replace(os.path.sep, posixpath.sep)
+ inputBasename = os.path.basename(input)
+ if inputBasename == 'makevalues.pl':
+ assert makevaluesInput == None
+ makevaluesInput = inputAbs
+ elif inputBasename.endswith('.in'):
+ inFiles.append(inputAbsPosix)
+ else:
+ assert False
+
+ assert makevaluesInput != None
+ assert len(inFiles) >= 1
+
+ # Change to the output directory because makevalues.pl puts output in its
+ # working directory.
+ os.chdir(outputDir)
+
+ # Merge all inFiles into a single file whose name will be the same as the
+ # first listed inFile, but in the output directory.
+ mergedPath = os.path.basename(inFiles[0])
+ merged = open(mergedPath, 'wb') # 'wb' to get \n only on windows
+
+ # Make sure there aren't any duplicate lines in the in files. Lowercase
+ # everything because CSS values are case-insensitive.
+ lineDict = {}
+ for inFilePath in inFiles:
+ inFile = open(inFilePath)
+ for line in inFile:
+ line = line.rstrip()
+ if line.startswith('#'):
+ line = ''
+ if line == '':
+ continue
+ line = line.lower()
+ if line in lineDict:
+ raise KeyError, 'Duplicate value %s' % line
+ lineDict[line] = True
+ print >>merged, line
+ inFile.close()
+
+ merged.close()
+
+ # Build up the command.
+ command = ['perl', makevaluesInput]
+
+ # Do it. checkCall is new in 2.5, so simulate its behavior with call and
+ # assert.
+ returnCode = subprocess.call(command)
+ assert returnCode == 0
+
+ # Don't leave behind the merged file or the .gperf file created by
+ # makevalues.
+ (root, ext) = os.path.splitext(mergedPath)
+ gperfPath = root + '.gperf'
+ os.unlink(gperfPath)
+ os.unlink(mergedPath)
+
+ # Go through the outputs. Any output that belongs in a different directory
+ # is moved. Do a copy and delete instead of rename for maximum portability.
+ # Note that all paths used in this section are still absolute.
+ for output in outputs:
+ thisOutputDir = os.path.dirname(output)
+ if thisOutputDir != outputDir:
+ outputBasename = os.path.basename(output)
+ src = os.path.join(outputDir, outputBasename)
+ dst = os.path.join(thisOutputDir, outputBasename)
+ shutil.copyfile(src, dst)
+ os.unlink(src)
+
+ return returnCode
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/WebCore/WebCore.gyp/scripts/action_makenames.py b/WebCore/WebCore.gyp/scripts/action_makenames.py
new file mode 100644
index 0000000..ecf543f
--- /dev/null
+++ b/WebCore/WebCore.gyp/scripts/action_makenames.py
@@ -0,0 +1,174 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# action_makenames.py is a harness script to connect actions sections of
+# gyp-based builds to make_names.pl.
+#
+# usage: action_makenames.py OUTPUTS -- INPUTS [-- OPTIONS]
+#
+# Multiple OUTPUTS, INPUTS, and OPTIONS may be listed. The sections are
+# separated by -- arguments.
+#
+# The directory name of the first output is chosen as the directory in which
+# make_names will run. If the directory name for any subsequent output is
+# different, those files will be moved to the desired directory.
+#
+# Multiple INPUTS may be listed. An input with a basename matching
+# "make_names.pl" is taken as the path to that script. Inputs with names
+# ending in TagNames.in or tags.in are taken as tag inputs. Inputs with names
+# ending in AttributeNames.in or attrs.in are taken as attribute inputs. There
+# may be at most one tag input and one attribute input. A make_names.pl input
+# is required and at least one tag or attribute input must be present.
+#
+# OPTIONS is a list of additional options to pass to make_names.pl. This
+# section need not be present.
+
+
+import os
+import posixpath
+import shutil
+import subprocess
+import sys
+
+
+def SplitArgsIntoSections(args):
+ sections = []
+ while len(args) > 0:
+ if not '--' in args:
+ # If there is no '--' left, everything remaining is an entire section.
+ dashes = len(args)
+ else:
+ dashes = args.index('--')
+
+ sections.append(args[:dashes])
+
+ # Next time through the loop, look at everything after this '--'.
+ if dashes + 1 == len(args):
+ # If the '--' is at the end of the list, we won't come back through the
+ # loop again. Add an empty section now corresponding to the nothingness
+ # following the final '--'.
+ args = []
+ sections.append(args)
+ else:
+ args = args[dashes + 1:]
+
+ return sections
+
+
+def main(args):
+ sections = SplitArgsIntoSections(args[1:])
+ assert len(sections) == 2 or len(sections) == 3
+ (outputs, inputs) = sections[:2]
+ if len(sections) == 3:
+ options = sections[2]
+ else:
+ options = []
+
+ # Make all output pathnames absolute so that they can be accessed after
+ # changing directory.
+ for index in xrange(0, len(outputs)):
+ outputs[index] = os.path.abspath(outputs[index])
+
+ outputDir = os.path.dirname(outputs[0])
+
+ # Look at the inputs and figure out which ones are make_names.pl, tags, and
+ # attributes. There can be at most one of each, and those are the only
+ # input types supported. make_names.pl is required and at least one of tags
+ # and attributes is required.
+ makeNamesInput = None
+ tagInput = None
+ attrInput = None
+ for input in inputs:
+ # Make input pathnames absolute so they can be accessed after changing
+ # directory. On Windows, convert \ to / for inputs to the perl script to
+ # work around the intermix of activepython + cygwin perl.
+ inputAbs = os.path.abspath(input)
+ inputAbsPosix = inputAbs.replace(os.path.sep, posixpath.sep)
+ inputBasename = os.path.basename(input)
+ if inputBasename == 'make_names.pl':
+ assert makeNamesInput == None
+ makeNamesInput = inputAbs
+ elif inputBasename.endswith('TagNames.in') \
+ or inputBasename.endswith('tags.in'):
+ assert tagInput == None
+ tagInput = inputAbsPosix
+ elif inputBasename.endswith('AttributeNames.in') \
+ or inputBasename.endswith('attrs.in'):
+ assert attrInput == None
+ attrInput = inputAbsPosix
+ else:
+ assert False
+
+ assert makeNamesInput != None
+ assert tagInput != None or attrInput != None
+
+ # scriptsPath is a Perl include directory, located relative to
+ # makeNamesInput.
+ scriptsPath = os.path.normpath(
+ os.path.join(os.path.dirname(makeNamesInput), os.pardir, 'bindings', 'scripts'))
+
+ # Change to the output directory because make_names.pl puts output in its
+ # working directory.
+ os.chdir(outputDir)
+
+ # Build up the command.
+ command = ['perl', '-I', scriptsPath, makeNamesInput]
+ if tagInput != None:
+ command.extend(['--tags', tagInput])
+ if attrInput != None:
+ command.extend(['--attrs', attrInput])
+ command.extend(options)
+
+ # Do it. check_call is new in 2.5, so simulate its behavior with call and
+ # assert.
+ returnCode = subprocess.call(command)
+ assert returnCode == 0
+
+ # Go through the outputs. Any output that belongs in a different directory
+ # is moved. Do a copy and delete instead of rename for maximum portability.
+ # Note that all paths used in this section are still absolute.
+ for output in outputs:
+ thisOutputDir = os.path.dirname(output)
+ if thisOutputDir != outputDir:
+ outputBasename = os.path.basename(output)
+ src = os.path.join(outputDir, outputBasename)
+ dst = os.path.join(thisOutputDir, outputBasename)
+ shutil.copyfile(src, dst)
+ os.unlink(src)
+
+ return returnCode
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/WebCore/WebCore.gyp/scripts/action_maketokenizer.py b/WebCore/WebCore.gyp/scripts/action_maketokenizer.py
new file mode 100644
index 0000000..f4a28ee
--- /dev/null
+++ b/WebCore/WebCore.gyp/scripts/action_maketokenizer.py
@@ -0,0 +1,101 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# usage: action_maketokenizer.py OUTPUTS -- INPUTS
+#
+# Multiple INPUTS may be listed. The sections are separated by -- arguments.
+#
+# OUTPUTS must contain a single item: a path to tokenizer.cpp.
+#
+# INPUTS must contain exactly two items. The first item must be the path to
+# maketokenizer. The second item must be the path to tokenizer.flex.
+
+
+import os
+import subprocess
+import sys
+
+
+def SplitArgsIntoSections(args):
+ sections = []
+ while len(args) > 0:
+ if not '--' in args:
+ # If there is no '--' left, everything remaining is an entire section.
+ dashes = len(args)
+ else:
+ dashes = args.index('--')
+
+ sections.append(args[:dashes])
+
+ # Next time through the loop, look at everything after this '--'.
+ if dashes + 1 == len(args):
+ # If the '--' is at the end of the list, we won't come back through the
+ # loop again. Add an empty section now corresponding to the nothingness
+ # following the final '--'.
+ args = []
+ sections.append(args)
+ else:
+ args = args[dashes + 1:]
+
+ return sections
+
+
+def main(args):
+ sections = SplitArgsIntoSections(args[1:])
+ assert len(sections) == 2
+ (outputs, inputs) = sections
+
+ assert len(outputs) == 1
+ output = outputs[0]
+
+ assert len(inputs) == 2
+ maketokenizer = inputs[0]
+ flexInput = inputs[1]
+
+ # Do it. check_call is new in 2.5, so simulate its behavior with call and
+ # assert.
+ outfile = open(output, 'wb')
+ p1 = subprocess.Popen(['flex', '-t', flexInput], stdout=subprocess.PIPE)
+ p2 = subprocess.Popen(['perl', maketokenizer], stdin=p1.stdout, stdout=outfile)
+
+ r1 = p1.wait()
+ r2 = p2.wait()
+ assert r1 == 0
+ assert r2 == 0
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/WebCore/WebCore.gyp/scripts/action_useragentstylesheets.py b/WebCore/WebCore.gyp/scripts/action_useragentstylesheets.py
new file mode 100644
index 0000000..6f017fc
--- /dev/null
+++ b/WebCore/WebCore.gyp/scripts/action_useragentstylesheets.py
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# usage: action_useragentstylesheets.py OUTPUTS -- INPUTS
+#
+# Multiple OUTPUTS and INPUTS may be listed. The sections are separated by
+# -- arguments.
+#
+# OUTPUTS must contain two items, in order: a path to UserAgentStyleSheets.h
+# and a path to UserAgentStyleSheetsData.cpp.
+#
+# INPUTS must contain at least two items. The first item must be the path to
+# make-css-file-arrays.pl. The remaining items are paths to style sheets to
+# be fed to that script.
+
+
+import os
+import subprocess
+import sys
+
+
+def SplitArgsIntoSections(args):
+ sections = []
+ while len(args) > 0:
+ if not '--' in args:
+ # If there is no '--' left, everything remaining is an entire section.
+ dashes = len(args)
+ else:
+ dashes = args.index('--')
+
+ sections.append(args[:dashes])
+
+ # Next time through the loop, look at everything after this '--'.
+ if dashes + 1 == len(args):
+ # If the '--' is at the end of the list, we won't come back through the
+ # loop again. Add an empty section now corresponding to the nothingness
+ # following the final '--'.
+ args = []
+ sections.append(args)
+ else:
+ args = args[dashes + 1:]
+
+ return sections
+
+
+def main(args):
+ sections = SplitArgsIntoSections(args[1:])
+ assert len(sections) == 2
+ (outputs, inputs) = sections
+
+ assert len(outputs) == 2
+ outputH = outputs[0]
+ outputCpp = outputs[1]
+
+ makeCssFileArrays = inputs[0]
+ styleSheets = inputs[1:]
+
+ # Build up the command.
+ command = ['perl', makeCssFileArrays, outputH, outputCpp]
+ command.extend(styleSheets)
+
+ # Do it. check_call is new in 2.5, so simulate its behavior with call and
+ # assert.
+ returnCode = subprocess.call(command)
+ assert returnCode == 0
+
+ return returnCode
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/WebCore/WebCore.gyp/scripts/rule_binding.py b/WebCore/WebCore.gyp/scripts/rule_binding.py
new file mode 100644
index 0000000..24d178f
--- /dev/null
+++ b/WebCore/WebCore.gyp/scripts/rule_binding.py
@@ -0,0 +1,135 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# usage: rule_binding.py INPUT CPPDIR HDIR -- INPUTS -- OPTIONS
+#
+# INPUT is an IDL file, such as Whatever.idl.
+#
+# CPPDIR is the directory into which V8Whatever.cpp will be placed. HDIR is
+# the directory into which V8Whatever.h will be placed.
+#
+# The first item in INPUTS is the path to generate-bindings.pl. Remaining
+# items in INPUTS are used to build the Perl module include path.
+#
+# OPTIONS are passed as-is to generate-bindings.pl as additional arguments.
+
+
+import errno
+import os
+import shlex
+import shutil
+import subprocess
+import sys
+
+
+def SplitArgsIntoSections(args):
+ sections = []
+ while len(args) > 0:
+ if not '--' in args:
+ # If there is no '--' left, everything remaining is an entire section.
+ dashes = len(args)
+ else:
+ dashes = args.index('--')
+
+ sections.append(args[:dashes])
+
+ # Next time through the loop, look at everything after this '--'.
+ if dashes + 1 == len(args):
+ # If the '--' is at the end of the list, we won't come back through the
+ # loop again. Add an empty section now corresponding to the nothingness
+ # following the final '--'.
+ args = []
+ sections.append(args)
+ else:
+ args = args[dashes + 1:]
+
+ return sections
+
+
+def main(args):
+ sections = SplitArgsIntoSections(args[1:])
+ assert len(sections) == 3, sections
+ (base, inputs, options) = sections
+
+ assert len(base) == 3, base
+ (input, cppdir, hdir) = base
+
+ assert len(inputs) > 1, inputs
+ generateBindings = inputs[0]
+ perlModules = inputs[1:]
+
+ includeDirs = []
+ for perlModule in perlModules:
+ includeDir = os.path.dirname(perlModule)
+ if not includeDir in includeDirs:
+ includeDirs.append(includeDir)
+
+ # The defines come in as one flat string. Split it up into distinct arguments.
+ if '--defines' in options:
+ definesIndex = options.index('--defines')
+ if definesIndex + 1 < len(options):
+ splitOptions = shlex.split(options[definesIndex + 1])
+ if splitOptions:
+ options[definesIndex + 1] = ' '.join(splitOptions)
+
+ # Build up the command.
+ command = ['perl', '-w']
+ for includeDir in includeDirs:
+ command.extend(['-I', includeDir])
+ command.append(generateBindings)
+ command.extend(options)
+ command.extend(['--outputDir', cppdir, input])
+
+ # Do it. check_call is new in 2.5, so simulate its behavior with call and
+ # assert.
+ returnCode = subprocess.call(command)
+ assert returnCode == 0
+
+ # Both the .cpp and .h were generated in cppdir, but if hdir is different,
+ # the .h needs to move. Copy it instead of using os.rename for maximum
+ # portability in all cases.
+ if cppdir != hdir:
+ inputBasename = os.path.basename(input)
+ (root, ext) = os.path.splitext(inputBasename)
+ hname = 'V8%s.h' % root
+ hsrc = os.path.join(cppdir, hname)
+ hdst = os.path.join(hdir, hname)
+ shutil.copyfile(hsrc, hdst)
+ os.unlink(hsrc)
+
+ return returnCode
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/WebCore/WebCore.gyp/scripts/rule_bison.py b/WebCore/WebCore.gyp/scripts/rule_bison.py
new file mode 100644
index 0000000..eb85a4b
--- /dev/null
+++ b/WebCore/WebCore.gyp/scripts/rule_bison.py
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# usage: rule_bison.py INPUT_FILE OUTPUT_DIR
+# INPUT_FILE is a path to either CSSGrammar.y or XPathGrammar.y.
+# OUTPUT_DIR is where the bison-generated .cpp and .h files should be placed.
+
+import errno
+import os
+import os.path
+import subprocess
+import sys
+
+assert len(sys.argv) == 3
+
+inputFile = sys.argv[1]
+outputDir = sys.argv[2]
+
+inputName = os.path.basename(inputFile)
+assert inputName == 'CSSGrammar.y' or inputName == 'XPathGrammar.y'
+prefix = {'CSSGrammar.y': 'cssyy', 'XPathGrammar.y': 'xpathyy'}[inputName]
+
+(inputRoot, inputExt) = os.path.splitext(inputName)
+
+# The generated .h will be in a different location depending on the bison
+# version.
+outputHTries = [
+ os.path.join(outputDir, inputRoot + '.cpp.h'),
+ os.path.join(outputDir, inputRoot + '.hpp'),
+]
+
+for outputHTry in outputHTries:
+ try:
+ os.unlink(outputHTry)
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+
+outputCpp = os.path.join(outputDir, inputRoot + '.cpp')
+
+returnCode = subprocess.call(['bison', '-d', '-p', prefix, inputFile, '-o', outputCpp])
+assert returnCode == 0
+
+# Find the name that bison used for the generated header file.
+outputHTmp = None
+for outputHTry in outputHTries:
+ try:
+ os.stat(outputHTry)
+ outputHTmp = outputHTry
+ break
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+
+assert outputHTmp != None
+
+# Read the header file in under the generated name and remove it.
+outputHFile = open(outputHTmp)
+outputHContents = outputHFile.read()
+outputHFile.close()
+os.unlink(outputHTmp)
+
+# Rewrite the generated header with #include guards.
+outputH = os.path.join(outputDir, inputRoot + '.h')
+
+outputHFile = open(outputH, 'w')
+print >>outputHFile, '#ifndef %sH' % inputRoot
+print >>outputHFile, '#define %sH' % inputRoot
+print >>outputHFile, outputHContents
+print >>outputHFile, '#endif'
+outputHFile.close()
diff --git a/WebCore/WebCore.gyp/scripts/rule_gperf.py b/WebCore/WebCore.gyp/scripts/rule_gperf.py
new file mode 100644
index 0000000..e76ed6f
--- /dev/null
+++ b/WebCore/WebCore.gyp/scripts/rule_gperf.py
@@ -0,0 +1,85 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# usage: rule_gperf.py INPUT_FILE OUTPUT_DIR
+# INPUT_FILE is a path to DocTypeStrings.gperf, HTMLEntityNames.gperf, or
+# ColorData.gperf.
+# OUTPUT_DIR is where the gperf-generated .cpp file should be placed. Because
+# some users want a .c file instead of a .cpp file, the .cpp file is copied
+# to .c when done.
+
+import posixpath
+import shutil
+import subprocess
+import sys
+
+assert len(sys.argv) == 3
+
+inputFile = sys.argv[1]
+outputDir = sys.argv[2]
+
+gperfCommands = {
+ 'DocTypeStrings.gperf': [
+ '-CEot', '-L', 'ANSI-C', '-k*', '-N', 'findDoctypeEntry',
+ '-F', ',PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards'
+ ],
+ 'HTMLEntityNames.gperf': [
+ '-a', '-L', 'ANSI-C', '-C', '-G', '-c', '-o', '-t', '-k*',
+ '-N', 'findEntity', '-D', '-s', '2'
+ ],
+ 'ColorData.gperf': [
+ '-CDEot', '-L', 'ANSI-C', '-k*', '-N', 'findColor', '-D', '-s', '2'
+ ],
+}
+
+inputName = posixpath.basename(inputFile)
+assert inputName in gperfCommands
+
+(inputRoot, inputExt) = posixpath.splitext(inputName)
+outputCpp = posixpath.join(outputDir, inputRoot + '.cpp')
+
+#command = ['gperf', '--output-file', outputCpp]
+command = ['gperf']
+command.extend(gperfCommands[inputName])
+command.append(inputFile)
+
+ofile = open(outputCpp, 'w')
+
+# Do it. check_call is new in 2.5, so simulate its behavior with call and
+# assert.
+returnCode = subprocess.call(command, stdout=ofile.fileno())
+assert returnCode == 0
+
+outputC = posixpath.join(outputDir, inputRoot + '.c')
+shutil.copyfile(outputCpp, outputC)