Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: check minimum ICU in configure for system-icu #24255

Merged
merged 1 commit into from
Nov 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
dest='with_icu_source',
help='Intl mode: optional local path to icu/ dir, or path/URL of '
'the icu4c source archive. '
'v%d.x or later recommended.' % icu_versions["minimum_icu"])
'v%d.x or later recommended.' % icu_versions['minimum_icu'])

parser.add_option('--with-ltcg',
action='store_true',
Expand Down Expand Up @@ -622,17 +622,21 @@ def b(value):


def pkg_config(pkg):
"""Run pkg-config on the specified package
Returns ("-l flags", "-I flags", "-L flags", "version")
otherwise (None, None, None, None)"""
pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
retval = ()
for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L']:
for flag in ['--libs-only-l', '--cflags-only-I',
'--libs-only-L', '--modversion']:
try:
proc = subprocess.Popen(
shlex.split(pkg_config) + ['--silence-errors', flag, pkg],
stdout=subprocess.PIPE)
val = proc.communicate()[0].strip()
except OSError as e:
if e.errno != errno.ENOENT: raise e # Unexpected error.
return (None, None, None) # No pkg-config/pkgconf installed.
return (None, None, None, None) # No pkg-config/pkgconf installed.
retval += (val,)
return retval

Expand Down Expand Up @@ -1119,7 +1123,7 @@ def configure_library(lib, output):
output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))

if getattr(options, shared_lib):
(pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib)
(pkg_libs, pkg_cflags, pkg_libpath, pkg_modversion) = pkg_config(lib)

if options.__dict__[shared_lib + '_includes']:
output['include_dirs'] += [options.__dict__[shared_lib + '_includes']]
Expand Down Expand Up @@ -1354,7 +1358,12 @@ def write_config(data, name):
if pkgicu[0] is None:
error('''Could not load pkg-config data for "icu-i18n".
See above errors or the README.md.''')
(libs, cflags, libpath) = pkgicu
(libs, cflags, libpath, icuversion) = pkgicu
icu_ver_major = icuversion.split('.')[0]
o['variables']['icu_ver_major'] = icu_ver_major
if int(icu_ver_major) < icu_versions['minimum_icu']:
error('icu4c v%s is too old, v%d.x or later is required.' %
(icuversion, icu_versions['minimum_icu']))
# libpath provides linker path which may contain spaces
if libpath:
o['libraries'] += [libpath]
Expand Down Expand Up @@ -1473,9 +1482,9 @@ def write_config(data, name):
icu_ver_major = m.group(1)
if not icu_ver_major:
error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h)
elif int(icu_ver_major) < icu_versions["minimum_icu"]:
error('icu4c v%d.x is too old, v%d.x or later is required.' % (int(icu_ver_major),
icu_versions["minimum_icu"]))
elif int(icu_ver_major) < icu_versions['minimum_icu']:
error('icu4c v%s.x is too old, v%d.x or later is required.' %
(icu_ver_major, icu_versions['minimum_icu']))
icu_endianness = sys.byteorder[0];
o['variables']['icu_ver_major'] = icu_ver_major
o['variables']['icu_endianness'] = icu_endianness
Expand Down