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