Skip to content

Commit bfbed0a

Browse files
legendecasRafaelGSS
authored andcommitted
build: fix conflict gyp configs
Gyp generated build files can be built in either Release/Debug mode. - make: single directory, two configurations by cli: `make -C out BUILDTYPE=Release` and `make -C out BUILDTYPE=Debug`. - msbuild: single directory, two configurations by cli: `msbuild node.sln /p:Configuration=Release` and `msbuild node.sln /p:Configuration=Debug`. - ninja: two directories in `out/`, build with `ninja -C out/Release` or `ninja -C out/Debug`. Variables that changes with either Release or Debug configuration should be defined in a configuration level, instead of the root level. This fixes generating invalid build files. Additionally, `v8_gypfiles/toolchain.gypi` duplicates defines in `v8_gypfiles/features.gypi`. Remove the duplications in `toolchains.gypi` PR-URL: #53605Fixes: #53446 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c4848c5 commit bfbed0a

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

‎configure.py‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,9 @@ def host_arch_win():
13061306

13071307
returnmatchup.get(arch, 'ia32')
13081308

1309+
defset_configuration_variable(configs, name, release=None, debug=None):
1310+
configs['Release'][name] =release
1311+
configs['Debug'][name] =debug
13091312

13101313
defconfigure_arm(o):
13111314
ifoptions.arm_float_abi:
@@ -1620,7 +1623,9 @@ def configure_library(lib, output, pkgname=None):
16201623
output['libraries'] +=pkg_libs.split()
16211624

16221625

1623-
defconfigure_v8(o):
1626+
defconfigure_v8(o, configs):
1627+
set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0)
1628+
16241629
o['variables']['v8_enable_webassembly'] =0ifoptions.v8_lite_modeelse1
16251630
o['variables']['v8_enable_javascript_promise_hooks'] =1
16261631
o['variables']['v8_enable_lite_mode'] =1ifoptions.v8_lite_modeelse0
@@ -1638,7 +1643,6 @@ def configure_v8(o):
16381643
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] =1ifoptions.enable_pointer_compressionelse0
16391644
o['variables']['v8_enable_shared_ro_heap'] =0ifoptions.enable_pointer_compressionoroptions.disable_shared_ro_heapelse1
16401645
o['variables']['v8_enable_extensible_ro_snapshot'] =0
1641-
o['variables']['v8_enable_v8_checks'] =1ifoptions.debugelse0
16421646
o['variables']['v8_trace_maps'] =1ifoptions.trace_mapselse0
16431647
o['variables']['node_use_v8_platform'] =b(notoptions.without_v8_platform)
16441648
o['variables']['node_use_bundled_v8'] =b(notoptions.without_bundled_v8)
@@ -2154,6 +2158,10 @@ def make_bin_override():
21542158
'defines': [],
21552159
'cflags': [],
21562160
}
2161+
configurations={
2162+
'Release':{'variables':{} },
2163+
'Debug':{'variables':{} },
2164+
}
21572165

21582166
# Print a warning when the compiler is too old.
21592167
check_compiler(output)
@@ -2181,7 +2189,7 @@ def make_bin_override():
21812189
configure_library('ngtcp2', output, pkgname='libngtcp2')
21822190
configure_library('sqlite', output, pkgname='sqlite3')
21832191
configure_library('uvwasi', output, pkgname='libuvwasi')
2184-
configure_v8(output)
2192+
configure_v8(output, configurations)
21852193
configure_openssl(output)
21862194
configure_intl(output)
21872195
configure_static(output)
@@ -2204,7 +2212,6 @@ def make_bin_override():
22042212
# move everything else to target_defaults
22052213
variables=output['variables']
22062214
deloutput['variables']
2207-
variables['is_debug'] =B(options.debug)
22082215

22092216
# make_global_settings should be a root level element too
22102217
if'make_global_settings'inoutput:
@@ -2213,6 +2220,9 @@ def make_bin_override():
22132220
else:
22142221
make_global_settings=False
22152222

2223+
# Add configurations to target defaults
2224+
output['configurations'] =configurations
2225+
22162226
output={
22172227
'variables': variables,
22182228
'target_defaults': output,
@@ -2223,7 +2233,7 @@ def make_bin_override():
22232233
print_verbose(output)
22242234

22252235
write('config.gypi', do_not_edit+
2226-
pprint.pformat(output, indent=2, width=1024) +'\n')
2236+
pprint.pformat(output, indent=2, width=128) +'\n')
22272237

22282238
write('config.status', '#!/bin/sh\nset -x\nexec ./configure '+
22292239
' '.join([shlex.quote(arg) forarginoriginal_argv]) +'\n')

‎tools/v8_gypfiles/features.gypi‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
'v8_enable_private_mapping_fork_optimization': 0,
8989
}],
9090
],
91-
'is_debug%': 0,
9291

9392
# Variables from BUILD.gn
9493

‎tools/v8_gypfiles/toolchain.gypi‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -711,13 +711,7 @@
711711
'configurations':{
712712
'Debug':{
713713
'defines': [
714-
'ENABLE_DISASSEMBLER',
715-
'V8_ENABLE_CHECKS',
716-
'OBJECT_PRINT',
717714
'DEBUG',
718-
'V8_TRACE_MAPS',
719-
'V8_ENABLE_ALLOCATION_TIMEOUT',
720-
'V8_ENABLE_FORCE_SLOW_PATH',
721715
],
722716
'conditions': [
723717
['OS=="linux" and v8_enable_backtrace==1',{

0 commit comments

Comments
(0)