|
429 | 429 | dest='with_icu_source',
|
430 | 430 | help='Intl mode: optional local path to icu/ dir, or path/URL of '
|
431 | 431 | 'the icu4c source archive. '
|
432 |
| - 'v%d.x or later recommended.' % icu_versions["minimum_icu"]) |
| 432 | + 'v%d.x or later recommended.' % icu_versions['minimum_icu']) |
433 | 433 |
|
434 | 434 | parser.add_option('--with-ltcg',
|
435 | 435 | action='store_true',
|
@@ -621,17 +621,21 @@ def b(value):
|
621 | 621 |
|
622 | 622 |
|
623 | 623 | def pkg_config(pkg):
|
| 624 | + """Run pkg-config on the specified package |
| 625 | + Returns ("-l flags", "-I flags", "-L flags", "version") |
| 626 | + otherwise (None, None, None, None)""" |
624 | 627 | pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
|
625 | 628 | retval = ()
|
626 |
| - for flag in ['--libs-only-l', '--cflags-only-I', '--libs-only-L']: |
| 629 | + for flag in ['--libs-only-l', '--cflags-only-I', |
| 630 | + '--libs-only-L', '--modversion']: |
627 | 631 | try:
|
628 | 632 | proc = subprocess.Popen(
|
629 | 633 | shlex.split(pkg_config) + ['--silence-errors', flag, pkg],
|
630 | 634 | stdout=subprocess.PIPE)
|
631 | 635 | val = proc.communicate()[0].strip()
|
632 | 636 | except OSError as e:
|
633 | 637 | if e.errno != errno.ENOENT: raise e # Unexpected error.
|
634 |
| - return (None, None, None) # No pkg-config/pkgconf installed. |
| 638 | + return (None, None, None, None) # No pkg-config/pkgconf installed. |
635 | 639 | retval += (val,)
|
636 | 640 | return retval
|
637 | 641 |
|
@@ -1123,7 +1127,7 @@ def configure_library(lib, output):
|
1123 | 1127 | output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))
|
1124 | 1128 |
|
1125 | 1129 | if getattr(options, shared_lib):
|
1126 |
| - (pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib) |
| 1130 | + (pkg_libs, pkg_cflags, pkg_libpath, pkg_modversion) = pkg_config(lib) |
1127 | 1131 |
|
1128 | 1132 | if options.__dict__[shared_lib + '_includes']:
|
1129 | 1133 | output['include_dirs'] += [options.__dict__[shared_lib + '_includes']]
|
@@ -1356,7 +1360,12 @@ def write_config(data, name):
|
1356 | 1360 | if pkgicu[0] is None:
|
1357 | 1361 | error('''Could not load pkg-config data for "icu-i18n".
|
1358 | 1362 | See above errors or the README.md.''')
|
1359 |
| - (libs, cflags, libpath) = pkgicu |
| 1363 | + (libs, cflags, libpath, icuversion) = pkgicu |
| 1364 | + icu_ver_major = icuversion.split('.')[0] |
| 1365 | + o['variables']['icu_ver_major'] = icu_ver_major |
| 1366 | + if int(icu_ver_major) < icu_versions['minimum_icu']: |
| 1367 | + error('icu4c v%s is too old, v%d.x or later is required.' % |
| 1368 | + (icuversion, icu_versions['minimum_icu'])) |
1360 | 1369 | # libpath provides linker path which may contain spaces
|
1361 | 1370 | if libpath:
|
1362 | 1371 | o['libraries'] += [libpath]
|
@@ -1474,9 +1483,9 @@ def write_config(data, name):
|
1474 | 1483 | icu_ver_major = m.group(1)
|
1475 | 1484 | if not icu_ver_major:
|
1476 | 1485 | error('Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h)
|
1477 |
| - elif int(icu_ver_major) < icu_versions["minimum_icu"]: |
1478 |
| - error('icu4c v%d.x is too old, v%d.x or later is required.' % (int(icu_ver_major), |
1479 |
| - icu_versions["minimum_icu"])) |
| 1486 | + elif int(icu_ver_major) < icu_versions['minimum_icu']: |
| 1487 | + error('icu4c v%s.x is too old, v%d.x or later is required.' % |
| 1488 | + (icu_ver_major, icu_versions['minimum_icu'])) |
1480 | 1489 | icu_endianness = sys.byteorder[0];
|
1481 | 1490 | o['variables']['icu_ver_major'] = icu_ver_major
|
1482 | 1491 | o['variables']['icu_endianness'] = icu_endianness
|
|
0 commit comments