Skip to content

Commit

Permalink
build: add configure option to debug only Node.js part of the binary
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
addaleax authored and codebytere committed Feb 17, 2020
1 parent 1e2327d commit 60a6977
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
dest='debug',
help='also build debug build')

parser.add_option('--debug-node',
action='store_true',
dest='debug_node',
help='build the Node.js part of the binary with debugging symbols')

parser.add_option('--dest-cpu',
action='store',
dest='dest_cpu',
Expand Down Expand Up @@ -975,6 +980,7 @@ def configure_node(o):
o['variables']['node_prefix'] = options.prefix
o['variables']['node_install_npm'] = b(not options.without_npm)
o['variables']['node_report'] = b(not options.without_report)
o['variables']['debug_node'] = b(options.debug_node)
o['default_configuration'] = 'Debug' if options.debug else 'Release'

host_arch = host_arch_win() if os.name == 'nt' else host_arch_cc()
Expand Down
10 changes: 10 additions & 0 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,16 @@
],
},
}],
[ 'debug_node=="true"', {
'cflags!': [ '-O3' ],
'cflags': [ '-g', '-O0' ],
'defines': [ 'DEBUG' ],
'xcode_settings': {
'OTHER_CFLAGS': [
'-g', '-O0'
],
},
}],
[ 'coverage=="true" and node_shared=="false" and OS in "mac freebsd linux"', {
'cflags!': [ '-O3' ],
'ldflags': [ '--coverage',
Expand Down

0 comments on commit 60a6977

Please sign in to comment.