@@ -303,20 +303,28 @@ parser.add_option('--with-etw',
303303intl_optgroup .add_option ('--with-intl' ,
304304 action = 'store' ,
305305 dest = 'with_intl' ,
306- default = 'none ' ,
306+ default = 'small-icu ' ,
307307 choices = valid_intl_modes ,
308308 help = 'Intl mode (valid choices: {0}) [default: %default]' .format (
309309 ', ' .join (valid_intl_modes )))
310310
311+ intl_optgroup .add_option ('--without-intl' ,
312+ action = 'store_const' ,
313+ dest = 'with_intl' ,
314+ const = 'none' ,
315+ help = 'Disable Intl, same as --with-intl=none' )
316+
311317intl_optgroup .add_option ('--with-icu-path' ,
312318 action = 'store' ,
313319 dest = 'with_icu_path' ,
314320 help = 'Path to icu.gyp (ICU i18n, Chromium version only.)' )
315321
322+ icu_default_locales = 'root,en'
323+
316324intl_optgroup .add_option ('--with-icu-locales' ,
317325 action = 'store' ,
318326 dest = 'with_icu_locales' ,
319- default = 'root,en' ,
327+ default = icu_default_locales ,
320328 help = 'Comma-separated list of locales for "small-icu". "root" is assumed. '
321329 '[default: %default]' )
322330
@@ -880,7 +888,7 @@ do_not_edit = '# Do not edit. Generated by the configure script.\n'
880888
881889def glob_to_var (dir_base , dir_sub , patch_dir ):
882890 list = []
883- dir_all = os . path . join (dir_base , dir_sub )
891+ dir_all = '%s/%s' % (dir_base , dir_sub )
884892 files = os .walk (dir_all )
885893 for ent in files :
886894 (path , dirs , files ) = ent
@@ -968,6 +976,7 @@ def configure_intl(o):
968976 locs = set (options .with_icu_locales .split (',' ))
969977 locs .add ('root' ) # must have root
970978 o ['variables' ]['icu_locales' ] = string .join (locs ,',' )
979+ # We will check a bit later if we can use the canned deps/icu-small
971980 elif with_intl == 'full-icu' :
972981 # full ICU
973982 o ['variables' ]['v8_enable_i18n_support' ] = 1
@@ -994,15 +1003,42 @@ def configure_intl(o):
9941003 # this is just the 'deps' dir. Used for unpacking.
9951004 icu_parent_path = os .path .join (root_dir , 'deps' )
9961005
997- # The full path to the ICU source directory.
998- icu_full_path = os . path . join ( icu_parent_path , ' icu')
1006+ # The full path to the ICU source directory. Should not include './'.
1007+ icu_full_path = 'deps/ icu'
9991008
10001009 # icu-tmp is used to download and unpack the ICU tarball.
10011010 icu_tmp_path = os .path .join (icu_parent_path , 'icu-tmp' )
10021011
1012+ # canned ICU. see tools/icu/README.md to update.
1013+ canned_icu_dir = 'deps/icu-small'
1014+
1015+ # We can use 'deps/icu-small' - pre-canned ICU *iff*
1016+ # - with_intl == small-icu (the default!)
1017+ # - with_icu_locales == 'root,en' (the default!)
1018+ # - deps/icu-small exists!
1019+ # - with_icu_source is unset (i.e. no other ICU was specified)
1020+ # (Note that this is the *DEFAULT CASE*.)
1021+ #
1022+ # This is *roughly* equivalent to
1023+ # $ configure --with-intl=small-icu --with-icu-source=deps/icu-small
1024+ # .. Except that we avoid copying icu-small over to deps/icu.
1025+ # In this default case, deps/icu is ignored, although make clean will
1026+ # still harmlessly remove deps/icu.
1027+
1028+ # are we using default locales?
1029+ using_default_locales = ( options .with_icu_locales == icu_default_locales )
1030+
1031+ # make sure the canned ICU really exists
1032+ canned_icu_available = os .path .isdir (canned_icu_dir )
1033+
1034+ if (o ['variables' ]['icu_small' ] == b (True )) and using_default_locales and (not with_icu_source ) and canned_icu_available :
1035+ # OK- we can use the canned ICU.
1036+ icu_config ['variables' ]['icu_small_canned' ] = 1
1037+ icu_full_path = canned_icu_dir
1038+
10031039 # --with-icu-source processing
1004- # first , check that they didn't pass --with-icu-source=deps/icu
1005- if with_icu_source and os .path .abspath (icu_full_path ) == os .path .abspath (with_icu_source ):
1040+ # now , check that they didn't pass --with-icu-source=deps/icu
1041+ elif with_icu_source and os .path .abspath (icu_full_path ) == os .path .abspath (with_icu_source ):
10061042 print 'Ignoring redundant --with-icu-source=%s' % (with_icu_source )
10071043 with_icu_source = None
10081044 # if with_icu_source is still set, try to use it.
@@ -1043,7 +1079,7 @@ def configure_intl(o):
10431079
10441080 # ICU mode. (icu-generic.gyp)
10451081 o ['variables' ]['icu_gyp_path' ] = 'tools/icu/icu-generic.gyp'
1046- # ICU source dir relative to root
1082+ # ICU source dir relative to tools/icu (for .gyp file)
10471083 o ['variables' ]['icu_path' ] = icu_full_path
10481084 if not os .path .isdir (icu_full_path ):
10491085 print '* ECMA-402 (Intl) support didn\' t find ICU in %s..' % (icu_full_path )
@@ -1083,14 +1119,14 @@ def configure_intl(o):
10831119 'source/data/in' ,
10841120 icu_data_file_l )
10851121 # relative to dep..
1086- icu_data_in = os .path .join ('../../deps/icu/ source/data/in' , icu_data_file_l )
1122+ icu_data_in = os .path .join ('..' , '..' , icu_full_path , ' source/data/in' , icu_data_file_l )
10871123 if not os .path .isfile (icu_data_path ) and icu_endianness != 'l' :
10881124 # use host endianness
10891125 icu_data_path = os .path .join (icu_full_path ,
10901126 'source/data/in' ,
10911127 icu_data_file )
10921128 # relative to dep..
1093- icu_data_in = os .path .join ('icu/ source/data/in' ,
1129+ icu_data_in = os .path .join ('..' , icu_full_path , ' source/data/in' ,
10941130 icu_data_file )
10951131 # this is the input '.dat' file to use .. icudt*.dat
10961132 # may be little-endian if from a icu-project.org tarball
@@ -1117,7 +1153,7 @@ def configure_intl(o):
11171153 # with a list of the src files to use
11181154 for i in icu_src :
11191155 var = 'icu_src_%s' % i
1120- path = '../../deps/icu/ source/%s' % icu_src [i ]
1156+ path = '../../%s/ source/%s' % ( icu_full_path , icu_src [i ])
11211157 icu_config ['variables' ][var ] = glob_to_var ('tools/icu' , path , 'patches/%s/source/%s' % (icu_ver_major , icu_src [i ]) )
11221158 # write updated icu_config.gypi with a bunch of paths
11231159 write (icu_config_name , do_not_edit +
0 commit comments