[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:20:37 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 49ad8f7c567cb8311a3739a374323edae706295b
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 3 21:24:45 2009 +0000

    2009-11-03  Yaar Schnitman  <yaar at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            Imported action and rules python files that WebCore.gyp depends on.
            These files used to live in chromium.org and deal mostly with auto-generation
            of code by wrapping existing webkit perl scripts.
    
            https://bugs.webkit.org/show_bug.cgi?id=31071
    
            * WebCore.gyp/WebCore.gyp: Fixed paths in actions and rules.
            * WebCore.gyp/scripts/action_csspropertynames.py: Added.
            * WebCore.gyp/scripts/action_cssvaluekeywords.py: Added.
            * WebCore.gyp/scripts/action_makenames.py: Added.
            * WebCore.gyp/scripts/action_maketokenizer.py: Added.
            * WebCore.gyp/scripts/action_useragentstylesheets.py: Added.
            * WebCore.gyp/scripts/rule_binding.py: Added.
            * WebCore.gyp/scripts/rule_bison.py: Added.
            * WebCore.gyp/scripts/rule_gperf.py: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50480 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1b36046..c7ad44b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-11-03  Yaar Schnitman  <yaar at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Imported action and rules python files that WebCore.gyp depends on. 
+        These files used to live in chromium.org and deal mostly with auto-generation
+        of code by wrapping existing webkit perl scripts.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31071
+
+        * WebCore.gyp/WebCore.gyp: Fixed paths in actions and rules.
+        * WebCore.gyp/scripts/action_csspropertynames.py: Added.
+        * WebCore.gyp/scripts/action_cssvaluekeywords.py: Added.
+        * WebCore.gyp/scripts/action_makenames.py: Added.
+        * WebCore.gyp/scripts/action_maketokenizer.py: Added.
+        * WebCore.gyp/scripts/action_useragentstylesheets.py: Added.
+        * WebCore.gyp/scripts/rule_binding.py: Added.
+        * WebCore.gyp/scripts/rule_bison.py: Added.
+        * WebCore.gyp/scripts/rule_gperf.py: Added.
+
 2009-11-03  Bradley Green  <brg at chromium.org>
 
         Reviewed by Dmitry Titov.
diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
index f711850..eb10eee 100644
--- a/WebCore/WebCore.gyp/WebCore.gyp
+++ b/WebCore/WebCore.gyp/WebCore.gyp
@@ -273,7 +273,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/action_csspropertynames.py',
+            'scripts/action_csspropertynames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)'
@@ -292,7 +292,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/action_cssvaluekeywords.py',
+            'scripts/action_cssvaluekeywords.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)'
@@ -315,7 +315,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/action_makenames.py',
+            'scripts/action_makenames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)',
@@ -342,7 +342,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/action_makenames.py',
+            'scripts/action_makenames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)',
@@ -371,7 +371,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/action_useragentstylesheets.py',
+            'scripts/action_useragentstylesheets.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)'
@@ -389,7 +389,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/action_makenames.py',
+            'scripts/action_makenames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)',
@@ -409,7 +409,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/action_makenames.py',
+            'scripts/action_makenames.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)',
@@ -428,7 +428,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/action_maketokenizer.py',
+            'scripts/action_maketokenizer.py',
             '<@(_outputs)',
             '--',
             '<@(_inputs)'
@@ -446,7 +446,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/rule_bison.py',
+            'scripts/rule_bison.py',
             '<(RULE_INPUT_PATH)',
             '<(SHARED_INTERMEDIATE_DIR)/webkit'
           ],
@@ -469,7 +469,7 @@
           ],
           'action': [
             'python',
-            '<(chromium_src_dir)/webkit/build/rule_gperf.py',
+            'scripts/rule_gperf.py',
             '<(RULE_INPUT_PATH)',
             '<(SHARED_INTERMEDIATE_DIR)/webkit'
           ],
@@ -514,7 +514,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',
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)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list