Use native (non-cygwin) binaries for perl, gperf, and bison in Chromium
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jul 2012 16:56:35 +0000 (16:56 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jul 2012 16:56:35 +0000 (16:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91667

Patch by Scott Graham <scottmg@chromium.org> on 2012-07-19
Reviewed by Kentaro Hara.

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

No new tests.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123117 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/WebCore.gyp/scripts/rule_bison.py
Source/WebCore/bindings/scripts/preprocessor.pm
Source/WebCore/make-hash-tools.pl

index 1c9b3d0..cbaa207 100644 (file)
@@ -1,3 +1,22 @@
+2012-07-19  Scott Graham  <scottmg@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 Kentaro Hara.
+
+        Using native tools instead of cygwin version improves build time
+        performance by roughly 50% (on top of previous cl-instead-of-gcc
+        change).
+
+        No new tests.
+
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gyp/scripts/rule_bison.py:
+        * bindings/scripts/preprocessor.pm:
+        (applyPreprocessor):
+        * make-hash-tools.pl:
+
 2012-07-19  Andrey Kosyakov  <caseq@chromium.org>
 
         Web Inspector: CPU bars are not cleared along with the rest of the timeline panel
index 5e9a75f..9b678c5 100644 (file)
           '../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': [
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptSource.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'InjectedScriptSource_js',
             '<@(_inputs)',
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/InjectedScriptWebGLModuleSource.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'InjectedScriptWebGLModuleSource_js',
             '<@(_inputs)',
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/DebuggerScriptSource.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'DebuggerScriptSource_js',
             '<@(_inputs)',
           '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',
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/V8ArrayBufferViewCustomScript.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'V8ArrayBufferViewCustomScript_js',
             '<@(_inputs)',
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerCSS.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'XMLViewer_css',
             '<@(_inputs)',
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLViewerJS.h',
           ],
+          'msvs_cygwin_shell': 0,
           'action': [
-            'perl',
+            '<(perl_exe)',
             '../inspector/xxd.pl',
             'XMLViewer_js',
             '<@(_inputs)',
             'python',
             'scripts/rule_bison.py',
             '<(RULE_INPUT_PATH)',
-            '<(SHARED_INTERMEDIATE_DIR)/webkit'
+            '<(SHARED_INTERMEDIATE_DIR)/webkit',
+            '<(bison_exe)',
           ],
         },
         {
           '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.
               '--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',
             '--additionalIdlFilesList',
             '<(additional_idl_files_list)',
             '<(RULE_INPUT_PATH)',
+            '<@(preprocessor)',
           ],
           'message': 'Generating binding from <(RULE_INPUT_PATH)',
         },
index eb85a4b..952165a 100644 (file)
@@ -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 os.path
 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 @@ for outputHTry in outputHTries:
 
 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.
index 3b4cec1..95995f0 100644 (file)
@@ -63,7 +63,7 @@ sub applyPreprocessor
     @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 {
index ea3a0f5..9d94707 100644 (file)
@@ -29,10 +29,10 @@ my $option = basename($ARGV[0],".gperf");
 
 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";
+    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 {