-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Make full-icu the default #29522
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
Make full-icu the default #29522
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ | |
import shlex | ||
import subprocess | ||
import shutil | ||
import bz2 | ||
|
||
from distutils.spawn import find_executable as which | ||
|
||
# If not run from node/, cd to node/. | ||
|
@@ -409,7 +411,7 @@ | |
intl_optgroup.add_option('--with-intl', | ||
action='store', | ||
dest='with_intl', | ||
default='small-icu', | ||
default='full-icu', | ||
choices=valid_intl_modes, | ||
help='Intl mode (valid choices: {0}) [default: %default]'.format( | ||
', '.join(valid_intl_modes))) | ||
|
@@ -1399,38 +1401,35 @@ def write_config(data, name): | |
icu_parent_path = 'deps' | ||
|
||
# The full path to the ICU source directory. Should not include './'. | ||
icu_full_path = 'deps/icu' | ||
icu_deps_path = 'deps/icu' | ||
icu_full_path = icu_deps_path | ||
|
||
# icu-tmp is used to download and unpack the ICU tarball. | ||
icu_tmp_path = os.path.join(icu_parent_path, 'icu-tmp') | ||
|
||
# canned ICU. see tools/icu/README.md to update. | ||
canned_icu_dir = 'deps/icu-small' | ||
|
||
# use the README to verify what the canned ICU is | ||
canned_is_full = os.path.isfile(os.path.join(canned_icu_dir, 'README-FULL-ICU.txt')) | ||
canned_is_small = os.path.isfile(os.path.join(canned_icu_dir, 'README-SMALL-ICU.txt')) | ||
if canned_is_small: | ||
warn('Ignoring %s - in-repo small icu is no longer supported.' % canned_icu_dir) | ||
|
||
# We can use 'deps/icu-small' - pre-canned ICU *iff* | ||
# - with_intl == small-icu (the default!) | ||
# - with_icu_locales == 'root,en' (the default!) | ||
# - deps/icu-small exists! | ||
# - canned_is_full AND | ||
# - with_icu_source is unset (i.e. no other ICU was specified) | ||
# (Note that this is the *DEFAULT CASE*.) | ||
# | ||
# This is *roughly* equivalent to | ||
# $ configure --with-intl=small-icu --with-icu-source=deps/icu-small | ||
# $ configure --with-intl=full-icu --with-icu-source=deps/icu-small | ||
# .. Except that we avoid copying icu-small over to deps/icu. | ||
# In this default case, deps/icu is ignored, although make clean will | ||
# still harmlessly remove deps/icu. | ||
|
||
# are we using default locales? | ||
using_default_locales = ( options.with_icu_locales == icu_default_locales ) | ||
|
||
# make sure the canned ICU really exists | ||
canned_icu_available = os.path.isdir(canned_icu_dir) | ||
|
||
if (o['variables']['icu_small'] == b(True)) and using_default_locales and (not with_icu_source) and canned_icu_available: | ||
if (not with_icu_source) and canned_is_full: | ||
# OK- we can use the canned ICU. | ||
icu_config['variables']['icu_small_canned'] = 1 | ||
icu_full_path = canned_icu_dir | ||
|
||
icu_config['variables']['icu_full_canned'] = 1 | ||
# --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): | ||
|
@@ -1508,29 +1507,40 @@ def write_config(data, name): | |
icu_endianness = sys.byteorder[0] | ||
o['variables']['icu_ver_major'] = icu_ver_major | ||
o['variables']['icu_endianness'] = icu_endianness | ||
icu_data_file_l = 'icudt%s%s.dat' % (icu_ver_major, 'l') | ||
icu_data_file_l = 'icudt%s%s.dat' % (icu_ver_major, 'l') # LE filename | ||
icu_data_file = 'icudt%s%s.dat' % (icu_ver_major, icu_endianness) | ||
# relative to configure | ||
icu_data_path = os.path.join(icu_full_path, | ||
'source/data/in', | ||
icu_data_file_l) | ||
icu_data_file_l) # LE | ||
compressed_data = '%s.bz2' % (icu_data_path) | ||
if not os.path.isfile(icu_data_path) and os.path.isfile(compressed_data): | ||
# unpack. deps/icu is a temporary path | ||
if os.path.isdir(icu_tmp_path): | ||
shutil.rmtree(icu_tmp_path) | ||
os.mkdir(icu_tmp_path) | ||
icu_data_path = os.path.join(icu_tmp_path, icu_data_file_l) | ||
with open(icu_data_path, 'wb') as outf: | ||
with bz2.BZ2File(compressed_data, 'rb') as inf: | ||
shutil.copyfileobj(inf, outf) | ||
# Now, proceed.. | ||
|
||
# relative to dep.. | ||
icu_data_in = os.path.join('..','..', icu_full_path, 'source/data/in', icu_data_file_l) | ||
icu_data_in = os.path.join('..','..', icu_data_path) | ||
if not os.path.isfile(icu_data_path) and icu_endianness != 'l': | ||
# use host endianness | ||
icu_data_path = os.path.join(icu_full_path, | ||
'source/data/in', | ||
icu_data_file) | ||
# relative to dep.. | ||
icu_data_in = os.path.join('..', icu_full_path, 'source/data/in', | ||
icu_data_file) | ||
# this is the input '.dat' file to use .. icudt*.dat | ||
# may be little-endian if from a icu-project.org tarball | ||
o['variables']['icu_data_in'] = icu_data_in | ||
icu_data_file) # will be generated | ||
if not os.path.isfile(icu_data_path): | ||
# .. and we're not about to build it from .gyp! | ||
error('''ICU prebuilt data file %s does not exist. | ||
See the README.md.''' % icu_data_path) | ||
|
||
# this is the input '.dat' file to use .. icudt*.dat | ||
# may be little-endian if from a icu-project.org tarball | ||
o['variables']['icu_data_in'] = icu_data_in | ||
|
||
# map from variable name to subdirs | ||
icu_src = { | ||
'stubdata': 'stubdata', | ||
|
@@ -1547,6 +1557,31 @@ def write_config(data, name): | |
var = 'icu_src_%s' % i | ||
path = '../../%s/source/%s' % (icu_full_path, icu_src[i]) | ||
icu_config['variables'][var] = glob_to_var('tools/icu', path, 'patches/%s/source/%s' % (icu_ver_major, icu_src[i]) ) | ||
# calculate platform-specific genccode args | ||
# print("platform %s, flavor %s" % (sys.platform, flavor)) | ||
# if sys.platform == 'darwin': | ||
# shlib_suffix = '%s.dylib' | ||
# elif sys.platform.startswith('aix'): | ||
# shlib_suffix = '%s.a' | ||
# else: | ||
# shlib_suffix = 'so.%s' | ||
if flavor == 'win': | ||
icu_config['variables']['icu_asm_ext'] = 'obj' | ||
icu_config['variables']['icu_asm_opts'] = [ '-o ' ] | ||
elif with_intl == 'small-icu' or options.cross_compiling: | ||
icu_config['variables']['icu_asm_ext'] = 'c' | ||
icu_config['variables']['icu_asm_opts'] = [] | ||
elif flavor == 'mac': | ||
icu_config['variables']['icu_asm_ext'] = 'S' | ||
icu_config['variables']['icu_asm_opts'] = [ '-a', 'gcc-darwin' ] | ||
elif sys.platform.startswith('aix'): | ||
icu_config['variables']['icu_asm_ext'] = 'S' | ||
icu_config['variables']['icu_asm_opts'] = [ '-a', 'xlc' ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't use xlc on AIX. I'm wondering if this is correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's "xlc format" assembly, which seems to be what the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seemed to pass as https://ci.nodejs.org/job/node-test-commit-aix/nodes=aix61-ppc64/25671/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @srl295 thanks for the clarification. |
||
else: | ||
# assume GCC-compatible asm is OK | ||
icu_config['variables']['icu_asm_ext'] = 'S' | ||
icu_config['variables']['icu_asm_opts'] = [ '-a', 'gcc' ] | ||
|
||
# write updated icu_config.gypi with a bunch of paths | ||
write(icu_config_name, do_not_edit + | ||
pprint.pformat(icu_config, indent=2) + '\n') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ICU sources - auto generated by shrink-icu-src.py | ||
|
||
This directory contains the ICU subset used by --with-intl=full-icu | ||
It is a strict subset of ICU 64 source files with the following exception(s): | ||
* deps/icu-small/source/data/in/icudt64l.dat.bz2 : compressed data file | ||
|
||
|
||
To rebuild this directory, see ../../tools/icu/README.md | ||
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.