547
547
default = False ,
548
548
help = 'build V8 using GN instead of gyp' )
549
549
550
+ parser .add_option ('--verbose' ,
551
+ action = 'store_true' ,
552
+ dest = 'verbose' ,
553
+ default = False ,
554
+ help = 'get more output from this script' )
555
+
550
556
# Create compile_commands.json in out/Debug and out/Release.
551
557
parser .add_option ('-C' ,
552
558
action = 'store_true' ,
@@ -575,6 +581,14 @@ def warn(msg):
575
581
# track if warnings occurred
576
582
warn .warned = False
577
583
584
+ def print_verbose (x ):
585
+ if not options .verbose :
586
+ return
587
+ if type (x ) is str :
588
+ print x
589
+ else :
590
+ pprint .pprint (x , indent = 2 )
591
+
578
592
def b (value ):
579
593
"""Returns the string 'true' if value is truthy, 'false' otherwise."""
580
594
if value :
@@ -1158,7 +1172,7 @@ def without_ssl_error(option):
1158
1172
def configure_static (o ):
1159
1173
if options .fully_static or options .partly_static :
1160
1174
if flavor == 'mac' :
1161
- print ("Generation of static executable will not work on OSX "
1175
+ warn ("Generation of static executable will not work on OSX "
1162
1176
"when using the default compilation environment" )
1163
1177
return
1164
1178
@@ -1172,9 +1186,9 @@ def configure_static(o):
1172
1186
1173
1187
def write (filename , data ):
1174
1188
filename = filename
1175
- print ('creating %s' % filename )
1176
- f = open (filename , 'w+' )
1177
- f .write (data )
1189
+ print_verbose ('creating %s' % filename )
1190
+ with open (filename , 'w+' ) as f :
1191
+ f .write (data )
1178
1192
1179
1193
do_not_edit = '# Do not edit. Generated by the configure script.\n '
1180
1194
@@ -1192,7 +1206,7 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
1192
1206
patchfile = '%s/%s/%s' % (dir_base , patch_dir , file )
1193
1207
if os .path .isfile (patchfile ):
1194
1208
srcfile = '%s/%s' % (patch_dir , file )
1195
- print ('Using version-specific floating patch %s ' % patchfile )
1209
+ warn ('Using floating patch "%s" from "%s" ' % ( patchfile , dir_base ) )
1196
1210
list .append (srcfile )
1197
1211
break
1198
1212
return list
@@ -1226,8 +1240,8 @@ def icu_download(path):
1226
1240
if (md5 == gotmd5 ):
1227
1241
return targetfile
1228
1242
else :
1229
- print ('Expected: %s *MISMATCH*' % md5 )
1230
- print ('\n ** Corrupted ZIP? Delete %s to retry download.\n ' % targetfile )
1243
+ error ('Expected: %s *MISMATCH*' % md5 )
1244
+ error ('\n ** Corrupted ZIP? Delete %s to retry download.\n ' % targetfile )
1231
1245
return None
1232
1246
icu_config = {
1233
1247
'variables' : {}
@@ -1328,7 +1342,7 @@ def write_config(data, name):
1328
1342
# --with-icu-source processing
1329
1343
# now, check that they didn't pass --with-icu-source=deps/icu
1330
1344
elif with_icu_source and os .path .abspath (icu_full_path ) == os .path .abspath (with_icu_source ):
1331
- print ('Ignoring redundant --with-icu-source=%s' % with_icu_source )
1345
+ warn ('Ignoring redundant --with-icu-source=%s' % with_icu_source )
1332
1346
with_icu_source = None
1333
1347
# if with_icu_source is still set, try to use it.
1334
1348
if with_icu_source :
@@ -1371,7 +1385,7 @@ def write_config(data, name):
1371
1385
# ICU source dir relative to tools/icu (for .gyp file)
1372
1386
o ['variables' ]['icu_path' ] = icu_full_path
1373
1387
if not os .path .isdir (icu_full_path ):
1374
- print ('* ECMA-402 (Intl) support didn\' t find ICU in %s..' % icu_full_path )
1388
+ warn ('* ECMA-402 (Intl) support didn\' t find ICU in %s..' % icu_full_path )
1375
1389
# can we download (or find) a zipfile?
1376
1390
localzip = icu_download (icu_full_path )
1377
1391
if localzip :
@@ -1380,7 +1394,7 @@ def write_config(data, name):
1380
1394
error ('''Cannot build Intl without ICU in %s.
1381
1395
Fix, or disable with "--with-intl=none"''' % icu_full_path )
1382
1396
else :
1383
- print ('* Using ICU in %s' % icu_full_path )
1397
+ print_verbose ('* Using ICU in %s' % icu_full_path )
1384
1398
# Now, what version of ICU is it? We just need the "major", such as 54.
1385
1399
# uvernum.h contains it as a #define.
1386
1400
uvernum_h = os .path .join (icu_full_path , 'source/common/unicode/uvernum.h' )
@@ -1543,7 +1557,7 @@ def make_bin_override():
1543
1557
if make_global_settings :
1544
1558
output ['make_global_settings' ] = make_global_settings
1545
1559
1546
- pprint . pprint (output , indent = 2 )
1560
+ print_verbose (output )
1547
1561
1548
1562
write ('config.gypi' , do_not_edit +
1549
1563
pprint .pformat (output , indent = 2 ) + '\n ' )
@@ -1582,9 +1596,11 @@ def make_bin_override():
1582
1596
if options .compile_commands_json :
1583
1597
gyp_args += ['-f' , 'compile_commands_json' ]
1584
1598
1599
+ # pass the leftover positional arguments to GYP
1585
1600
gyp_args += args
1586
1601
1587
- if warn .warned :
1602
+ if warn .warned and not options . verbose :
1588
1603
warn ('warnings were emitted in the configure phase' )
1589
1604
1605
+ print_verbose ("running: \n " + " " .join (['python' , 'tools/gyp_node.py' ] + gyp_args ))
1590
1606
run_gyp (gyp_args )
0 commit comments