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

Speedup canned small-icu build #7254

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,10 @@ def configure_intl(o):
print '\n ** Corrupted ZIP? Delete %s to retry download.\n' % targetfile
return None
icu_config = {
'variables': {}
'variables': {
'icu_small_canned': b(False),
'icu_need_swap': b(True),
}
}
icu_config_name = 'icu_config.gypi'
def write_config(data, name):
Expand Down Expand Up @@ -1046,7 +1049,7 @@ def configure_intl(o):

if (o['variables']['icu_small'] == b(True)) and using_default_locales and (not with_icu_source) and canned_icu_available:
# OK- we can use the canned ICU.
icu_config['variables']['icu_small_canned'] = 1
icu_config['variables']['icu_small_canned'] = b(True)
icu_full_path = canned_icu_dir

# --with-icu-source processing
Expand Down Expand Up @@ -1144,6 +1147,9 @@ def configure_intl(o):
# 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
if icu_data_in.endswith('%s.dat' % icu_endianness):
# we may still swap, but mark that we can skip it if need be
icu_config['variables']['icu_need_swap'] = b(False)
# this is the icudt*.dat file which node will be using (platform endianness)
o['variables']['icu_data_file'] = icu_data_file
if not os.path.isfile(icu_data_path):
Expand Down
42 changes: 38 additions & 4 deletions tools/icu/icu-generic.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@
'-F', 'icu_small.json',
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
'-v',
'-L', '<(icu_locales)'],
'-L', '<(icu_locales)',
'-K', '<(icu_small_canned)'],
},
{
# build final .dat -> .obj
Expand Down Expand Up @@ -325,7 +326,17 @@
# link against stub data (as primary data)
# then, use icupkg and genccode to rebuild small data
'dependencies': [ 'icustubdata', 'genccode#host', 'icupkg#host', 'genrb#host', 'iculslocs#host',
'icu_implementation', 'icu_uconfig' ],
'icu_implementation', 'icu_uconfig' ],
'conditions': [
['icu_small_canned == "true"', {
# with canned data, don’t need genrb or iculslocs
'dependencies!': [ 'genrb#host', 'iculslocs#host' ],
}],
['icu_need_swap == "false" and icu_small_canned == "true"', {
# canned data, so don’t need to swap
'dependencies!': [ 'icupkg#host' ],
}],
],
'export_dependent_settings': [ 'icustubdata' ],
'actions': [
{
Expand All @@ -342,7 +353,8 @@
'-F', 'icu_small.json',
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
'-v',
'-L', '<(icu_locales)'],
'-L', '<(icu_locales)',
'-K', '<(icu_small_canned)'],
}, {
# rename to get the final entrypoint name right
'action_name': 'rename',
Expand Down Expand Up @@ -512,7 +524,25 @@
'conditions': [
['OS == "solaris"', {
'defines': [ '_XOPEN_SOURCE_EXTENDED=0' ]
}]
}],
['OS != "win" and icu_need_swap == "false" and icu_small_canned == "true"', {
# we are ONLY building genccode.
# pare down the dependencies dramatically.
'sources!': [ '<@(icu_src_i18n)',
'<@(icu_src_io)', ],
'defines!': [ 'UCONFIG_NO_BREAK_ITERATION=0' ],
'defines': [
#disables the 'year' stuff
'UCONFIG_NO_FORMATTING=1',
'UCONFIG_NO_REGULAR_EXPRESSIONS=1',
'UCONFIG_NO_NORMALIZATION=1',
'UCONFIG_NO_SERVICE=1',
'UCONFIG_NO_IDNA=1',
# should be ok to disable conversion in this case
# .. but http://bugs.icu-project.org/trac/ticket/11046
#'UCONFIG_NO_CONVERSION=1',
]
}],
],
'direct_dependent_settings': {
'include_dirs': [
Expand Down Expand Up @@ -581,6 +611,10 @@
'<@(icu_src_genccode)',
'no-op.cc',
],
'defines': [
#disables the 'current year' stuff
'UCONFIG_NO_FORMATTING=1',
]
},
],
}
15 changes: 13 additions & 2 deletions tools/icu/icutrim.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
# Copyright (C) 2014 IBM Corporation and Others. All Rights Reserved.
# Copyright (C) 2014,2016 IBM Corporation and Others. All Rights Reserved.
#
# @author Steven R. Loomis <srl@icu-project.org>
#
Expand Down Expand Up @@ -65,6 +65,10 @@
action="count",
default=0)

parser.add_option("-K","--canned",
action="count",
default=0)

parser.add_option('-L',"--locales",
action="store",
dest="locales",
Expand Down Expand Up @@ -170,7 +174,14 @@ def runcmd(tool, cmd, doContinue=False):
## The first letter of endian_letter will be 'b' or 'l' for big or little
endian_letter = options.endian[0]

runcmd("icupkg", "-t%s %s %s""" % (endian_letter, options.datfile, outfile))
if ( options.datfile.endswith("%s.dat" % endian_letter) ):
shutil.copyfile(options.datfile, outfile)
else:
runcmd("icupkg", "-t%s %s %s""" % (endian_letter, options.datfile, outfile))

if ( options.canned > 0 ):
print "Canned small ICU - no need to actually trim."
sys.exit(0)

## STEP 2 - get listing
listfile = os.path.join(options.tmpdir,"icudata.lst")
Expand Down