configure: make --v8-options switch more robust
[platform/upstream/nodejs.git] / node.gyp
index 6acb18a..ec64d22 100644 (file)
--- a/node.gyp
+++ b/node.gyp
@@ -1,9 +1,6 @@
 {
   'variables': {
     'v8_use_snapshot%': 'true',
-    # Turn off -Werror in V8
-    # See http://codereview.chromium.org/8159015
-    'werror': '',
     'node_use_dtrace%': 'false',
     'node_use_etw%': 'false',
     'node_use_perfctr%': 'false',
@@ -14,8 +11,9 @@
     'node_shared_cares%': 'false',
     'node_shared_libuv%': 'false',
     'node_use_openssl%': 'true',
-    'node_use_systemtap%': 'false',
     'node_shared_openssl%': 'false',
+    'node_use_mdb%': 'false',
+    'node_v8_options%': '',
     'library_files': [
       'src/node.js',
       'lib/_debugger.js',
@@ -49,6 +47,7 @@
       'lib/querystring.js',
       'lib/readline.js',
       'lib/repl.js',
+      'lib/smalloc.js',
       'lib/stream.js',
       'lib/_stream_readable.js',
       'lib/_stream_writable.js',
       'lib/string_decoder.js',
       'lib/sys.js',
       'lib/timers.js',
+      'lib/tracing.js',
       'lib/tls.js',
+      'lib/_tls_common.js',
+      'lib/_tls_legacy.js',
+      'lib/_tls_wrap.js',
       'lib/tty.js',
       'lib/url.js',
       'lib/util.js',
         'src/node.cc',
         'src/node_buffer.cc',
         'src/node_constants.cc',
-        'src/node_extensions.cc',
+        'src/node_contextify.cc',
         'src/node_file.cc',
         'src/node_http_parser.cc',
         'src/node_javascript.cc',
         'src/node_main.cc',
         'src/node_os.cc',
-        'src/node_script.cc',
+        'src/node_v8.cc',
         'src/node_stat_watcher.cc',
-        'src/node_string.cc',
         'src/node_watchdog.cc',
         'src/node_zlib.cc',
         'src/pipe_wrap.cc',
         'src/signal_wrap.cc',
+        'src/smalloc.cc',
+        'src/spawn_sync.cc',
+        'src/string_bytes.cc',
         'src/stream_wrap.cc',
-        'src/slab_allocator.cc',
         'src/tcp_wrap.cc',
         'src/timer_wrap.cc',
         'src/tty_wrap.cc',
         'src/process_wrap.cc',
-        'src/v8_typed_array.cc',
         'src/udp_wrap.cc',
+        'src/uv.cc',
         # headers to make for a more pleasant IDE experience
+        'src/async-wrap.h',
+        'src/async-wrap-inl.h',
+        'src/base-object.h',
+        'src/base-object-inl.h',
+        'src/env.h',
+        'src/env-inl.h',
         'src/handle_wrap.h',
         'src/node.h',
         'src/node_buffer.h',
         'src/node_constants.h',
-        'src/node_crypto.h',
-        'src/node_crypto_bio.h',
-        'src/node_extensions.h',
+        'src/node_contextify.h',
         'src/node_file.h',
         'src/node_http_parser.h',
+        'src/node_internals.h',
         'src/node_javascript.h',
-        'src/node_os.h',
         'src/node_root_certs.h',
-        'src/node_script.h',
-        'src/node_string.h',
         'src/node_version.h',
         'src/node_watchdog.h',
-        'src/ngx-queue.h',
+        'src/node_wrap.h',
         'src/pipe_wrap.h',
+        'src/queue.h',
+        'src/smalloc.h',
         'src/tty_wrap.h',
         'src/tcp_wrap.h',
         'src/udp_wrap.h',
         'src/req_wrap.h',
-        'src/slab_allocator.h',
+        'src/string_bytes.h',
         'src/stream_wrap.h',
         'src/tree.h',
-        'src/v8_typed_array.h',
+        'src/util.h',
+        'src/util-inl.h',
         'deps/http_parser/http_parser.h',
         '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
         # javascript files to make for an even more pleasant IDE experience
         'ARCH="<(target_arch)"',
         'PLATFORM="<(OS)"',
         'NODE_TAG="<(node_tag)"',
+        'NODE_V8_OPTIONS="<(node_v8_options)"',
       ],
 
       'conditions': [
         [ 'node_use_openssl=="true"', {
           'defines': [ 'HAVE_OPENSSL=1' ],
-          'sources': [ 'src/node_crypto.cc', 'src/node_crypto_bio.cc' ],
+          'sources': [
+            'src/node_crypto.cc',
+            'src/node_crypto_bio.cc',
+            'src/node_crypto_clienthello.cc',
+            'src/node_crypto.h',
+            'src/node_crypto_bio.h',
+            'src/node_crypto_clienthello.h',
+            'src/tls_wrap.cc',
+            'src/tls_wrap.h'
+          ],
           'conditions': [
             [ 'node_shared_openssl=="false"', {
-              'dependencies': [ './deps/openssl/openssl.gyp:openssl' ],
+              'dependencies': [
+                './deps/openssl/openssl.gyp:openssl',
+
+                # For tests
+                './deps/openssl/openssl.gyp:openssl-cli'
+              ],
             }]]
         }, {
           'defines': [ 'HAVE_OPENSSL=0' ]
         }],
         [ 'node_use_dtrace=="true"', {
           'defines': [ 'HAVE_DTRACE=1' ],
-          'dependencies': [ 'node_dtrace_header' ],
+          'dependencies': [
+            'node_dtrace_header',
+            'specialize_node_d',
+          ],
           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
+
           #
-          # DTrace is supported on solaris, mac, and bsd.  There are three
-          # object files associated with DTrace support, but they're not all
-          # used all the time:
+          # DTrace is supported on linux, solaris, mac, and bsd.  There are
+          # three object files associated with DTrace support, but they're
+          # not all used all the time:
           #
           #   node_dtrace.o           all configurations
-          #   node_dtrace_ustack.o    not supported on OS X
+          #   node_dtrace_ustack.o    not supported on mac and linux
           #   node_dtrace_provider.o  All except OS X.  "dtrace -G" is not
           #                           used on OS X.
           #
           # below, and the GYP-generated Makefiles will properly build them when
           # needed.
           #
-          'sources': [
-            'src/node_dtrace.cc',
-          ],
-          'conditions': [ [
-            'OS!="mac"', {
+          'sources': [ 'src/node_dtrace.cc' ],
+          'conditions': [
+            [ 'OS=="linux"', {
+              'sources': [
+                '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o',
+                '<(SHARED_INTERMEDIATE_DIR)/libuv_dtrace_provider.o',
+              ],
+            }],
+            [ 'OS!="mac" and OS!="linux"', {
               'sources': [
                 'src/node_dtrace_ustack.cc',
                 'src/node_dtrace_provider.cc',
             }
           ] ]
         } ],
-        [ 'node_use_systemtap=="true"', {
-          'defines': [ 'HAVE_SYSTEMTAP=1', 'STAP_SDT_V1=1' ],
-          'dependencies': [ 'node_systemtap_header' ],
+        [ 'node_use_mdb=="true"', {
+          'dependencies': [ 'node_mdb' ],
           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
           'sources': [
-            'src/node_dtrace.cc',
-            '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h',
+            'src/node_mdb.cc',
           ],
         } ],
         [ 'node_use_etw=="true"', {
           'defines': [ '__POSIX__' ],
         }],
         [ 'OS=="mac"', {
-          'libraries': [ '-framework Carbon' ],
           'defines!': [
             'PLATFORM="mac"',
           ],
             'PLATFORM="sunos"',
           ],
         }],
+        [
+          'OS=="linux" and node_shared_v8=="false"', {
+            'ldflags': [
+              '-Wl,--whole-archive <(V8_BASE) -Wl,--no-whole-archive',
+            ],
+        }],
       ],
       'msvs_settings': {
         'VCLinkerTool': {
             '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
           ],
           'conditions': [
-            [ 'node_use_dtrace=="false"'
-              ' and node_use_etw=="false"'
-              ' and node_use_systemtap=="false"',
-            {
-                'inputs': ['src/macros.py']
-              }
-              ],
+            [ 'node_use_dtrace=="false" and node_use_etw=="false"', {
+              'inputs': [ 'src/notrace_macros.py' ]
+            }],
             [ 'node_use_perfctr=="false"', {
               'inputs': [ 'src/perfctr_macros.py' ]
             }]
           ],
-              'action': [
-                '<(python)',
-                'tools/js2c.py',
-                '<@(_outputs)',
-                '<@(_inputs)',
-              ],
+          'action': [
+            '<(python)',
+            'tools/js2c.py',
+            '<@(_outputs)',
+            '<@(_inputs)',
+          ],
         },
       ],
     }, # end node_js2c
       ]
     },
     {
-      'target_name': 'node_systemtap_header',
+      'target_name': 'node_mdb',
       'type': 'none',
       'conditions': [
-        [ 'node_use_systemtap=="true"', {
-          'actions': [
-            {
-              'action_name': 'node_systemtap_header',
-              'inputs': [ 'src/node_systemtap.d' ],
-              'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h' ],
-              'action': [ 'dtrace', '-h', '-C', '-s', '<@(_inputs)',
-                '-o', '<@(_outputs)' ]
-            }
-          ]
-        } ]
-      ]
+        [ 'node_use_mdb=="true"',
+          {
+            'dependencies': [ 'deps/mdb_v8/mdb_v8.gyp:mdb_v8' ],
+            'actions': [
+              {
+                'action_name': 'node_mdb',
+                'inputs': [ '<(PRODUCT_DIR)/obj.target/deps/mdb_v8/mdb_v8.so' ],
+                'outputs': [ '<(PRODUCT_DIR)/obj.target/node/src/node_mdb.o' ],
+                'conditions': [
+                  [ 'target_arch=="ia32"', {
+                    'action': [ 'elfwrap', '-o', '<@(_outputs)', '<@(_inputs)' ],
+                  } ],
+                  [ 'target_arch=="x64"', {
+                    'action': [ 'elfwrap', '-64', '-o', '<@(_outputs)', '<@(_inputs)' ],
+                  } ],
+                ],
+              },
+            ],
+          },
+        ],
+      ],
     },
     {
       'target_name': 'node_dtrace_provider',
       'type': 'none',
       'conditions': [
-        [ 'node_use_dtrace=="true" and OS!="mac"', {
+        [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
           'actions': [
             {
               'action_name': 'node_dtrace_provider_o',
               'inputs': [
-                '<(PRODUCT_DIR)/obj.target/libuv/deps/uv/src/unix/core.o',
-                '<(PRODUCT_DIR)/obj.target/node/src/node_dtrace.o',
+                '<(OBJ_DIR)/libuv/deps/uv/src/unix/core.o',
+                '<(OBJ_DIR)/node/src/node_dtrace.o',
               ],
               'outputs': [
-                '<(PRODUCT_DIR)/obj.target/node/src/node_dtrace_provider.o'
+                '<(OBJ_DIR)/node/src/node_dtrace_provider.o'
               ],
               'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
                 '-s', 'deps/uv/src/unix/uv-dtrace.d', '<@(_inputs)',
                 '-o', '<@(_outputs)' ]
             }
           ]
-        } ]
+        }],
+        [ 'node_use_dtrace=="true" and OS=="linux"', {
+          'actions': [
+            {
+              'action_name': 'node_dtrace_provider_o',
+              'inputs': [ 'src/node_provider.d' ],
+              'outputs': [
+                '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
+              ],
+              'action': [
+                'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
+              ],
+            },
+            {
+              'action_name': 'libuv_dtrace_provider_o',
+              'inputs': [ 'deps/uv/src/unix/uv-dtrace.d' ],
+              'outputs': [
+                '<(SHARED_INTERMEDIATE_DIR)/libuv_dtrace_provider.o'
+              ],
+              'action': [
+                'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
+              ],
+            },
+          ],
+        }],
       ]
     },
     {
       'target_name': 'node_dtrace_ustack',
       'type': 'none',
       'conditions': [
-        [ 'node_use_dtrace=="true" and OS!="mac"', {
+        [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
           'actions': [
             {
               'action_name': 'node_dtrace_ustack_constants',
               'inputs': [
-                '<(PRODUCT_DIR)/obj.target/deps/v8/tools/gyp/libv8_base.<(target_arch).a'
+                '<(V8_BASE)'
               ],
               'outputs': [
                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
               ],
               'outputs': [
-                '<(PRODUCT_DIR)/obj.target/node/src/node_dtrace_ustack.o'
+                '<(OBJ_DIR)/node/src/node_dtrace_ustack.o'
               ],
               'conditions': [
                 [ 'target_arch=="ia32"', {
                   ]
                 } ],
               ]
-            }
+            },
           ]
         } ],
       ]
+    },
+    {
+      'target_name': 'specialize_node_d',
+      'type': 'none',
+      'conditions': [
+        [ 'node_use_dtrace=="true"', {
+          'actions': [
+            {
+              'action_name': 'specialize_node_d',
+              'inputs': [
+                'src/node.d'
+              ],
+              'outputs': [
+                '<(PRODUCT_DIR)/node.d',
+              ],
+              'action': [
+                'tools/specialize_node_d.py',
+                '<@(_outputs)',
+                '<@(_inputs)',
+                '<@(OS)',
+                '<@(target_arch)',
+              ],
+            },
+          ],
+        } ],
+      ]
     }
   ] # end targets
 }