Skip to content

Commit b22cc31

Browse files
committed
build: refacor dtrace & etw build
1 parent 5dbf8d8 commit b22cc31

File tree

4 files changed

+247
-307
lines changed

4 files changed

+247
-307
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
}, {
243243
'msvs_settings': {
244244
'VCCLCompilerTool': {
245-
'WholeProgramOptimization': 'false'
245+
'WholeProgramOptimization': 'false' # /GL-
246246
},
247247
'VCLinkerTool': {
248248
'LinkIncremental': 2 # enable incremental linking

dtrace.gypi

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
{
2+
'conditions': [
3+
[ 'node_use_dtrace=="true"', {
4+
'defines': [ 'HAVE_DTRACE=1' ],
5+
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
6+
#
7+
# DTrace is supported on linux, solaris, mac, and bsd. There are
8+
# three object files associated with DTrace support, but they're
9+
# not all used all the time:
10+
#
11+
# node_dtrace.o all configurations
12+
# node_dtrace_ustack.o not supported on mac and linux
13+
# node_dtrace_provider.o All except OS X. "dtrace -G" is not
14+
# used on OS X.
15+
#
16+
# Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
17+
# actually exist. They're listed here to trick GYP into linking the
18+
# corresponding object files into the final "node" executable. These
19+
# object files are generated by "dtrace -G" using custom actions
20+
# below, and the GYP-generated Makefiles will properly build them when
21+
# needed.
22+
#
23+
'sources': [ 'src/node_dtrace.cc' ],
24+
'conditions': [
25+
[ 'OS=="linux"', {
26+
'sources': [
27+
'<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/node_dtrace_provider.o'
28+
],
29+
}],
30+
[ 'OS!="mac" and OS!="linux"', {
31+
'sources': [
32+
'src/node_dtrace_ustack.cc',
33+
'src/node_dtrace_provider.cc',
34+
],
35+
}],
36+
],
37+
}],
38+
[ 'node_use_dtrace=="true" and OS!="linux"', {
39+
'actions': [
40+
{
41+
'action_name': 'node_dtrace_header',
42+
'inputs': [ 'src/node_provider.d' ],
43+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/node_provider.h' ],
44+
'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
45+
'-o', '<@(_outputs)' ]
46+
}
47+
]
48+
} ],
49+
[ 'node_use_dtrace=="true" and OS=="linux"', {
50+
'actions': [
51+
{
52+
'action_name': 'node_dtrace_header',
53+
'inputs': [ 'src/node_provider.d' ],
54+
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/node_provider.h' ],
55+
'action': [ 'dtrace', '-h', '-s', '<@(_inputs)', '-o', '<@(_outputs)' ]
56+
},
57+
],
58+
}],
59+
[ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
60+
'actions': [
61+
{
62+
'action_name': 'node_dtrace_provider_o',
63+
'inputs': [
64+
'<(obj_dir)/node_base/src/node_dtrace.o',
65+
],
66+
'outputs': [
67+
'<(obj_dir)/node_base/src/node_dtrace_provider.o'
68+
],
69+
'action': [
70+
'dtrace',
71+
'-G', '-xnolibs',
72+
'-s', 'src/node_provider.d',
73+
'<@(_inputs)',
74+
'-o', '<@(_outputs)',
75+
]
76+
}
77+
]
78+
}],
79+
[ 'node_use_dtrace=="true" and OS=="linux"', {
80+
'actions': [
81+
{
82+
'action_name': 'node_dtrace_provider_o',
83+
'inputs': [ 'src/node_provider.d' ],
84+
'outputs': [
85+
'<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/node_dtrace_provider.o'
86+
],
87+
'action': [
88+
'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
89+
],
90+
},
91+
],
92+
}],
93+
[ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
94+
'actions': [
95+
{
96+
'action_name': 'node_dtrace_ustack_constants',
97+
'inputs': [
98+
'<(v8_base)'
99+
],
100+
'outputs': [
101+
'<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/v8constants.h'
102+
],
103+
'action': [
104+
'tools/genv8constants.py',
105+
'<@(_outputs)',
106+
'<@(_inputs)'
107+
]
108+
},
109+
{
110+
'action_name': 'node_dtrace_ustack',
111+
'inputs': [
112+
'src/v8ustack.d',
113+
'<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/v8constants.h'
114+
],
115+
'outputs': [
116+
'<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_ustack.o'
117+
],
118+
'conditions': [
119+
[ 'target_arch=="ia32" or target_arch=="arm"', {
120+
'action': [
121+
'dtrace',
122+
'-32',
123+
'-I<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header',
124+
'-Isrc',
125+
'-C', '-G',
126+
'-s', 'src/v8ustack.d',
127+
'-o', '<@(_outputs)',
128+
],
129+
}],
130+
[ 'target_arch=="x64"', {
131+
'action': [
132+
'dtrace',
133+
'-64',
134+
'-I<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header',
135+
'-Isrc',
136+
'-C', '-G',
137+
'-s', 'src/v8ustack.d',
138+
'-o', '<@(_outputs)',
139+
],
140+
}],
141+
],
142+
},
143+
],
144+
}],
145+
[ 'node_use_dtrace=="true"', {
146+
'actions': [
147+
{
148+
'action_name': 'specialize_node_d',
149+
'inputs': [
150+
'src/node.d'
151+
],
152+
'outputs': [
153+
'<(PRODUCT_DIR)/node.d',
154+
],
155+
'action': [
156+
'tools/specialize_node_d.py',
157+
'<@(_outputs)',
158+
'<@(_inputs)',
159+
'<@(OS)',
160+
'<@(target_arch)',
161+
],
162+
},
163+
],
164+
}],
165+
]
166+
}

0 commit comments

Comments
 (0)