OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
2 | |
3 ICU_VER = 54 | |
4 icu_gen_dir = "$target_gen_dir/icudt${ICU_VER}l" | |
5 icu_gen_tmp_dir = "$target_gen_dir/tmp_icudt${ICU_VER}l" | |
6 | |
7 vars = exec_script("//build/gypi_to_gn.py", | |
8 [ | |
9 rebase_path("../icu_data.gypi"), | |
10 "--replace=<(icu_gen_dir)=$icu_gen_dir", | |
11 "--replace=<(icu_gen_tmp_dir)=$icu_gen_tmp_dir", | |
12 ], | |
13 "scope", | |
14 [ "../icu_data.gypi" ]) | |
15 | |
16 genrb_exe = rebase_path(get_label_info("../gn_tool_build_system:genrb", | |
17 "root_out_dir") + "/genrb") | |
18 | |
19 gencnval_exe = rebase_path(get_label_info("../gn_tool_build_system:gencnval", | |
20 "root_out_dir") + "/gencnval") | |
21 | |
22 icupkg_exe = rebase_path(get_label_info("../gn_tool_build_system:icupkg", | |
23 "root_out_dir") + "/icupkg") | |
24 | |
25 makeconv_exe = rebase_path(get_label_info("../gn_tool_build_system:makeconv", | |
26 "root_out_dir") + "/makeconv") | |
27 | |
28 gendict_exe = rebase_path(get_label_info("../gn_tool_build_system:gendict", | |
29 "root_out_dir") + "/gendict") | |
30 | |
31 genbrk_exe = rebase_path(get_label_info("../gn_tool_build_system:genbrk", | |
32 "root_out_dir") + "/genbrk") | |
33 | |
34 gencfu_exe = rebase_path(get_label_info("../gn_tool_build_system:gencfu", | |
35 "root_out_dir") + "/gencfu") | |
36 | |
37 pkgdata_exe = rebase_path(get_label_info("../gn_tool_build_system:pkgdata", | |
38 "root_out_dir") + "/pkgdata") | |
39 | |
40 | |
41 local_icu_data_curr_res_raw_sources = vars.icu_data_curr_res_raw_sources | |
42 local_icu_data_region_res_sources = vars.icu_data_region_res_sources | |
43 local_icu_data_region_res_alias_sources = vars.icu_data_region_res_alias_sources | |
44 | |
45 icu_data_generated_contents = ([ ] + | |
46 # Coll | |
47 vars.icu_data_coll_res_root_generated + | |
48 vars.icu_data_coll_res_generated + | |
49 vars.icu_data_coll_res_alias_generated + | |
50 ["$icu_gen_dir/coll/res_index.res"] + | |
51 # Brk_brk | |
52 vars.icu_data_brkitr_brk_generated + | |
53 # Brk_res | |
54 vars.icu_data_brkitr_res_root_generated + | |
55 vars.icu_data_brkitr_res_generated + | |
56 ["$icu_gen_dir/brkitr/res_index.res"] + | |
57 # Brk_dict | |
58 ["$icu_gen_dir/brkitr/burmesedict.dict"] + | |
59 ["$icu_gen_dir/brkitr/cjdict.dict"] + | |
60 ["$icu_gen_dir/brkitr/khmerdict.dict"] + | |
61 ["$icu_gen_dir/brkitr/laodict.dict"] + | |
62 ["$icu_gen_dir/brkitr/thaidict.dict"] + | |
63 # Locales | |
64 vars.icu_data_locales_res_root_generated + | |
65 vars.icu_data_locales_res_generated + | |
66 # Misc + end of Locales | |
67 vars.icu_data_locales_res_alias_generated + | |
68 vars.icu_data_misc_res_generated + | |
69 ["$icu_gen_dir/res_index.res"] + | |
70 ["$icu_gen_dir/pool.res"] + | |
71 # Lang | |
72 vars.icu_data_lang_res_root_generated + | |
73 vars.icu_data_lang_res_generated + | |
74 vars.icu_data_lang_res_alias_generated + | |
75 ["$icu_gen_dir/lang/res_index.res"] + | |
76 ["$icu_gen_dir/lang/pool.res"] + | |
77 # Region | |
78 vars.icu_data_region_res_root_generated + | |
79 vars.icu_data_region_res_generated + | |
80 vars.icu_data_region_res_alias_generated + | |
81 ["$icu_gen_dir/region/res_index.res"] + | |
82 ["$icu_gen_dir/region/pool.res"] + | |
83 # Zone | |
84 vars.icu_data_zone_res_root_generated + | |
85 vars.icu_data_zone_res_generated + | |
86 vars.icu_data_zone_res_alias_generated + | |
87 vars.icu_data_zone_res_extra_generated + | |
88 ["$icu_gen_dir/zone/res_index.res"] + | |
89 ["$icu_gen_dir/zone/pool.res"] + | |
90 # Unit | |
91 vars.icu_data_unit_res_root_generated + | |
92 vars.icu_data_unit_res_generated + | |
93 vars.icu_data_unit_res_alias_generated + | |
94 ["$icu_gen_dir/unit/res_index.res"] + | |
95 ["$icu_gen_dir/unit/pool.res"] + | |
96 # Random data | |
97 ["$icu_gen_dir/cnvalias.icu"] + | |
98 ["$icu_gen_dir/coll/ucadata.icu"] + | |
99 ["$icu_gen_dir/nfkc.nrm"] + | |
100 ["$icu_gen_dir/nfkc_cf.nrm"] + | |
101 ["$icu_gen_dir/uts46.nrm"] + | |
102 | |
103 # converters | |
104 vars.icu_data_ucm_generated + | |
105 | |
106 # Currency | |
107 vars.icu_data_curr_res_root_generated + | |
108 vars.icu_data_curr_res_supplemental_generated + | |
109 vars.icu_data_curr_res_generated + | |
110 vars.icu_data_curr_res_alias_generated + | |
111 ["$icu_gen_dir/curr/res_index.res"] + | |
112 ["$icu_gen_dir/curr/pool.res"] + | |
113 | |
114 # RBNF | |
115 ["$icu_gen_dir/rbnf/res_index.res"] + | |
116 | |
117 # Translit (note css3transform.txt -> root.txt) | |
118 ["$icu_gen_dir/translit/root.res"] + | |
119 | |
120 # Confusables | |
121 ["$icu_gen_dir/confusables.cfu"] | |
122 ) | |
123 | |
124 put_icu_data_on_diet = target_os == "android" | |
125 | |
126 languages_to_minimize = "bn,et,gu,kn,ml,mr,ms,ta,te" # Move to gypi? | |
127 | |
128 if (put_icu_data_on_diet) { | |
Andrew Hayden (chromium.org)
2015/04/13 13:20:29
Cute :)
| |
129 icu_data_generated_contents += [ | |
130 # Workaround items for not having cjdict.dict | |
131 "$icu_gen_dir/brkitr/word_ja.brk", | |
132 "$icu_gen_dir/brkitr/ja.res", | |
133 ] | |
134 icu_data_generated_contents -= ( | |
135 # Region data is fetched from the Android API on Android. | |
136 vars.icu_data_region_res_root_generated + | |
137 vars.icu_data_region_res_generated + | |
138 vars.icu_data_region_res_alias_generated + | |
139 | |
140 [ | |
141 # Languages from 'languages_to_minimize' above. | |
142 "$icu_gen_dir/curr/bn.res", | |
143 "$icu_gen_dir/curr/et.res", | |
144 "$icu_gen_dir/curr/gu.res", | |
145 "$icu_gen_dir/curr/kn.res", | |
146 "$icu_gen_dir/curr/ml.res", | |
147 "$icu_gen_dir/curr/mr.res", | |
148 "$icu_gen_dir/curr/ms.res", | |
149 "$icu_gen_dir/curr/ta.res", | |
150 "$icu_gen_dir/curr/te.res", | |
151 | |
152 # Too big to include. | |
153 "$icu_gen_dir/brkitr/cjdict.dict", | |
154 ] | |
155 ) | |
156 # Remove from raw_sources since raw_sources is used when building | |
157 # res_index.txt. | |
158 local_icu_data_curr_res_raw_sources -= [ | |
159 # Languages from 'languages_to_minimize' above. | |
160 "source/data/curr/bn.txt", | |
161 "source/data/curr/et.txt", | |
162 "source/data/curr/gu.txt", | |
163 "source/data/curr/kn.txt", | |
164 "source/data/curr/ml.txt", | |
165 "source/data/curr/mr.txt", | |
166 "source/data/curr/ms.txt", | |
167 "source/data/curr/ta.txt", | |
168 "source/data/curr/te.txt", | |
169 ] | |
170 local_icu_data_region_res_sources = [] | |
171 local_icu_data_region_res_alias_sources = [] | |
172 } else { | |
173 # Workaround files listed in case cjdict.dict is missing. Not needed | |
174 # since we'll include cjdict.dict. | |
175 icu_data_generated_contents -= [ | |
176 "$icu_gen_dir/brkitr/word_ja.brk", | |
177 "$icu_gen_dir/brkitr/ja.res", | |
178 ] | |
179 } | |
180 | |
181 icu_resource_files_file = "$icu_gen_tmp_dir/icu_data_resource_list.tmp" | |
182 write_file(icu_resource_files_file, icu_data_generated_contents) | |
183 | |
184 group("icu_cnv_base_files") { | |
185 deps = [ | |
186 ":icu_cnvalias", | |
187 ":icu_icupkg_nrm", | |
188 ":icu_ucadata_icu", | |
189 ] | |
190 } | |
191 | |
192 action_foreach("icu_icupkg_nrm") { | |
193 script = "run.py" | |
194 sources = rebase_path(vars.icu_data_nrm_sources, | |
195 ".", | |
196 "..") | |
197 inputs = [ | |
198 icupkg_exe, | |
199 ] | |
200 outputs = [ | |
201 "$icu_gen_dir/{{source_file_part}}", | |
202 ] | |
203 args = [ | |
204 icupkg_exe, | |
205 "-tl", | |
206 "{{source}}", | |
207 rebase_path("$icu_gen_dir/{{source_file_part}}"), | |
208 ] | |
209 } | |
210 | |
211 action("icu_cnvalias") { | |
212 script = "run.py" | |
213 inputs = [ | |
214 gencnval_exe, | |
215 "../source/data/mappings/convrtrs.txt", | |
216 ] | |
217 outputs = [ | |
218 "$icu_gen_dir/cnvalias.icu", | |
219 ] | |
220 | |
221 args = [ | |
222 gencnval_exe, | |
223 "-d", | |
224 rebase_path(icu_gen_dir), | |
225 rebase_path("../source/data/mappings/convrtrs.txt"), | |
226 ] | |
227 } | |
228 | |
229 action("icu_ucadata_icu") { | |
230 script = "run.py" | |
231 inputs = [ | |
232 icupkg_exe, | |
233 "../source/data/in/coll/ucadata-implicithan.icu", | |
234 ] | |
235 outputs = [ | |
236 "$icu_gen_dir/coll/ucadata.icu", | |
237 ] | |
238 | |
239 args = [ | |
240 icupkg_exe, | |
241 "-tl", | |
242 rebase_path("../source/data/in/coll/ucadata-implicithan.icu"), | |
243 rebase_path("$icu_gen_dir/coll/ucadata.icu"), | |
244 ] | |
245 } | |
246 | |
247 action_foreach("icu_cnv_ucm_files") { | |
248 script = "run.py" | |
249 sources = rebase_path(vars.icu_data_ucm_sources, | |
250 ".", | |
251 "..") | |
252 inputs = [ | |
253 makeconv_exe, | |
254 ] | |
255 outputs = [ | |
256 "$icu_gen_dir/{{source_name_part}}.cnv", | |
257 ] | |
258 args = [ | |
259 makeconv_exe, | |
260 "-c", | |
261 "-d", | |
262 rebase_path(icu_gen_dir), | |
263 "{{source}}", | |
264 ] | |
265 } | |
266 | |
267 action("icu_filtered_for_size_files") { | |
268 script = "../build_tools/filter_data_for_size.py" | |
269 inputs = ([ | |
270 # Order here is important. See indexing below. | |
271 "../source/data/brkitr/word.txt", | |
272 "../source/data/brkitr/root.txt", | |
273 "../source/data/brkitr/ja.txt", | |
274 "../source/data/locales/pool.res", | |
275 "../source/data/curr/pool.res", | |
276 "../source/data/lang/pool.res", | |
277 "../source/data/zone/pool.res", | |
278 ] + | |
279 rebase_path(local_icu_data_curr_res_raw_sources + | |
280 vars.icu_data_curr_res_alias_raw_sources + | |
281 vars.icu_data_curr_res_supplemental_raw_sources + | |
282 vars.icu_data_locales_res_raw_sources + | |
283 vars.icu_data_locales_res_alias_raw_sources + | |
284 vars.icu_data_lang_res_raw_sources + | |
285 vars.icu_data_lang_res_alias_raw_sources + | |
286 vars.icu_data_zone_res_raw_sources + | |
287 vars.icu_data_zone_res_alias_raw_sources, | |
288 ".", | |
289 "..") | |
290 ) | |
291 outputs = ([ | |
292 # Order here is important. See indexing below. | |
293 "$icu_gen_tmp_dir/brkitr/word.txt", | |
294 "$icu_gen_tmp_dir/brkitr/root.txt", | |
295 "$icu_gen_tmp_dir/brkitr/ja.txt", | |
296 "$icu_gen_tmp_dir/locales/pool.res", | |
297 "$icu_gen_tmp_dir/curr/pool.res", | |
298 "$icu_gen_tmp_dir/lang/pool.res", | |
299 "$icu_gen_tmp_dir/zone/pool.res", | |
300 ] + | |
301 vars.icu_data_curr_res_filtered_sources + | |
302 vars.icu_data_curr_res_alias_filtered_sources + | |
303 vars.icu_data_curr_res_supplemental_filtered_sources + | |
304 vars.icu_data_locales_res_filtered_sources + | |
305 vars.icu_data_locales_res_alias_filtered_sources + | |
306 vars.icu_data_lang_res_filtered_sources + | |
307 vars.icu_data_lang_res_alias_filtered_sources + | |
308 vars.icu_data_zone_res_filtered_sources + | |
309 vars.icu_data_zone_res_alias_filtered_sources | |
310 ) | |
311 | |
312 # To go from inputs to outputs in gn: | |
313 # outputs = rebase_path(rebase_path(inputs, "../source/data"), | |
314 # ".", icu_gen_tmp_dir) | |
315 # But then we would diverge from icu_data.gyp and might not catch | |
316 # errors in the vars above (that would not be needed if we only had gn). | |
317 computed_outputs = rebase_path(rebase_path(inputs, "../source/data"), | |
318 ".", icu_gen_tmp_dir) | |
319 assert(rebase_path(computed_outputs) == rebase_path(outputs)) | |
320 | |
321 if (put_icu_data_on_diet) { | |
322 filter_mode = "strip-for-size" | |
323 } else { | |
324 filter_mode = "clean-copy" | |
325 } | |
326 args = [ | |
327 "--mode", | |
328 filter_mode, | |
329 "--in-word-txt", | |
330 rebase_path(inputs[0]), | |
331 "--out-word-txt", | |
332 rebase_path(outputs[0]), | |
333 "--in-brkitr-root-txt", | |
334 rebase_path(inputs[1]), | |
335 "--out-brkitr-root-txt", | |
336 rebase_path(outputs[1]), | |
337 "--in-brkitr-ja-txt", | |
338 rebase_path(inputs[2]), | |
339 "--out-brkitr-ja-txt", | |
340 rebase_path(outputs[2]), | |
341 "--currency-keep-list", | |
342 rebase_path("../android/currencies.list"), | |
343 "--in-curr-dir", | |
344 rebase_path("../source/data/curr"), | |
345 "--out-curr-dir", | |
346 rebase_path("$icu_gen_tmp_dir/curr"), | |
347 "--minimize-language-list", | |
348 languages_to_minimize, | |
349 "--in-locales-dir", | |
350 rebase_path("../source/data/locales"), | |
351 "--out-locales-dir", | |
352 rebase_path("$icu_gen_tmp_dir/locales"), | |
353 "--in-lang-dir", | |
354 rebase_path("../source/data/lang"), | |
355 "--out-lang-dir", | |
356 rebase_path("$icu_gen_tmp_dir/lang"), | |
357 "--in-zone-dir", | |
358 rebase_path("../source/data/zone"), | |
359 "--out-zone-dir", | |
360 rebase_path("$icu_gen_tmp_dir/zone"), | |
361 "--remove-data-already-existing-in-android", | |
362 ] | |
363 } | |
364 | |
365 dicts_with_transform = [ | |
366 ["burmesedict", "0x1000"], | |
367 ["khmerdict", "0x1780"], | |
368 ["thaidict", "0xe00"], | |
369 ["laodict", "0xe80"], | |
370 ] | |
371 | |
372 if (!put_icu_data_on_diet) { | |
373 dicts_with_transform += [["cjdict", ""]] | |
374 } | |
375 | |
376 foreach(dict_with_transform, dicts_with_transform) { | |
377 dict_to_compile = dict_with_transform[0] | |
378 dict_transform_offset = dict_with_transform[1] | |
379 | |
380 action("icu_dict_" + dict_to_compile) { | |
381 script = "run.py" | |
382 inputs = [ | |
383 gendict_exe, | |
384 "../source/data/brkitr/$dict_to_compile.txt", | |
385 ] | |
386 outputs = [ | |
387 "$icu_gen_dir/brkitr/$dict_to_compile.dict", | |
388 ] | |
389 | |
390 if (dict_transform_offset == "") { | |
391 target_args = ["--uchars"] | |
392 } else { | |
393 target_args = [ | |
394 "--bytes", | |
395 "--transform", | |
396 "offset-$dict_transform_offset", | |
397 ] | |
398 } | |
399 args = [ | |
400 gendict_exe, | |
401 ] + target_args + [ | |
402 "-c", | |
403 "-i", | |
404 rebase_path(icu_gen_dir), | |
405 rebase_path(inputs[1]), | |
406 rebase_path(outputs[0]), | |
407 ] | |
408 } | |
409 } | |
410 | |
411 action_foreach("icu_brk_files") { | |
412 script = "run.py" | |
413 deps = [ | |
414 ":icu_cnv_base_files", | |
415 ":icu_filtered_for_size_files", | |
416 ] | |
417 inputs = [ | |
418 genbrk_exe, | |
419 ] | |
420 sources = rebase_path(vars.icu_data_brkitr_brk_sources, | |
421 ".", | |
422 "..") | |
423 | |
424 outputs = [ "$icu_gen_dir/brkitr/{{source_name_part}}.brk" ] | |
425 args = [ | |
426 genbrk_exe, | |
427 "-c", | |
428 "-i", | |
429 rebase_path(icu_gen_dir), | |
430 "-r", | |
431 "{{source}}", | |
432 "-o", | |
433 rebase_path("$icu_gen_dir/brkitr/{{source_name_part}}.brk"), | |
434 ] | |
435 } | |
436 | |
437 action_foreach("icu_locales_res_files") { | |
438 script = "run.py" | |
439 deps = [ | |
440 ":icu_cnv_base_files", | |
441 ":icu_filtered_for_size_files", | |
442 ] | |
443 inputs = [ | |
444 genrb_exe, | |
445 "$icu_gen_tmp_dir/locales/pool.res", | |
446 ] | |
447 sources = rebase_path(vars.icu_data_locales_res_root_sources + | |
448 vars.icu_data_locales_res_filtered_sources + | |
449 vars.icu_data_locales_res_alias_filtered_sources, | |
450 ".", | |
451 "..") | |
452 | |
453 outputs = [ "$icu_gen_dir/{{source_name_part}}.res" ] | |
454 args = [ | |
455 genrb_exe, | |
456 "--usePoolBundle", | |
457 "-k", | |
458 "-R", | |
459 "-i", | |
460 rebase_path(icu_gen_dir), | |
461 "-s", | |
462 rebase_path(icu_gen_tmp_dir + "/locales"), | |
463 "-d", | |
464 rebase_path(icu_gen_dir), | |
465 "{{source_file_part}}", | |
466 ] | |
467 } | |
468 | |
469 action_foreach("icu_misc_res_files") { | |
470 script = "run.py" | |
471 deps = [ | |
472 ":icu_cnv_base_files", | |
473 ] | |
474 inputs = [ | |
475 genrb_exe, | |
476 ] | |
477 sources = rebase_path(vars.icu_data_misc_res_sources, | |
478 ".", | |
479 "..") | |
480 | |
481 outputs = [ "$icu_gen_dir/{{source_name_part}}.res" ] | |
482 args = [ | |
483 genrb_exe, | |
484 "-k", | |
485 "-R", | |
486 "-q", | |
487 "-i", | |
488 rebase_path(icu_gen_dir), | |
489 "-s", | |
490 rebase_path("../source/data/misc"), | |
491 "-d", | |
492 rebase_path(icu_gen_dir), | |
493 "{{source_file_part}}", | |
494 ] | |
495 } | |
496 | |
497 res_indexes = [ | |
498 # In-dir, out-dir, uses-pool, source-name-list. | |
499 ["locales", "", true, vars.icu_data_locales_res_raw_sources], | |
500 ["curr", "/curr", true, local_icu_data_curr_res_raw_sources], | |
501 ["lang", "/lang", true, vars.icu_data_lang_res_raw_sources], | |
502 ["region", "/region", true, local_icu_data_region_res_sources], | |
503 ["zone", "/zone", true, vars.icu_data_zone_res_raw_sources], | |
504 ["unit", "/unit", true, vars.icu_data_unit_res_sources], | |
505 ["coll", "/coll", false, vars.icu_data_coll_res_sources], | |
506 ["brkitr", "/brkitr", false, vars.icu_data_brkitr_res_sources + | |
507 vars.icu_data_brkitr_res_filtered_sources], | |
508 ["rbnf", "/rbnf", false, []], | |
509 ] | |
510 | |
511 foreach(res_index, res_indexes) { | |
512 res_index_dir = res_index[0] | |
513 res_index_output_dir = res_index[1] | |
514 res_index_uses_pool = res_index[2] | |
515 res_index_sources = [] # Or we will fail to overwrite the value | |
516 # from the last iteration. | |
517 res_index_sources = res_index[3] | |
518 | |
519 action("icu_write_${res_index_dir}_res_index_txt") { | |
520 script = "../build_tools/write_res_index.py" | |
521 inputs = [ | |
522 # Only using file names, not file contents of source files. | |
523 ] | |
524 outputs = [ | |
525 icu_gen_tmp_dir + res_index_output_dir + "/res_index.txt", | |
526 ] | |
527 args = [] | |
528 if (res_index_dir == "locales") { | |
529 args += [ | |
530 "--cldr-version", | |
531 "1.9", # FIXME: Move somewhere | |
532 ] | |
533 } | |
534 | |
535 args += [ | |
536 "--outfile", | |
537 rebase_path(outputs[0]), | |
538 ] | |
539 args += rebase_path(res_index_sources, | |
540 ".", | |
541 "..") | |
542 } | |
543 | |
544 action("icu_${res_index_dir}_res_index_res_file") { | |
545 script = "run.py" | |
546 deps = [ | |
547 ":icu_write_${res_index_dir}_res_index_txt" | |
548 # Simple resources, do not need anything from icu_cnv_base_files. | |
549 # ":icu_cnv_base_files", | |
550 ] | |
551 inputs = [ | |
552 genrb_exe, | |
553 icu_gen_tmp_dir + res_index_output_dir + "/res_index.txt", | |
554 ] | |
555 outputs = [ | |
556 icu_gen_dir + res_index_output_dir + "/res_index.res", | |
557 ] | |
558 args = [ | |
559 genrb_exe, | |
560 "-k", | |
561 "-R", | |
562 "-i", | |
563 rebase_path(icu_gen_dir), | |
564 "-d", | |
565 rebase_path(icu_gen_dir + res_index_output_dir), | |
566 rebase_path(inputs[1]), | |
567 ] | |
568 } | |
569 | |
570 if (res_index_uses_pool) { | |
571 action("icu_${res_index_dir}_pool_res") { | |
572 script = "run.py" | |
573 inputs = [ | |
574 icupkg_exe, | |
575 "../source/data/$res_index_dir/pool.res", | |
576 ] | |
577 outputs = [ | |
578 icu_gen_dir + res_index_output_dir + "/pool.res", | |
579 ] | |
580 args = [ | |
581 icupkg_exe, | |
582 "-tl", | |
583 rebase_path(inputs[1]), | |
584 rebase_path(outputs[0]), | |
585 ] | |
586 } | |
587 } | |
588 } | |
589 | |
590 res_chunks = [ | |
591 # Dir, source_files, is_filtered. | |
592 ["curr", vars.icu_data_curr_res_root_sources + | |
593 vars.icu_data_curr_res_supplemental_filtered_sources + | |
594 vars.icu_data_curr_res_filtered_sources + | |
595 vars.icu_data_curr_res_alias_filtered_sources, true], | |
596 ["lang", vars.icu_data_lang_res_root_sources + | |
597 vars.icu_data_lang_res_filtered_sources + | |
598 vars.icu_data_lang_res_alias_filtered_sources, true], | |
599 ["region", vars.icu_data_region_res_root_sources + | |
600 local_icu_data_region_res_sources + | |
601 local_icu_data_region_res_alias_sources, false], | |
602 ["zone", vars.icu_data_zone_res_root_sources + | |
603 vars.icu_data_zone_res_filtered_sources + | |
604 vars.icu_data_zone_res_alias_filtered_sources + | |
605 vars.icu_data_zone_res_extra_sources, true], | |
606 ["unit", vars.icu_data_unit_res_root_sources + | |
607 vars.icu_data_unit_res_sources + | |
608 vars.icu_data_unit_res_alias_sources, false], | |
609 ] | |
610 | |
611 foreach(res_chunk, res_chunks) { | |
612 chunk_dir = res_chunk[0] | |
613 files = [] | |
614 files = res_chunk[1] | |
615 is_filtered = res_chunk[2] | |
616 | |
617 if (is_filtered) { | |
618 source_dir = icu_gen_tmp_dir | |
619 } else { | |
620 source_dir = "../source/data" | |
621 } | |
622 | |
623 action_foreach("icu_${chunk_dir}_res_files") { | |
624 script = "run.py" | |
625 deps = [ | |
626 ":icu_cnv_base_files", | |
627 ":icu_filtered_for_size_files", # Some have this. Keep it simple. | |
628 ] | |
629 | |
630 inputs = [ | |
631 genrb_exe, | |
632 "$source_dir/$chunk_dir/pool.res", | |
633 ] | |
634 sources = rebase_path(files, | |
635 ".", | |
636 "..") | |
637 | |
638 outputs = [ "$icu_gen_dir/$chunk_dir/{{source_name_part}}.res" ] | |
639 args = [ | |
640 genrb_exe, | |
641 "--usePoolBundle", | |
642 "-k", | |
643 "-R", | |
644 "-i", | |
645 rebase_path(icu_gen_dir), | |
646 "-s", | |
647 rebase_path("$source_dir/$chunk_dir"), | |
648 "-d", | |
649 rebase_path("$icu_gen_dir/$chunk_dir"), | |
650 "{{source_file_part}}", | |
651 ] | |
652 } | |
653 } | |
654 # START COLL | |
655 action_foreach("icu_coll_res_files") { | |
656 script = "run.py" | |
657 deps = [ | |
658 ":icu_cnv_base_files", | |
659 ":icu_misc_res_files", # Specifically keyTypeData for sr_Latn.txt | |
660 ] | |
661 section_dir = "coll" | |
662 inputs = [ | |
663 genrb_exe, | |
664 "$icu_gen_dir/keyTypeData.res", | |
665 ] | |
666 sources = rebase_path(vars.icu_data_coll_res_root_sources + | |
667 vars.icu_data_coll_res_sources + | |
668 vars.icu_data_coll_res_alias_sources, | |
669 ".", | |
670 "..") | |
671 | |
672 outputs = [ "$icu_gen_dir/$section_dir/{{source_name_part}}.res" ] | |
673 args = [ | |
674 genrb_exe, | |
675 "-k", | |
676 "-R", | |
677 "-i", | |
678 rebase_path(icu_gen_dir), | |
679 "-s", | |
680 rebase_path("../source/data/$section_dir"), | |
681 "-d", | |
682 rebase_path("$icu_gen_dir/$section_dir"), | |
683 "{{source_file_part}}", | |
684 ] | |
685 } | |
686 # END COLL | |
687 | |
688 # START BRKITR | |
689 action_foreach("icu_brkitr_res_files") { | |
690 # icu_brkitr_res_filtered_files is the same except that -s (source | |
691 # dir) is icu_gen_tmp_dir in that action. | |
692 script = "run.py" | |
693 deps = [ | |
694 ":icu_cnv_base_files", | |
695 ] | |
696 section_dir = "brkitr" | |
697 inputs = [ | |
698 genrb_exe, | |
699 "$icu_gen_dir/brkitr/cjdict.dict", | |
700 "$icu_gen_dir/brkitr/burmesedict.dict", | |
701 "$icu_gen_dir/brkitr/khmerdict.dict", | |
702 "$icu_gen_dir/brkitr/laodict.dict", | |
703 "$icu_gen_dir/brkitr/thaidict.dict" | |
704 ] + vars.icu_data_brkitr_brk_generated | |
705 | |
706 if (put_icu_data_on_diet) { | |
707 inputs -= [ | |
708 "$icu_gen_dir/brkitr/cjdict.dict", | |
709 ] | |
710 } | |
711 | |
712 sources = rebase_path( | |
713 vars.icu_data_brkitr_res_sources, | |
714 ".", | |
715 "..") | |
716 | |
717 outputs = [ "$icu_gen_dir/$section_dir/{{source_name_part}}.res" ] | |
718 args = [ | |
719 genrb_exe, | |
720 "-k", | |
721 "-R", | |
722 "-i", | |
723 rebase_path(icu_gen_dir), | |
724 "-s", | |
725 rebase_path("../source/data/$section_dir"), | |
726 "-d", | |
727 rebase_path("$icu_gen_dir/$section_dir"), | |
728 "{{source_file_part}}", | |
729 ] | |
730 } | |
731 | |
732 action_foreach("icu_brkitr_res_filtered_files") { | |
733 # Same as icu_brkitr_res_files except that -s (source dir) is | |
734 # icu_gen_tmp_dir. | |
735 script = "run.py" | |
736 deps = [ | |
737 ":icu_cnv_base_files", | |
738 ":icu_filtered_for_size_files", | |
739 ] | |
740 section_dir = "brkitr" | |
741 inputs = [ | |
742 genrb_exe, | |
743 "$icu_gen_dir/brkitr/cjdict.dict", | |
744 "$icu_gen_dir/brkitr/burmesedict.dict", | |
745 "$icu_gen_dir/brkitr/khmerdict.dict", | |
746 "$icu_gen_dir/brkitr/laodict.dict", | |
747 "$icu_gen_dir/brkitr/thaidict.dict" | |
748 ] + vars.icu_data_brkitr_brk_generated | |
749 | |
750 if (put_icu_data_on_diet) { | |
751 inputs -= [ | |
752 "$icu_gen_dir/brkitr/cjdict.dict", | |
753 ] | |
754 } | |
755 | |
756 sources = rebase_path( | |
757 vars.icu_data_brkitr_res_root_filtered_sources + | |
758 vars.icu_data_brkitr_res_filtered_sources, | |
759 ".", | |
760 "..") | |
761 | |
762 outputs = [ "$icu_gen_dir/$section_dir/{{source_name_part}}.res" ] | |
763 args = [ | |
764 genrb_exe, | |
765 "-k", | |
766 "-R", | |
767 "-i", | |
768 rebase_path(icu_gen_dir), | |
769 "-s", | |
770 rebase_path("$icu_gen_tmp_dir/$section_dir"), | |
771 "-d", | |
772 rebase_path("$icu_gen_dir/$section_dir"), | |
773 "{{source_file_part}}", | |
774 ] | |
775 } | |
776 # END BRKITR | |
777 | |
778 # START RBNF | |
779 # END RBNF | |
780 | |
781 # START TRANSLIT | |
782 action("icu_data_translit") { | |
783 script = "run.py" | |
784 deps = [ | |
785 ":icu_cnv_base_files", | |
786 ] | |
787 section_dir = "translit" | |
788 inputs = [ | |
789 genrb_exe, | |
790 "../source/data/$section_dir/css3transform.txt", | |
791 ] | |
792 outputs = [ "$icu_gen_dir/$section_dir/root.res" ] | |
793 args = [ | |
794 genrb_exe, | |
795 "-k", | |
796 "-R", | |
797 "-i", | |
798 rebase_path(icu_gen_dir), | |
799 "-s", | |
800 rebase_path("../source/data/$section_dir"), | |
801 "-d", | |
802 rebase_path("$icu_gen_dir/$section_dir"), | |
803 "css3transform.txt", | |
804 ] | |
805 } | |
806 # END TRANSLIT | |
807 | |
808 # START CONFUSABLES | |
809 action("icu_data_confusables") { | |
810 script = "run.py" | |
811 inputs = [ | |
812 gencfu_exe, | |
813 "$icu_gen_dir/cnvalias.icu", | |
814 "../source/data/unidata/confusables.txt", | |
815 "../source/data/unidata/confusablesWholeScript.txt", | |
816 ] | |
817 outputs = [ | |
818 "$icu_gen_dir/confusables.cfu", | |
819 ] | |
820 | |
821 args = [ | |
822 gencfu_exe, | |
823 "-c", | |
824 "-i", | |
825 rebase_path(icu_gen_dir), | |
826 "-r", | |
827 rebase_path("../source/data/unidata/confusables.txt"), | |
828 "-w", | |
829 rebase_path("../source/data/unidata/confusablesWholeScript.txt"), | |
830 "-o", | |
831 rebase_path(outputs[0]) | |
832 ] | |
833 } | |
834 # END CONFUSABLES | |
835 | |
836 # START icudata.lst/icupkg.inc/icudtl.dat | |
837 action("icu_write_icudata_lst") { | |
838 write_file(icu_resource_files_file, icu_data_generated_contents) | |
839 script = "../build_tools/write_icudata_lst.py" | |
840 inputs = [ | |
841 icu_resource_files_file, | |
842 ] | |
843 outputs = [ | |
844 "$icu_gen_tmp_dir/icudata.lst", | |
845 ] | |
846 | |
847 args = [ | |
848 "--inroot", | |
849 rebase_path(icu_gen_dir), | |
850 "--infile", | |
851 rebase_path(icu_resource_files_file), | |
852 "--gn-root", | |
853 rebase_path("//."), | |
854 "--outfile", | |
855 rebase_path(outputs[0]) | |
856 ] | |
857 } | |
858 | |
859 action("icu_write_icupkg_inc") { | |
860 script = "../build_tools/write_icupkg_inc.py" | |
861 outputs = [ | |
862 "$icu_gen_tmp_dir/icupkg.inc", | |
863 ] | |
864 | |
865 args = [ | |
866 "--outfile", | |
867 rebase_path(outputs[0]), | |
868 "--ver", | |
869 "$ICU_VER", | |
870 "--icu-dir", | |
871 rebase_path(".."), | |
872 ] | |
873 } | |
874 | |
875 import("//third_party/icu/config.gni") | |
876 | |
877 action("icu_pkgdata") { | |
878 script = "run.py" | |
879 inputs = [ | |
880 pkgdata_exe, | |
881 "$icu_gen_tmp_dir/icudata.lst", | |
882 "$icu_gen_tmp_dir/icupkg.inc", | |
883 ] + icu_data_generated_contents | |
884 | |
885 deps = ["../gn_tool_build_system:pkgdata"] | |
886 | |
887 if (icu_use_data_file) { | |
888 pkgdata_args = [ | |
889 "-m", # Mode | |
890 "common", | |
891 ] | |
892 outputs = [ | |
893 "$icu_gen_tmp_dir/result/icudt${ICU_VER}l.dat", | |
894 ] | |
895 } else { | |
896 pkgdata_args = [ | |
897 "-m", # Mode | |
898 "dll", | |
899 "-e", # Entry point | |
900 "icudt<(ICU_VER)", | |
901 "-L", # Lib name | |
902 "icudata", | |
903 "-T<(icu_gen_tmp_dir)", | |
904 ] | |
905 | |
906 if (is_win) { | |
907 outputs = [ | |
908 "$icu_gen_dir/icudt${ICU_VER}l.dll", | |
909 ] | |
910 } else { | |
911 pkgdata_args += [ | |
912 "-O", | |
913 "<(icu_gen_tmp_dir)/icupkg.inc", | |
914 ] | |
915 outputs = [ | |
916 "$icu_gen_dir/libicudata.so.${ICU_VER}.1", | |
917 ] | |
918 } | |
919 } | |
920 args = [ | |
921 pkgdata_exe, | |
922 ] + pkgdata_args + [ | |
923 "-q", # Quiet | |
924 "-c", # Default copyright | |
925 "-s", # Source | |
926 rebase_path(icu_gen_dir), | |
927 "-d", # Destination | |
928 rebase_path(icu_gen_tmp_dir + "/result"), | |
929 "-T", # Temporary directory | |
930 rebase_path(icu_gen_tmp_dir), | |
931 "-p", # Data name | |
932 "icudt${ICU_VER}l", | |
933 "-r", # Revision | |
934 "${ICU_VER}.1", | |
935 rebase_path("$icu_gen_tmp_dir/icudata.lst"), | |
936 ] | |
937 } | |
938 | |
939 if (icu_use_data_file && is_ios) { | |
940 # TODO(GYP): Support mac resource bundle shown below. | |
941 # 'link_settings': { | |
942 # 'mac_bundle_resources': [ | |
943 # "$icu_gen_tmp_dir/icudt${ICU_VER}l.dat", | |
944 # ], | |
945 # } | |
946 } else if (icu_use_data_file || is_win) { | |
947 copy("icu_data") { | |
948 if (icu_use_data_file) { | |
949 sources = [ "$icu_gen_tmp_dir/result/icudt${ICU_VER}l.dat", ] | |
950 outputs = [ "$root_out_dir/icudtl.dat", ] | |
951 } else { | |
952 sources = [ "$icu_gen_dir/icud${ICU_VER}.dll", ] | |
953 outputs = [ "$root_out_dir/icudt.dll", ] | |
954 } | |
955 } | |
956 } else { | |
957 source_set("icu_data") { | |
958 sources = [ | |
959 "$icu_gen_tmp_dir/icudt${ICU_VER}l_dat.S", | |
960 ] | |
961 } | |
962 defines = [ "U_HIDE_DATA_SYMBOL" ] | |
963 } | |
964 # END icudata.lst/icudtl.dat | |
OLD | NEW |