Add dependency to ICU 4.6
authorjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 1 Jul 2013 08:32:41 +0000 (08:32 +0000)
committerjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 1 Jul 2013 08:32:41 +0000 (08:32 +0000)
We use the patched version from the chromium project, as it already has
a gyp file and allows for using the system icu instead of the bundled
version if desired.

This is in preparation of bringing in v8-i18n.

R=jkummerow@chromium.org
BUG=v8:2745

Review URL: https://codereview.chromium.org/17850002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15402 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

DEPS
Makefile
build/shim_headers.gypi [new file with mode: 0644]
build/standalone.gypi
tools/generate_shim_headers/generate_shim_headers.py [new file with mode: 0755]

diff --git a/DEPS b/DEPS
index 5d84d8b..4f1a5cf 100644 (file)
--- a/DEPS
+++ b/DEPS
@@ -6,6 +6,9 @@ deps = {
   # Remember to keep the revision in sync with the Makefile.
   "v8/build/gyp":
     "http://gyp.googlecode.com/svn/trunk@1656",
+
+  "v8/third_party/icu":
+    "https://src.chromium.org/chrome/trunk/deps/third_party/icu46@205936",
 }
 
 deps_os = {
index 0c61d83..78e22d7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -392,3 +392,6 @@ $(ENVFILE).new:
 dependencies:
        svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
            --revision 1656
+       svn checkout --force \
+           https://src.chromium.org/chrome/trunk/deps/third_party/icu46 \
+           third_party/icu --revision 205936
diff --git a/build/shim_headers.gypi b/build/shim_headers.gypi
new file mode 100644 (file)
index 0000000..940211c
--- /dev/null
@@ -0,0 +1,73 @@
+# Copyright 2013 the V8 project authors. 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.
+
+# This file is meant to be included into a target to handle shim headers
+# in a consistent manner. To use this the following variables need to be
+# defined:
+#   headers_root_path: string: path to directory containing headers
+#   header_filenames: list: list of header file names
+
+{
+  'variables': {
+    'shim_headers_path': '<(SHARED_INTERMEDIATE_DIR)/shim_headers/<(_target_name)/<(_toolset)',
+    'shim_generator_additional_args%': [],
+  },
+  'include_dirs++': [
+    '<(shim_headers_path)',
+  ],
+  'all_dependent_settings': {
+    'include_dirs+++': [
+      '<(shim_headers_path)',
+    ],
+  },
+  'actions': [
+    {
+      'variables': {
+        'generator_path': '<(DEPTH)/tools/generate_shim_headers/generate_shim_headers.py',
+        'generator_args': [
+          '--headers-root', '<(headers_root_path)',
+          '--output-directory', '<(shim_headers_path)',
+          '<@(shim_generator_additional_args)',
+          '<@(header_filenames)',
+        ],
+      },
+      'action_name': 'generate_<(_target_name)_shim_headers',
+      'inputs': [
+        '<(generator_path)',
+      ],
+      'outputs': [
+        '<!@pymod_do_main(generate_shim_headers <@(generator_args) --outputs)',
+      ],
+      'action': ['python',
+                 '<(generator_path)',
+                 '<@(generator_args)',
+                 '--generate',
+      ],
+      'message': 'Generating <(_target_name) shim headers.',
+    },
+  ],
+}
index 8373bc9..b14adfa 100644 (file)
@@ -30,6 +30,7 @@
 {
   'variables': {
     'component%': 'static_library',
+    'clang%': 0,
     'visibility%': 'hidden',
     'v8_enable_backtrace%': 0,
     'msvs_multi_core_compile%': '1',
diff --git a/tools/generate_shim_headers/generate_shim_headers.py b/tools/generate_shim_headers/generate_shim_headers.py
new file mode 100755 (executable)
index 0000000..d0e6d06
--- /dev/null
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 the V8 project authors. 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.
+
+"""
+Generates shim headers that mirror the directory structure of bundled headers,
+but just forward to the system ones.
+
+This allows seamless compilation against system headers with no changes
+to our source code.
+"""
+
+
+import optparse
+import os.path
+import sys
+
+
+def GeneratorMain(argv):
+  parser = optparse.OptionParser()
+  parser.add_option('--headers-root', action='append')
+  parser.add_option('--define', action='append')
+  parser.add_option('--output-directory')
+  parser.add_option('--prefix', default='')
+  parser.add_option('--use-include-next', action='store_true')
+  parser.add_option('--outputs', action='store_true')
+  parser.add_option('--generate', action='store_true')
+
+  options, args = parser.parse_args(argv)
+
+  if not options.headers_root:
+    parser.error('Missing --headers-root parameter.')
+  if not options.output_directory:
+    parser.error('Missing --output-directory parameter.')
+  if not args:
+    parser.error('Missing arguments - header file names.')
+
+  source_tree_root = os.path.abspath(
+    os.path.join(os.path.dirname(__file__), '..', '..'))
+
+  for root in options.headers_root:
+    target_directory = os.path.join(
+      options.output_directory,
+      os.path.relpath(root, source_tree_root))
+    if options.generate and not os.path.exists(target_directory):
+      os.makedirs(target_directory)
+
+    for header_spec in args:
+      if ';' in header_spec:
+        (header_filename,
+         include_before,
+         include_after) = header_spec.split(';', 2)
+      else:
+        header_filename = header_spec
+        include_before = ''
+        include_after = ''
+      if options.outputs:
+        yield os.path.join(target_directory, header_filename)
+      if options.generate:
+        with open(os.path.join(target_directory, header_filename), 'w') as f:
+          if options.define:
+            for define in options.define:
+              key, value = define.split('=', 1)
+              # This non-standard push_macro extension is supported
+              # by compilers we support (GCC, clang).
+              f.write('#pragma push_macro("%s")\n' % key)
+              f.write('#undef %s\n' % key)
+              f.write('#define %s %s\n' % (key, value))
+
+          if include_before:
+            for header in include_before.split(':'):
+              f.write('#include %s\n' % header)
+
+          include_target = options.prefix + header_filename
+          if options.use_include_next:
+            f.write('#include_next <%s>\n' % include_target)
+          else:
+            f.write('#include <%s>\n' % include_target)
+
+          if include_after:
+            for header in include_after.split(':'):
+              f.write('#include %s\n' % header)
+
+          if options.define:
+            for define in options.define:
+              key, value = define.split('=', 1)
+              # This non-standard pop_macro extension is supported
+              # by compilers we support (GCC, clang).
+              f.write('#pragma pop_macro("%s")\n' % key)
+
+
+def DoMain(argv):
+  return '\n'.join(GeneratorMain(argv))
+
+
+if __name__ == '__main__':
+  DoMain(sys.argv[1:])