[GTK] Improve gyp build JavaScriptCore code generation
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 21:53:57 +0000 (21:53 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 21:53:57 +0000 (21:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109969

Reviewed by Dirk Pranke.

Switch away from using DerivedSources.make when building JavaScriptCore generated
sources. This bring a couple advantages, such as building the sources in parallel,
but requires us to list the generated sources more than once.

* JavaScriptCore.gyp/JavaScriptCoreGTK.gyp: Add rules for generating JavaScriptCore sources.
* JavaScriptCore.gyp/generate-derived-sources.sh: Added.
* JavaScriptCore.gyp/redirect-stdout.sh: Added.

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCoreGTK.gyp
Source/JavaScriptCore/JavaScriptCore.gyp/generate-derived-sources.sh [deleted file]
Source/JavaScriptCore/JavaScriptCore.gyp/redirect-stdout.sh [new file with mode: 0755]

index 7e7fd4b..cfb354f 100644 (file)
@@ -1,3 +1,18 @@
+2013-02-15  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] Improve gyp build JavaScriptCore code generation
+        https://bugs.webkit.org/show_bug.cgi?id=109969
+
+        Reviewed by Dirk Pranke.
+
+        Switch away from using DerivedSources.make when building JavaScriptCore generated
+        sources. This bring a couple advantages, such as building the sources in parallel,
+        but requires us to list the generated sources more than once.
+
+        * JavaScriptCore.gyp/JavaScriptCoreGTK.gyp: Add rules for generating JavaScriptCore sources.
+        * JavaScriptCore.gyp/generate-derived-sources.sh: Added.
+        * JavaScriptCore.gyp/redirect-stdout.sh: Added.
+
 2013-02-19  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r143348.
index 5e75f1a..a90ad11 100644 (file)
       ],
     },
     {
+      'target_name': 'GenerateLUTs',
+      'type': 'none',
+      'sources': [
+          '../runtime/ArrayConstructor.cpp',
+          '../runtime/ArrayPrototype.cpp',
+          '../runtime/BooleanPrototype.cpp',
+          '../runtime/DateConstructor.cpp',
+          '../runtime/DatePrototype.cpp',
+          '../runtime/ErrorPrototype.cpp',
+          '../runtime/JSONObject.cpp',
+          '../runtime/JSGlobalObject.cpp',
+          '../runtime/MathObject.cpp',
+          '../runtime/NamePrototype.cpp',
+          '../runtime/NumberConstructor.cpp',
+          '../runtime/NumberPrototype.cpp',
+          '../runtime/ObjectConstructor.cpp',
+          '../runtime/ObjectPrototype.cpp',
+          '../runtime/RegExpConstructor.cpp',
+          '../runtime/RegExpPrototype.cpp',
+          '../runtime/RegExpObject.cpp',
+          '../runtime/StringConstructor.cpp',
+          '../runtime/StringPrototype.cpp',
+      ],
+      'rules' : [
+        {
+          'rule_name': 'GenerateLUT',
+          'extension': 'cpp',
+          'inputs': [ '<(JavaScriptCore)/create_hash_table', ],
+          'outputs': [
+            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/<(RULE_INPUT_ROOT).lut.h',
+          ],
+          'action': [
+            './redirect-stdout.sh',
+            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/<(RULE_INPUT_ROOT).lut.h',
+            'perl', '<@(_inputs)', '<(RULE_INPUT_PATH)', '-i',
+          ],
+        }
+      ],
+      'actions': [
+        {
+          'action_name': 'GenerateLexerLUT',
+          'inputs': [
+              '<(JavaScriptCore)/create_hash_table',
+              '<(JavaScriptCore)/parser/Keywords.table',
+           ],
+          'outputs': [ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/Lexer.lut.h', ],
+          'action': [
+            './redirect-stdout.sh',
+            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/Lexer.lut.h',
+            'perl', '<@(_inputs)',
+          ],
+        },
+      ],
+    },
+    {
       'target_name': 'libjavascriptcoregtk',
         'type': 'shared_library',
         'dependencies': [
-          '<(Source)/WTF/WTF.gyp/WTFGTK.gyp:wtf',
-          'LLIntOffsetExtractor',
           '<(Dependencies):glib',
           '<(Dependencies):icu',
+          '<(Source)/WTF/WTF.gyp/WTFGTK.gyp:wtf',
+          'GenerateLUTs',
+          'LLIntOffsetExtractor',
         ],
         'product_extension': 'so.<@(javascriptcore_soname_version)',
         'product_name': 'javascriptcoregtk-<@(api_version)',
         ],
       'actions': [
         {
-          'action_name': 'Generate Derived Sources',
-          'inputs': [
-            '<(JavaScriptCore)/DerivedSources.make',
-            'generate-derived-sources.sh',
-          ],
-          'outputs': [
-            '<@(javascriptcore_derived_source_files)',
-          ],
-          'action': ['sh', 'generate-derived-sources.sh', '<@(project_dir)', '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore'],
-        },
-        {
           'action_name': 'llintassembly_header_generation',
           'inputs': [
             '<(JavaScriptCore)/offlineasm/asm.rb',
           ],
           'action': ['ruby', '<@(_inputs)', '<@(_outputs)'],
         },
+        {
+          'action_name': 'GenerateRegExpJitTables',
+          'inputs': [ '<(JavaScriptCore)/create_regex_tables', ],
+          'outputs': [ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpJitTables.h', ],
+          'action': [
+            './redirect-stdout.sh',
+            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/RegExpJitTables.h',
+            'python', '<@(_inputs)'
+          ],
+        },
+        {
+          'action_name': 'GenerateKeywordLookup',
+          'inputs': [
+            '<(JavaScriptCore)/KeywordLookupGenerator.py',
+            '<(JavaScriptCore)/parser/Keywords.table',
+          ],
+          'outputs': [ '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/KeywordLookup.h', ],
+          'action': [
+            './redirect-stdout.sh',
+            '<(PRODUCT_DIR)/DerivedSources/JavaScriptCore/KeywordLookup.h',
+            'python', '<@(_inputs)'
+          ],
+        },
       ],
     },
     {
diff --git a/Source/JavaScriptCore/JavaScriptCore.gyp/generate-derived-sources.sh b/Source/JavaScriptCore/JavaScriptCore.gyp/generate-derived-sources.sh
deleted file mode 100644 (file)
index da44523..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-abspath () {
-    case "$1" in /*)
-        printf "%s\n" "$1";;
-    *)
-        printf "%s\n" "$PWD/$1";;
-    esac;
-}
-
-JavaScriptCore=`abspath $1`
-cd $2
-echo `abspath $2`
-make --no-builtin-rules -f "$JavaScriptCore/DerivedSources.make" JavaScriptCore=$JavaScriptCore
-
diff --git a/Source/JavaScriptCore/JavaScriptCore.gyp/redirect-stdout.sh b/Source/JavaScriptCore/JavaScriptCore.gyp/redirect-stdout.sh
new file mode 100755 (executable)
index 0000000..db8ee99
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+OUTPUT_FILE=$1
+shift
+$@ > $OUTPUT_FILE