Title: [123496] trunk/Source/WebCore
Revision
123496
Author
t...@chromium.org
Date
2012-07-24 11:23:41 -0700 (Tue, 24 Jul 2012)

Log Message

Use native (non-cygwin) binaries for perl, gperf, and bison in Chromium
https://bugs.webkit.org/show_bug.cgi?id=91667

Patch by Scott Graham <scot...@chromium.org> on 2012-07-24
Reviewed by Tony Chang.

Using native tools instead of cygwin version improves build time
performance by roughly 50% (on top of previous cl-instead-of-gcc
change).

Also, use - instead of / for cl flags, otherwise preprocessing fails
very slowly (due to retry loop). And, replace \ with / in gperf
command line. Without this, gperf emits the filename literally in
#line directives which causes VS to error with "unescaped \ in
string". Bizarrely, building ColorData.cpp with those \ in place
causes the IDE to exit with no error message, which was the cause of
the previous canary failures.

No new tests.

* WebCore.gyp/WebCore.gyp:
* WebCore.gyp/scripts/rule_bison.py:
* bindings/scripts/preprocessor.pm:
(applyPreprocessor):
* make-hash-tools.pl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123495 => 123496)


--- trunk/Source/WebCore/ChangeLog	2012-07-24 18:17:44 UTC (rev 123495)
+++ trunk/Source/WebCore/ChangeLog	2012-07-24 18:23:41 UTC (rev 123496)
@@ -1,3 +1,30 @@
+2012-07-24  Scott Graham  <scot...@chromium.org>
+
+        Use native (non-cygwin) binaries for perl, gperf, and bison in Chromium
+        https://bugs.webkit.org/show_bug.cgi?id=91667
+
+        Reviewed by Tony Chang.
+
+        Using native tools instead of cygwin version improves build time
+        performance by roughly 50% (on top of previous cl-instead-of-gcc
+        change).
+
+        Also, use - instead of / for cl flags, otherwise preprocessing fails
+        very slowly (due to retry loop). And, replace \ with / in gperf
+        command line. Without this, gperf emits the filename literally in
+        #line directives which causes VS to error with "unescaped \ in
+        string". Bizarrely, building ColorData.cpp with those \ in place
+        causes the IDE to exit with no error message, which was the cause of
+        the previous canary failures.
+
+        No new tests.
+
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gyp/scripts/rule_bison.py:
+        * bindings/scripts/preprocessor.pm:
+        (applyPreprocessor):
+        * make-hash-tools.pl:
+
 2012-07-24  Daniel Cheng  <dch...@chromium.org>
 
         Files from drag and file <input> should use getMIMETypeForExtension to determine content type.

Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (123495 => 123496)


--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-07-24 18:17:44 UTC (rev 123495)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-07-24 18:23:41 UTC (rev 123496)
@@ -224,10 +224,23 @@
           '../platform/text/win',
           '../platform/win',
         ],
+        # Using native perl rather than cygwin perl cuts execution time of idl
+        # preprocessing rules by a bit more than 50%.
+        'perl_exe': '<(DEPTH)/third_party/perl/perl/bin/perl.exe',
+        'gperf_exe': '<(DEPTH)/third_party/gperf/bin/gperf.exe',
+        'bison_exe': '<(DEPTH)/third_party/bison/bin/bison.exe',
+        # Using cl instead of cygwin gcc cuts the processing time from
+        # 1m58s to 0m52s.
+        'preprocessor': '--preprocessor "cl.exe -nologo -EP -TP"',
       },{
         # enable -Wall and -Werror, just for Mac and Linux builds for now
         # FIXME: Also enable this for Windows after verifying no warnings
         'chromium_code': 1,
+        'perl_exe': 'perl',
+        'gperf_exe': 'gperf',
+        'bison_exe': 'bison',
+        # Without one specified, the scripts default to 'gcc'.
+        'preprocessor': '',
       }],
       ['use_x11==1 or OS=="android"', {
         'webcore_include_dirs': [
@@ -433,8 +446,9 @@
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptSource.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'InjectedScriptSource_js',
             '<@(_inputs)',
@@ -456,8 +470,9 @@
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptWebGLModuleSource.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'InjectedScriptWebGLModuleSource_js',
             '<@(_inputs)',
@@ -479,8 +494,9 @@
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/DebuggerScriptSource.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'DebuggerScriptSource_js',
             '<@(_inputs)',
@@ -511,19 +527,9 @@
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
           ],
-          'conditions': [
-            ['OS=="win"', {
-              'variables': {
-                # Using cl instead of cygwin gcc cuts the processing time from
-                # 1m58s to 0m52s.
-                'preprocessor': '--preprocessor "cl.exe /nologo /EP /TP"',
-              },
-            }, {
-              'variables': { 'preprocessor': '', }
-            }],
-          ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '-w',
             '-I../bindings/scripts',
             '../bindings/scripts/preprocess-idls.pl',
@@ -575,8 +581,9 @@
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/V8ArrayBufferViewCustomScript.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'V8ArrayBufferViewCustomScript_js',
             '<@(_inputs)',
@@ -592,8 +599,9 @@
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerCSS.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'XMLViewer_css',
             '<@(_inputs)',
@@ -608,8 +616,9 @@
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerJS.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'XMLViewer_js',
             '<@(_inputs)',
@@ -1017,7 +1026,8 @@
             'python',
             'scripts/rule_bison.py',
             '<(RULE_INPUT_PATH)',
-            '<(SHARED_INTERMEDIATE_DIR)/webkit'
+            '<(SHARED_INTERMEDIATE_DIR)/webkit',
+            '<(bison_exe)',
           ],
         },
         {
@@ -1032,11 +1042,13 @@
           'inputs': [
             '../make-hash-tools.pl',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../make-hash-tools.pl',
             '<(SHARED_INTERMEDIATE_DIR)/webkit',
             '<(RULE_INPUT_PATH)',
+            '<(gperf_exe)',
           ],
         },
         # Rule to build generated _javascript_ (V8) bindings from .idl source.
@@ -1084,13 +1096,14 @@
               '--include', '../xml',
             ],
           },
+          'msvs_cygwin_shell': 0,
           # FIXME:  Note that we put the .cpp files in webcore/bindings
           # but the .h files in webkit/bindings.  This is to work around
           # the unfortunate fact that GYP strips duplicate arguments
           # from lists.  When we have a better GYP way to suppress that
           # behavior, change the output location.
           'action': [
-            'perl',
+            '<(perl_exe)',
             '-w',
             '-I../bindings/scripts',
             '../bindings/scripts/generate-bindings.pl',
@@ -1108,6 +1121,7 @@
             '--additionalIdlFilesList',
             '<(additional_idl_files_list)',
             '<(RULE_INPUT_PATH)',
+            '<@(preprocessor)',
           ],
           'message': 'Generating binding from <(RULE_INPUT_PATH)',
         },

Modified: trunk/Source/WebCore/WebCore.gyp/scripts/rule_bison.py (123495 => 123496)


--- trunk/Source/WebCore/WebCore.gyp/scripts/rule_bison.py	2012-07-24 18:17:44 UTC (rev 123495)
+++ trunk/Source/WebCore/WebCore.gyp/scripts/rule_bison.py	2012-07-24 18:23:41 UTC (rev 123496)
@@ -32,7 +32,7 @@
 # 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
+# usage: rule_bison.py INPUT_FILE OUTPUT_DIR [BISON_EXE]
 # 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.
 
@@ -42,10 +42,13 @@
 import subprocess
 import sys
 
-assert len(sys.argv) == 3
+assert len(sys.argv) == 3 or len(sys.argv) == 4
 
 inputFile = sys.argv[1]
 outputDir = sys.argv[2]
+bisonExe = 'bison'
+if len(sys.argv) > 3:
+    bisonExe = sys.argv[3]
 
 inputName = os.path.basename(inputFile)
 assert inputName == 'CSSGrammar.y' or inputName == 'XPathGrammar.y'
@@ -69,7 +72,7 @@
 
 outputCpp = os.path.join(outputDir, inputRoot + '.cpp')
 
-returnCode = subprocess.call(['bison', '-d', '-p', prefix, inputFile, '-o', outputCpp])
+returnCode = subprocess.call([bisonExe, '-d', '-p', prefix, inputFile, '-o', outputCpp])
 assert returnCode == 0
 
 # Find the name that bison used for the generated header file.

Modified: trunk/Source/WebCore/bindings/scripts/preprocessor.pm (123495 => 123496)


--- trunk/Source/WebCore/bindings/scripts/preprocessor.pm	2012-07-24 18:17:44 UTC (rev 123495)
+++ trunk/Source/WebCore/bindings/scripts/preprocessor.pm	2012-07-24 18:23:41 UTC (rev 123496)
@@ -63,7 +63,7 @@
     @macros = map { "-D$_" } @macros;
 
     my $pid = 0;
-    if ($Config{osname} eq "cygwin") {
+    if ($Config{osname} eq "cygwin" || $Config{osname} eq 'MSWin32') {
         # This call can fail if Windows rebases cygwin, so retry a few times until it succeeds.
         for (my $tries = 0; !$pid && ($tries < 20); $tries++) {
             eval {

Modified: trunk/Source/WebCore/make-hash-tools.pl (123495 => 123496)


--- trunk/Source/WebCore/make-hash-tools.pl	2012-07-24 18:17:44 UTC (rev 123495)
+++ trunk/Source/WebCore/make-hash-tools.pl	2012-07-24 18:23:41 UTC (rev 123496)
@@ -29,10 +29,14 @@
 
 if ($option eq "ColorData") {
     my $colorDataGenerated         = "$outdir/ColorData.cpp";
-    my $colorDataGperf             = $ARGV[0];
-    shift;
+    my $colorDataGperf             = shift;
+    my $customGperf                = shift;
 
-    my $gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf";
+    # gperf emits this filename literally in #line directives, but VS errors
+    # out because the filenames then contain unescaped \s, so replace the \
+    # with /.
+    $colorDataGperf =~ s/\\/\//g;
+    my $gperf = $ENV{GPERF} ? $ENV{GPERF} : ($customGperf ? $customGperf : "gperf");
     system("\"$gperf\" --key-positions=\"*\" -D -s 2 $colorDataGperf --output-file=$colorDataGenerated") == 0 || die "calling gperf failed: $?";
 
 } else {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to