Skip to content

Commit 60a6977

Browse files
addaleaxcodebytere
authored andcommitted
build: add configure option to debug only Node.js part of the binary
Building Node.js with `--debug` takes a long time and generates binaries that can be hard to work with due to their size, in particular because debug builds of V8 are large. Sometimes, it’s sufficient to build the Node.js parts with native debugging options enabled. Add an option for that. PR-URL: #31644 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 1e2327d commit 60a6977

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

configure.py

+6
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@
8989
dest='debug',
9090
help='also build debug build')
9191

92+
parser.add_option('--debug-node',
93+
action='store_true',
94+
dest='debug_node',
95+
help='build the Node.js part of the binary with debugging symbols')
96+
9297
parser.add_option('--dest-cpu',
9398
action='store',
9499
dest='dest_cpu',
@@ -975,6 +980,7 @@ def configure_node(o):
975980
o['variables']['node_prefix'] = options.prefix
976981
o['variables']['node_install_npm'] = b(not options.without_npm)
977982
o['variables']['node_report'] = b(not options.without_report)
983+
o['variables']['debug_node'] = b(options.debug_node)
978984
o['default_configuration'] = 'Debug' if options.debug else 'Release'
979985

980986
host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()

node.gypi

+10
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,16 @@
271271
],
272272
},
273273
}],
274+
[ 'debug_node=="true"', {
275+
'cflags!': [ '-O3' ],
276+
'cflags': [ '-g', '-O0' ],
277+
'defines': [ 'DEBUG' ],
278+
'xcode_settings': {
279+
'OTHER_CFLAGS': [
280+
'-g', '-O0'
281+
],
282+
},
283+
}],
274284
[ 'coverage=="true" and node_shared=="false" and OS in "mac freebsd linux"', {
275285
'cflags!': [ '-O3' ],
276286
'ldflags': [ '--coverage',

0 commit comments

Comments
 (0)