Skip to content

Commit

Permalink
build: add --verbose to ./configure
Browse files Browse the repository at this point in the history
PR-URL: #22450
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
refack authored and targos committed Sep 7, 2018
1 parent db10db9 commit 5bae8b9
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,12 @@
default=False,
help='build V8 using GN instead of gyp')

parser.add_option('--verbose',
action='store_true',
dest='verbose',
default=False,
help='get more output from this script')

# Create compile_commands.json in out/Debug and out/Release.
parser.add_option('-C',
action='store_true',
Expand Down Expand Up @@ -575,6 +581,14 @@ def warn(msg):
# track if warnings occurred
warn.warned = False

def print_verbose(x):
if not options.verbose:
return
if type(x) is str:
print x
else:
pprint.pprint(x, indent=2)

def b(value):
"""Returns the string 'true' if value is truthy, 'false' otherwise."""
if value:
Expand Down Expand Up @@ -1158,7 +1172,7 @@ def without_ssl_error(option):
def configure_static(o):
if options.fully_static or options.partly_static:
if flavor == 'mac':
print("Generation of static executable will not work on OSX "
warn("Generation of static executable will not work on OSX "
"when using the default compilation environment")
return

Expand All @@ -1172,9 +1186,9 @@ def configure_static(o):

def write(filename, data):
filename = filename
print('creating %s' % filename)
f = open(filename, 'w+')
f.write(data)
print_verbose('creating %s' % filename)
with open(filename, 'w+') as f:
f.write(data)

do_not_edit = '# Do not edit. Generated by the configure script.\n'

Expand All @@ -1192,7 +1206,7 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
patchfile = '%s/%s/%s' % (dir_base, patch_dir, file)
if os.path.isfile(patchfile):
srcfile = '%s/%s' % (patch_dir, file)
print('Using version-specific floating patch %s' % patchfile)
warn('Using floating patch "%s" from "%s"' % (patchfile, dir_base))
list.append(srcfile)
break
return list
Expand Down Expand Up @@ -1226,8 +1240,8 @@ def icu_download(path):
if (md5 == gotmd5):
return targetfile
else:
print('Expected: %s *MISMATCH*' % md5)
print('\n ** Corrupted ZIP? Delete %s to retry download.\n' % targetfile)
error('Expected: %s *MISMATCH*' % md5)
error('\n ** Corrupted ZIP? Delete %s to retry download.\n' % targetfile)
return None
icu_config = {
'variables': {}
Expand Down Expand Up @@ -1328,7 +1342,7 @@ def write_config(data, name):
# --with-icu-source processing
# now, check that they didn't pass --with-icu-source=deps/icu
elif with_icu_source and os.path.abspath(icu_full_path) == os.path.abspath(with_icu_source):
print('Ignoring redundant --with-icu-source=%s' % with_icu_source)
warn('Ignoring redundant --with-icu-source=%s' % with_icu_source)
with_icu_source = None
# if with_icu_source is still set, try to use it.
if with_icu_source:
Expand Down Expand Up @@ -1371,7 +1385,7 @@ def write_config(data, name):
# ICU source dir relative to tools/icu (for .gyp file)
o['variables']['icu_path'] = icu_full_path
if not os.path.isdir(icu_full_path):
print('* ECMA-402 (Intl) support didn\'t find ICU in %s..' % icu_full_path)
warn('* ECMA-402 (Intl) support didn\'t find ICU in %s..' % icu_full_path)
# can we download (or find) a zipfile?
localzip = icu_download(icu_full_path)
if localzip:
Expand All @@ -1380,7 +1394,7 @@ def write_config(data, name):
error('''Cannot build Intl without ICU in %s.
Fix, or disable with "--with-intl=none"''' % icu_full_path)
else:
print('* Using ICU in %s' % icu_full_path)
print_verbose('* Using ICU in %s' % icu_full_path)
# Now, what version of ICU is it? We just need the "major", such as 54.
# uvernum.h contains it as a #define.
uvernum_h = os.path.join(icu_full_path, 'source/common/unicode/uvernum.h')
Expand Down Expand Up @@ -1543,7 +1557,7 @@ def make_bin_override():
if make_global_settings:
output['make_global_settings'] = make_global_settings

pprint.pprint(output, indent=2)
print_verbose(output)

write('config.gypi', do_not_edit +
pprint.pformat(output, indent=2) + '\n')
Expand Down Expand Up @@ -1582,9 +1596,11 @@ def make_bin_override():
if options.compile_commands_json:
gyp_args += ['-f', 'compile_commands_json']

# pass the leftover positional arguments to GYP
gyp_args += args

if warn.warned:
if warn.warned and not options.verbose:
warn('warnings were emitted in the configure phase')

print_verbose("running: \n " + " ".join(['python', 'tools/gyp_node.py'] + gyp_args))
run_gyp(gyp_args)

0 comments on commit 5bae8b9

Please sign in to comment.