streams: refactor LazyTransform to internal/
[platform/upstream/nodejs.git] / node.gyp
index 8615bf7..e7153ba 100644 (file)
--- a/node.gyp
+++ b/node.gyp
@@ -1,18 +1,18 @@
 {
   'variables': {
-    'v8_use_snapshot%': 'true',
+    'v8_use_snapshot%': 'false',
     'node_use_dtrace%': 'false',
+    'node_use_lttng%': 'false',
     'node_use_etw%': 'false',
     'node_use_perfctr%': 'false',
     'node_has_winsdk%': 'false',
-    'node_shared_v8%': 'false',
     'node_shared_zlib%': 'false',
     'node_shared_http_parser%': 'false',
     'node_shared_libuv%': 'false',
     'node_use_openssl%': 'true',
     'node_shared_openssl%': 'false',
-    'node_use_mdb%': 'false',
     'node_v8_options%': '',
+    'node_target_type%': 'executable',
     'library_files': [
       'src/node.js',
       'lib/_debug_agent.js',
       'lib/net.js',
       'lib/os.js',
       'lib/path.js',
+      'lib/process.js',
       'lib/punycode.js',
       'lib/querystring.js',
       'lib/readline.js',
       'lib/repl.js',
-      'lib/smalloc.js',
       'lib/stream.js',
       'lib/_stream_readable.js',
       'lib/_stream_writable.js',
       'lib/_stream_duplex.js',
       'lib/_stream_transform.js',
       'lib/_stream_passthrough.js',
+      'lib/_stream_wrap.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/tty.js',
       'lib/url.js',
       'lib/util.js',
+      'lib/v8.js',
       'lib/vm.js',
       'lib/zlib.js',
+      'lib/internal/child_process.js',
+      'lib/internal/freelist.js',
+      'lib/internal/socket_list.js',
+      'lib/internal/repl.js',
+      'lib/internal/util.js',
+      'lib/internal/streams/lazy_transform.js',
     ],
   },
 
   'targets': [
     {
       'target_name': 'node',
-      'type': 'executable',
+      'type': '<(node_target_type)',
 
       'dependencies': [
         'node_js2c#host',
-        'deps/cares/cares.gyp:cares'
+        'deps/cares/cares.gyp:cares',
+        'deps/v8/tools/gyp/v8.gyp:v8',
+        'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
       ],
 
       'include_dirs': [
         'src',
         'tools/msvs/genfiles',
         'deps/uv/src/ares',
-        '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
+        '<(SHARED_INTERMEDIATE_DIR)', # for node_natives.h
+        'deps/v8' # include/v8_platform.h
       ],
 
       'sources': [
         'src/debug-agent.cc',
+        'src/async-wrap.cc',
+        'src/env.cc',
         'src/fs_event_wrap.cc',
         'src/cares_wrap.cc',
         'src/handle_wrap.cc',
+        'src/js_stream.cc',
         'src/node.cc',
         'src/node_buffer.cc',
         'src/node_constants.cc',
         'src/node_main.cc',
         'src/node_os.cc',
         'src/node_v8.cc',
-        'src/node_v8_platform.cc',
         'src/node_stat_watcher.cc',
         'src/node_watchdog.cc',
         'src/node_zlib.cc',
         'src/node_i18n.cc',
         'src/pipe_wrap.cc',
         'src/signal_wrap.cc',
-        'src/smalloc.cc',
         'src/spawn_sync.cc',
         'src/string_bytes.cc',
+        'src/stream_base.cc',
         'src/stream_wrap.cc',
         'src/tcp_wrap.cc',
         'src/timer_wrap.cc',
         'src/env.h',
         'src/env-inl.h',
         'src/handle_wrap.h',
+        'src/js_stream.h',
         'src/node.h',
         'src/node_buffer.h',
         'src/node_constants.h',
         'src/node_wrap.h',
         'src/node_i18n.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/req-wrap.h',
+        'src/req-wrap-inl.h',
         'src/string_bytes.h',
+        'src/stream_base.h',
+        'src/stream_base-inl.h',
         'src/stream_wrap.h',
         'src/tree.h',
         'src/util.h',
         'src/util-inl.h',
         'src/util.cc',
         'deps/http_parser/http_parser.h',
+        'deps/v8/include/v8.h',
+        'deps/v8/include/v8-debug.h',
         '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
         # javascript files to make for an even more pleasant IDE experience
         '<@(library_files)',
       ],
 
       'defines': [
+        'NODE_ARCH="<(target_arch)"',
+        'NODE_PLATFORM="<(OS)"',
         'NODE_WANT_INTERNALS=1',
-        'ARCH="<(target_arch)"',
-        'PLATFORM="<(OS)"',
-        'NODE_TAG="<(node_tag)"',
-        'NODE_V8_OPTIONS="<(node_v8_options)"',
+        # Warn when using deprecated V8 APIs.
+        'V8_DEPRECATION_WARNINGS=1',
       ],
 
+
       'conditions': [
+        [ 'node_tag!=""', {
+          'defines': [ 'NODE_TAG="<(node_tag)"' ],
+        }],
+        [ 'node_v8_options!=""', {
+          'defines': [ 'NODE_V8_OPTIONS="<(node_v8_options)"'],
+        }],
+        # No node_main.cc for anything except executable
+        [ 'node_target_type!="executable"', {
+          'sources!': [
+            'src/node_main.cc',
+          ],
+        }],
+        [ 'node_release_urlbase!=""', {
+          'defines': [
+            'NODE_RELEASE_URLBASE="<(node_release_urlbase)"',
+          ]
+        }],
         [ 'v8_enable_i18n_support==1', {
           'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
           'dependencies': [
                 './deps/openssl/openssl.gyp:openssl-cli',
               ],
               # Do not let unused OpenSSL symbols to slip away
-              'xcode_settings': {
-                'OTHER_LDFLAGS': [
-                  '-Wl,-force_load,<(PRODUCT_DIR)/libopenssl.a',
-                ],
-              },
               'conditions': [
-                ['OS in "linux freebsd"', {
-                  'ldflags': [
-                    '-Wl,--whole-archive <(PRODUCT_DIR)/libopenssl.a -Wl,--no-whole-archive',
+                # -force_load or --whole-archive are not applicable for
+                # the static library
+                [ 'node_target_type!="static_library"', {
+                  'xcode_settings': {
+                    'OTHER_LDFLAGS': [
+                      '-Wl,-force_load,<(PRODUCT_DIR)/<(OPENSSL_PRODUCT)',
+                    ],
+                  },
+                  'conditions': [
+                    ['OS in "linux freebsd"', {
+                      'ldflags': [
+                        '-Wl,--whole-archive <(PRODUCT_DIR)/<(OPENSSL_PRODUCT)',
+                        '-Wl,--no-whole-archive',
+                      ],
+                    }],
                   ],
                 }],
               ],
           'conditions': [
             [ 'OS=="linux"', {
               'sources': [
-                '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o',
-                '<(SHARED_INTERMEDIATE_DIR)/libuv_dtrace_provider.o',
+                '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
               ],
             }],
             [ 'OS!="mac" and OS!="linux"', {
             }
           ] ]
         } ],
-        [ 'node_use_mdb=="true"', {
-          'dependencies': [ 'node_mdb' ],
+        [ 'node_use_lttng=="true"', {
+          'defines': [ 'HAVE_LTTNG=1' ],
           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
+          'libraries': [ '-llttng-ust' ],
           'sources': [
-            'src/node_mdb.cc',
+            'src/node_lttng.cc'
           ],
         } ],
         [ 'node_use_etw=="true"', {
         } ],
         [ 'v8_postmortem_support=="true"', {
           'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:postmortem-metadata' ],
-          'xcode_settings': {
-            'OTHER_LDFLAGS': [
-              '-Wl,-force_load,<(V8_BASE)',
-            ],
-          },
-        }],
-        [ 'node_shared_v8=="false"', {
-          'sources': [
-            'deps/v8/include/v8.h',
-            'deps/v8/include/v8-debug.h',
+          'conditions': [
+            # -force_load is not applicable for the static library
+            [ 'node_target_type!="static_library"', {
+              'xcode_settings': {
+                'OTHER_LDFLAGS': [
+                  '-Wl,-force_load,<(V8_BASE)',
+                ],
+              },
+            }],
           ],
-          'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:v8' ],
         }],
-
         [ 'node_shared_zlib=="false"', {
           'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
         }],
           'sources': [
             'src/res/node.rc',
           ],
+          'defines!': [
+            'NODE_PLATFORM="win"',
+          ],
           'defines': [
             'FD_SETSIZE=1024',
             # we need to use node's preferred "win32" rather than gyp's preferred "win"
-            'PLATFORM="win32"',
+            'NODE_PLATFORM="win32"',
             '_UNICODE=1',
           ],
           'libraries': [ '-lpsapi.lib' ]
           # like Instruments require it for some features
           'libraries': [ '-framework CoreFoundation' ],
           'defines!': [
-            'PLATFORM="mac"',
+            'NODE_PLATFORM="mac"',
           ],
           'defines': [
             # we need to use node's preferred "darwin" rather than gyp's preferred "mac"
-            'PLATFORM="darwin"',
+            'NODE_PLATFORM="darwin"',
           ],
         }],
         [ 'OS=="freebsd"', {
             '-lumem',
           ],
           'defines!': [
-            'PLATFORM="solaris"',
+            'NODE_PLATFORM="solaris"',
           ],
           'defines': [
             # we need to use node's preferred "sunos"
             # rather than gyp's preferred "solaris"
-            'PLATFORM="sunos"',
+            'NODE_PLATFORM="sunos"',
           ],
         }],
         [ 'OS=="freebsd" or OS=="linux"', {
-          'ldflags': [ '-Wl,-z,noexecstack' ],
+          'ldflags': [ '-Wl,-z,noexecstack',
+                       '-Wl,--whole-archive <(V8_BASE)',
+                       '-Wl,--no-whole-archive' ]
         }],
         [ 'OS=="sunos"', {
           'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
         }],
-        [
-          'OS in "linux freebsd" and node_shared_v8=="false"', {
-            'ldflags': [
-              '-Wl,--whole-archive <(V8_BASE) -Wl,--no-whole-archive',
-            ],
-        }],
       ],
       'msvs_settings': {
-        'VCLinkerTool': {
-          'SubSystem': 1, # /subsystem:console
-        },
         'VCManifestTool': {
           'EmbedManifest': 'true',
           'AdditionalManifestFiles': 'src/res/node.exe.extra.manifest'
             [ 'node_use_dtrace=="false" and node_use_etw=="false"', {
               'inputs': [ 'src/notrace_macros.py' ]
             }],
+            ['node_use_lttng=="false"', {
+              'inputs': [ 'src/nolttng_macros.py' ]
+            }],
             [ 'node_use_perfctr=="false"', {
               'inputs': [ 'src/perfctr_macros.py' ]
             }]
       'target_name': 'node_dtrace_header',
       'type': 'none',
       'conditions': [
-        [ 'node_use_dtrace=="true"', {
+        [ 'node_use_dtrace=="true" and OS!="linux"', {
           'actions': [
             {
               'action_name': 'node_dtrace_header',
                 '-o', '<@(_outputs)' ]
             }
           ]
-        } ]
+        } ],
+        [ 'node_use_dtrace=="true" and OS=="linux"', {
+          'actions': [
+            {
+              'action_name': 'node_dtrace_header',
+              'inputs': [ 'src/node_provider.d' ],
+              'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
+              'action': [ 'dtrace', '-h', '-s', '<@(_inputs)',
+                '-o', '<@(_outputs)' ]
+            }
+          ]
+        } ],
       ]
     },
     {
-      'target_name': 'node_mdb',
-      'type': 'none',
-      'conditions': [
-        [ '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': [
             {
               'action_name': 'node_dtrace_provider_o',
               'inputs': [
-                '<(OBJ_DIR)/libuv/deps/uv/src/unix/core.o',
                 '<(OBJ_DIR)/node/src/node_dtrace.o',
               ],
               'outputs': [
                 '<(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)' ]
+                '<@(_inputs)', '-o', '<@(_outputs)' ]
             }
           ]
         }],
               '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': 'cctest',
+      'type': 'executable',
+      'dependencies': [
+        'deps/gtest/gtest.gyp:gtest',
+        'deps/v8/tools/gyp/v8.gyp:v8',
+        'deps/v8/tools/gyp/v8.gyp:v8_libplatform'
+      ],
+      'include_dirs': [
+        'src',
+        'deps/v8/include'
+      ],
+      'defines': [
+        # gtest's ASSERT macros conflict with our own.
+        'GTEST_DONT_DEFINE_ASSERT_EQ=1',
+        'GTEST_DONT_DEFINE_ASSERT_GE=1',
+        'GTEST_DONT_DEFINE_ASSERT_GT=1',
+        'GTEST_DONT_DEFINE_ASSERT_LE=1',
+        'GTEST_DONT_DEFINE_ASSERT_LT=1',
+        'GTEST_DONT_DEFINE_ASSERT_NE=1',
+      ],
+      'sources': [
+        'test/cctest/util.cc',
+      ],
     }
   ] # end targets
 }