summaryrefslogtreecommitdiff
path: root/node.gyp
diff options
context:
space:
mode:
authorDave Pacheco <dap@joyent.com>2012-03-28 10:26:10 -0700
committerBen Noordhuis <info@bnoordhuis.nl>2012-04-01 00:14:36 +0000
commitcc15299c32b4fc39c2eb2c08b0265e462f875544 (patch)
tree2e3c9b283e29e925b8ac4072d67671d164c218de /node.gyp
parent7bdeed203991d35a56e7448540e3b74387c65d0d (diff)
downloadnode-cc15299c32b4fc39c2eb2c08b0265e462f875544.tar.gz
build: add support for DTrace and postmortem
* fixes #2110 * includes V8 postmortem metadata in Solaris builds * adds GYP support for DTrace probes and ustack helper * ustack helper derives constants dynamically from libv8_base.a * build with DTrace support by default on SunOS
Diffstat (limited to 'node.gyp')
-rw-r--r--node.gyp101
1 files changed, 95 insertions, 6 deletions
diff --git a/node.gyp b/node.gyp
index db40b6a78..7fbf17532 100644
--- a/node.gyp
+++ b/node.gyp
@@ -4,7 +4,7 @@
# Turn off -Werror in V8
# See http://codereview.chromium.org/8159015
'werror': '',
- 'node_use_dtrace': 'false',
+ 'node_use_dtrace%': 'false',
'node_shared_v8%': 'false',
'node_shared_zlib%': 'false',
'node_use_openssl%': 'true',
@@ -138,14 +138,26 @@
}],
[ 'node_use_dtrace=="true"', {
+ 'defines': [ 'HAVE_DTRACE=1' ],
+ 'dependencies': [ 'node_dtrace_header' ],
+ 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
+ #
+ # node_dtrace_provider.cc and node_dtrace_ustack.cc do not actually
+ # exist. They're here to trick GYP into linking the corresponding
+ # object files into the final "node" executable. These files are
+ # generated by "dtrace -G" using custom actions below, and the
+ # GYP-generated Makefiles will properly build them when needed.
+ #
'sources': [
'src/node_dtrace.cc',
- 'src/node_dtrace.h',
- # why does node_provider.h get generated into src and not
- # SHARED_INTERMEDIATE_DIR?
- 'src/node_provider.h',
+ 'src/node_dtrace_provider.cc'
],
- }],
+ 'conditions': [ [
+ 'target_arch=="ia32"', {
+ 'sources': [ 'src/node_dtrace_ustack.cc' ]
+ }
+ ] ],
+ } ],
[ 'node_shared_v8=="true"', {
'sources': [
@@ -254,6 +266,83 @@
},
],
}, # end node_js2c
+ {
+ 'target_name': 'node_dtrace_header',
+ 'type': 'none',
+ 'conditions': [
+ [ 'node_use_dtrace=="true"', {
+ 'actions': [
+ {
+ 'action_name': 'node_dtrace_header',
+ 'inputs': [ 'src/node_provider.d' ],
+ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
+ 'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
+ '-o', '<@(_outputs)' ]
+ }
+ ]
+ } ]
+ ]
+ },
+ {
+ 'target_name': 'node_dtrace_provider',
+ 'type': 'none',
+ 'conditions': [
+ [ 'node_use_dtrace=="true"', {
+ 'actions': [
+ {
+ 'action_name': 'node_dtrace_provider_o',
+ 'inputs': [
+ 'src/node_provider.d',
+ '<(PRODUCT_DIR)/obj.target/node/src/node_dtrace.o'
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/obj.target/node/src/node_dtrace_provider.o'
+ ],
+ 'action': [ 'dtrace', '-G', '-xnolibs', '-s', '<@(_inputs)',
+ '-o', '<@(_outputs)' ]
+ }
+ ]
+ } ]
+ ]
+ },
+ {
+ 'target_name': 'node_dtrace_ustack',
+ 'type': 'none',
+ 'conditions': [
+ [ 'node_use_dtrace=="true"', {
+ 'actions': [
+ {
+ 'action_name': 'node_dtrace_ustack_constants',
+ 'inputs': [
+ '<(PRODUCT_DIR)/obj.target/deps/v8/tools/gyp/libv8_base.a'
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
+ ],
+ 'action': [
+ 'tools/genv8constants.py',
+ '<@(_outputs)',
+ '<@(_inputs)'
+ ]
+ },
+ {
+ 'action_name': 'node_dtrace_ustack',
+ 'inputs': [
+ 'src/v8ustack.d',
+ '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
+ ],
+ 'outputs': [
+ '<(PRODUCT_DIR)/obj.target/node/src/node_dtrace_ustack.o'
+ ],
+ 'action': [
+ 'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
+ '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
+ ]
+ }
+ ]
+ } ],
+ ]
+ }
] # end targets
}