-
Notifications
You must be signed in to change notification settings - Fork 0
/
icu.gyp
723 lines (721 loc) · 24.1 KB
/
icu.gyp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'icu.gypi',
],
'variables': {
'use_system_icu%': 0,
'icu_use_data_file_flag%': 0,
'want_separate_host_toolset%': 1,
},
'target_defaults': {
'direct_dependent_settings': {
'defines': [
# Tell ICU to not insert |using namespace icu;| into its headers,
# so that chrome's source explicitly has to use |icu::|.
'U_USING_ICU_NAMESPACE=0',
# We don't use ICU plugins and dyload is only necessary for them.
# NaCl-related builds also fail looking for dlfcn.h when it's enabled.
'U_ENABLE_DYLOAD=0',
],
},
'defines': [
'U_USING_ICU_NAMESPACE=0',
'HAVE_DLOPEN=0',
# Only build encoding coverters and detectors necessary for HTML5.
'UCONFIG_ONLY_HTML_CONVERSION=1',
# TODO(jshin): Do we still need/want this?
'UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0',
# No dependency on the default platform encoding.
# Will cut down the code size.
'U_CHARSET_IS_UTF8=1',
],
'conditions': [
['component=="static_library"', {
'defines': [
'U_STATIC_IMPLEMENTATION',
],
}],
['OS=="win"', {
'defines': [
'UCHAR_TYPE=wchar_t',
],
'cflags': [ '/utf-8' ],
},{
'defines': [
'UCHAR_TYPE=uint16_t',
],
}],
['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
(target_arch=="arm" or target_arch=="ia32" or \
target_arch=="mipsel" or target_arch=="mips" or \
target_arch=="ppc" or target_arch=="s390")', {
'target_conditions': [
['_toolset=="host"', {
'conditions': [
['host_arch=="s390" or host_arch=="s390x"', {
'cflags': [ '-m31' ],
'ldflags': [ '-m31' ],
'asflags': [ '-31' ],
},{
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
'asflags': [ '-32' ],
}],
],
'xcode_settings': {
'ARCHS': [ 'i386' ],
},
}],
],
}],
['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
(target_arch=="arm64" or target_arch=="x64" or \
target_arch=="mips64el" or target_arch=="mips64" or \
target_arch=="ppc64" or target_arch=="s390x")', {
'target_conditions': [
['_toolset=="host"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
'asflags': [ '-64' ],
'xcode_settings': {
'ARCHS': [ 'x86_64' ],
},
}],
],
}],
],
'include_dirs': [
'source/common',
'source/i18n',
],
'msvs_disabled_warnings': [4005, 4068, 4267],
},
'conditions': [
['use_system_icu==0 or want_separate_host_toolset==1', {
'targets': [
{
'target_name': 'copy_icudt_dat',
'type': 'none',
# icudtl.dat is the same for both host/target, so this only supports a
# single toolset. If a target requires that the .dat file be copied
# to the output directory, it should explicitly depend on this target
# with the host toolset (like copy_icudt_dat#host).
'toolsets': [ 'host' ],
'copies': [{
'destination': '<(PRODUCT_DIR)',
'conditions': [
['OS == "android"', {
'files': [
'android/icudtl.dat',
],
} , { # else: OS != android
'conditions': [
# Big Endian
[ 'v8_host_byteorder=="big" or target_arch=="mips" or \
target_arch=="mips64"', {
'files': [
'common/icudtb.dat',
],
} , { # else: ! Big Endian = Little Endian
'files': [
'common/icudtl.dat',
],
}],
],
}],
],
}],
},
{
'target_name': 'data_assembly',
'type': 'none',
'conditions': [
[ 'v8_host_byteorder=="big" or target_arch=="mips" or \
target_arch=="mips64"', { # Big Endian
'data_assembly_inputs': [
'common/icudtb.dat',
],
'data_assembly_outputs': [
'<(SHARED_INTERMEDIATE_DIR)/third_party/icu/icudtb_dat.S',
],
}, { # Little Endian
'data_assembly_outputs': [
'<(SHARED_INTERMEDIATE_DIR)/third_party/icu/icudtl_dat.S',
],
'conditions': [
['OS == "android"', {
'data_assembly_inputs': [
'android/icudtl.dat',
],
} , { # else: OS!="android"
'data_assembly_inputs': [
'common/icudtl.dat',
],
}], # OS==android
],
}],
],
'sources': [
'<@(_data_assembly_inputs)',
],
'actions': [
{
'action_name': 'make_data_assembly',
'inputs': [
'scripts/make_data_assembly.py',
'<@(_data_assembly_inputs)',
],
'outputs': [
'<@(_data_assembly_outputs)',
],
'target_conditions': [
[ 'OS == "mac" or OS == "ios" or '
'((OS == "android" or OS == "qnx") and '
'_toolset == "host" and host_os == "mac")', {
'action': ['python', '<@(_inputs)', '<@(_outputs)', '--mac'],
} , {
'action': ['python', '<@(_inputs)', '<@(_outputs)'],
}],
],
},
],
},
{
'target_name': 'icudata',
'type': 'static_library',
'defines': [
'U_HIDE_DATA_SYMBOL',
],
'dependencies': [
'data_assembly#target',
],
'sources': [
'<(SHARED_INTERMEDIATE_DIR)/third_party/icu/icudtl_dat.S',
'<(SHARED_INTERMEDIATE_DIR)/third_party/icu/icudtb_dat.S',
],
'conditions': [
[ 'v8_host_byteorder=="big" or target_arch=="mips" or \
target_arch=="mips64"', {
'sources!': [
'<(SHARED_INTERMEDIATE_DIR)/third_party/icu/icudtl_dat.S'
],
}, {
'sources!': [
'<(SHARED_INTERMEDIATE_DIR)/third_party/icu/icudtb_dat.S'
],
}],
[ 'use_system_icu==1 and want_separate_host_toolset==1', {
'toolsets': ['host'],
}],
[ 'use_system_icu==0 and want_separate_host_toolset==1', {
'toolsets': ['host', 'target'],
}],
[ 'use_system_icu==0 and want_separate_host_toolset==0', {
'toolsets': ['target'],
}],
[ 'OS == "win" and icu_use_data_file_flag==0', {
'type': 'none',
'dependencies!': [
'data_assembly#target',
],
'copies': [
{
'destination': '<(PRODUCT_DIR)',
'files': [
'windows/icudt.dll',
],
},
],
}],
[ 'icu_use_data_file_flag==1', {
'type': 'none',
'dependencies!': [
'data_assembly#target',
],
# Remove any assembly data file.
'sources/': [['exclude', 'icudt[lb]_dat']],
# Make sure any binary depending on this gets the data file.
'conditions': [
['OS != "ios"', {
'dependencies': [
'copy_icudt_dat#host',
],
} , { # else: OS=="ios"
'link_settings': {
'mac_bundle_resources': [
'common/icudtl.dat',
],
},
}], # OS!=ios
], # conditions
}], # icu_use_data_file_flag
], # conditions
'target_conditions': [
[ 'OS == "win"', {
'sources!': [
'<(SHARED_INTERMEDIATE_DIR)/third_party/icu/icudtl_dat.S',
'<(SHARED_INTERMEDIATE_DIR)/third_party/icu/icudtb_dat.S'
],
}],
], # target_conditions
},
{
'target_name': 'icui18n',
'type': '<(component)',
'sources': [
'<@(icui18n_sources)',
],
'defines': [
'U_I18N_IMPLEMENTATION',
],
'dependencies': [
'icuuc',
],
'direct_dependent_settings': {
'include_dirs': [
'source/i18n',
],
},
'variables': {
'clang_warning_flags': [
# ICU uses its own deprecated functions.
'-Wno-deprecated-declarations',
# ICU prefers `a && b || c` over `(a && b) || c`.
'-Wno-logical-op-parentheses',
# ICU has some `unsigned < 0` checks.
'-Wno-tautological-compare',
# ICU has some code with the pattern:
# if (found = uprv_getWindowsTimeZoneInfo(...))
'-Wno-parentheses',
],
},
# Since ICU wants to internally use its own deprecated APIs, don't
# complain about it.
'cflags': [
'-Wno-deprecated-declarations',
],
'cflags_cc': [
'-frtti',
],
'cflags_cc!': [
'-fno-rtti',
],
'xcode_settings': {
'GCC_ENABLE_CPP_RTTI': 'YES', # -frtti
},
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeTypeInfo': 'true',
},
},
'conditions': [
[ 'use_system_icu==1 and want_separate_host_toolset==1', {
'toolsets': ['host'],
}],
[ 'use_system_icu==0 and want_separate_host_toolset==1', {
'toolsets': ['host', 'target'],
}],
[ 'use_system_icu==0 and want_separate_host_toolset==0', {
'toolsets': ['target'],
}],
['OS == "android" and clang==0', {
# Disable sincos() optimization to avoid a linker error since
# Android's math library doesn't have sincos(). Either
# -fno-builtin-sin or -fno-builtin-cos works.
'cflags': [
'-fno-builtin-sin',
],
}],
[ 'OS == "win" and clang==1', {
# Note: General clang warnings should go in the
# clang_warning_flags block above.
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'-Wno-implicit-exception-spec-mismatch',
],
},
},
}],
], # conditions
},
{
'target_name': 'icuuc',
'type': '<(component)',
'sources': [
'<@(icuuc_sources)',
],
'defines': [
'U_COMMON_IMPLEMENTATION',
],
'dependencies': [
'icudata',
],
'direct_dependent_settings': {
'include_dirs': [
'source/common',
],
'conditions': [
[ 'component=="static_library"', {
'defines': [
'U_STATIC_IMPLEMENTATION',
],
}],
],
},
'variables': {
'clang_warning_flags': [
# ICU uses its own deprecated functions.
'-Wno-deprecated-declarations',
# ICU prefers `a && b || c` over `(a && b) || c`.
'-Wno-logical-op-parentheses',
# ICU has some `unsigned < 0` checks.
'-Wno-tautological-compare',
# uresdata.c has switch(RES_GET_TYPE(x)) code. The
# RES_GET_TYPE macro returns an UResType enum, but some switch
# statement contains case values that aren't part of that
# enum (e.g. URES_TABLE32 which is in UResInternalType). This
# is on purpose.
'-Wno-switch',
# ICU has some code with the pattern:
# if (found = uprv_getWindowsTimeZoneInfo(...))
'-Wno-parentheses',
# ICU generally has no unused variables, but there are a few
# places where this warning triggers.
# See https://codereview.chromium.org/1222643002/ and
# http://www.icu-project.org/trac/ticket/11759.
'-Wno-unused-const-variable',
# ucnv2022.cpp contains three functions that are only used when
# certain preprocessor defines are set.
'-Wno-unused-function',
],
},
'cflags': [
# Since ICU wants to internally use its own deprecated APIs,
# don't complain about it.
'-Wno-deprecated-declarations',
'-Wno-unused-function',
],
'cflags_cc': [
'-frtti',
],
'cflags_cc!': [
'-fno-rtti',
],
'xcode_settings': {
'GCC_ENABLE_CPP_RTTI': 'YES', # -frtti
},
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeTypeInfo': 'true',
},
},
'all_dependent_settings': {
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'advapi32.lib',
],
},
},
},
'conditions': [
[ 'use_system_icu==1 and want_separate_host_toolset==1', {
'toolsets': ['host'],
}],
[ 'use_system_icu==0 and want_separate_host_toolset==1', {
'toolsets': ['host', 'target'],
}],
[ 'use_system_icu==0 and want_separate_host_toolset==0', {
'toolsets': ['target'],
}],
[ 'OS == "win" or icu_use_data_file_flag==1', {
'sources': [
'source/stubdata/stubdata.cpp',
],
'defines': [
'U_ICUDATAENTRY_IN_COMMON',
],
}],
[ 'OS == "win" and clang==1', {
# Note: General clang warnings should go in the
# clang_warning_flags block above.
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'-Wno-implicit-exception-spec-mismatch',
],
},
},
}],
], # conditions
},
], # targets
}],
['use_system_icu==1', {
'targets': [
{
'target_name': 'system_icu',
'type': 'none',
'conditions': [
['OS=="qnx"', {
'link_settings': {
'libraries': [
'-licui18n',
'-licuuc',
],
},
}],
['OS!="qnx"', {
'link_settings': {
'ldflags': [
'<!@(icu-config --ldflags)',
],
'libraries': [
'<!@(icu-config --ldflags-libsonly)',
],
},
}],
],
},
{
'target_name': 'icudata',
'type': 'none',
'dependencies': ['system_icu'],
'export_dependent_settings': ['system_icu'],
'toolsets': ['target'],
},
{
'target_name': 'icui18n',
'type': 'none',
'dependencies': ['system_icu'],
'export_dependent_settings': ['system_icu'],
'variables': {
'headers_root_path': 'source/i18n',
'header_filenames': [
# This list can easily be updated using the command below:
# ls source/i18n/unicode/*h | sort | \
# sed "s/^.*i18n\/\(.*\)$/ '\1',/"
# I18N_HDR_START
'unicode/alphaindex.h',
'unicode/basictz.h',
'unicode/calendar.h',
'unicode/choicfmt.h',
'unicode/coleitr.h',
'unicode/coll.h',
'unicode/compactdecimalformat.h',
'unicode/curramt.h',
'unicode/currpinf.h',
'unicode/currunit.h',
'unicode/datefmt.h',
'unicode/dcfmtsym.h',
'unicode/decimfmt.h',
'unicode/dtfmtsym.h',
'unicode/dtitvfmt.h',
'unicode/dtitvinf.h',
'unicode/dtptngen.h',
'unicode/dtrule.h',
'unicode/fieldpos.h',
'unicode/fmtable.h',
'unicode/format.h',
'unicode/formattedvalue.h',
'unicode/fpositer.h',
'unicode/gender.h',
'unicode/gregocal.h',
'unicode/listformatter.h',
'unicode/measfmt.h',
'unicode/measunit.h',
'unicode/measure.h',
'unicode/msgfmt.h',
'unicode/nounit.h',
'unicode/numberformatter.h',
'unicode/numberrangeformatter.h',
'unicode/numfmt.h',
'unicode/numsys.h',
'unicode/plurfmt.h',
'unicode/plurrule.h',
'unicode/rbnf.h',
'unicode/rbtz.h',
'unicode/regex.h',
'unicode/region.h',
'unicode/reldatefmt.h',
'unicode/scientificnumberformatter.h',
'unicode/search.h',
'unicode/selfmt.h',
'unicode/simpletz.h',
'unicode/smpdtfmt.h',
'unicode/sortkey.h',
'unicode/stsearch.h',
'unicode/tblcoll.h',
'unicode/timezone.h',
'unicode/tmunit.h',
'unicode/tmutamt.h',
'unicode/tmutfmt.h',
'unicode/translit.h',
'unicode/tzfmt.h',
'unicode/tznames.h',
'unicode/tzrule.h',
'unicode/tztrans.h',
'unicode/ucal.h',
'unicode/ucoleitr.h',
'unicode/ucol.h',
'unicode/ucsdet.h',
'unicode/udateintervalformat.h',
'unicode/udat.h',
'unicode/udatpg.h',
'unicode/ufieldpositer.h',
'unicode/uformattable.h',
'unicode/uformattedvalue.h',
'unicode/ugender.h',
'unicode/ulistformatter.h',
'unicode/ulocdata.h',
'unicode/umsg.h',
'unicode/unirepl.h',
'unicode/unumberformatter.h',
'unicode/unum.h',
'unicode/unumsys.h',
'unicode/upluralrules.h',
'unicode/uregex.h',
'unicode/uregion.h',
'unicode/ureldatefmt.h',
'unicode/usearch.h',
'unicode/uspoof.h',
'unicode/utmscale.h',
'unicode/utrans.h',
'unicode/vtzone.h',
# I18N_HDR_END
],
},
'includes': [
'shim_headers.gypi',
],
'toolsets': ['target'],
},
{
'target_name': 'icuuc',
'type': 'none',
'dependencies': ['system_icu'],
'export_dependent_settings': ['system_icu'],
'variables': {
'headers_root_path': 'source/common',
'header_filenames': [
# This list can easily be updated using the command below:
# ls source/common/unicode/*h | sort | \
# sed "s/^.*common\/\(.*\)$/ '\1',/"
# COMMON_HDR_START
'unicode/appendable.h',
'unicode/brkiter.h',
'unicode/bytestream.h',
'unicode/bytestriebuilder.h',
'unicode/bytestrie.h',
'unicode/caniter.h',
'unicode/casemap.h',
'unicode/char16ptr.h',
'unicode/chariter.h',
'unicode/dbbi.h',
'unicode/docmain.h',
'unicode/dtintrv.h',
'unicode/edits.h',
'unicode/enumset.h',
'unicode/errorcode.h',
'unicode/filteredbrk.h',
'unicode/icudataver.h',
'unicode/icuplug.h',
'unicode/idna.h',
'unicode/localebuilder.h',
'unicode/localematcher.h',
'unicode/localpointer.h',
'unicode/locdspnm.h',
'unicode/locid.h',
'unicode/messagepattern.h',
'unicode/normalizer2.h',
'unicode/normlzr.h',
'unicode/parseerr.h',
'unicode/parsepos.h',
'unicode/platform.h',
'unicode/ptypes.h',
'unicode/putil.h',
'unicode/rbbi.h',
'unicode/rep.h',
'unicode/resbund.h',
'unicode/schriter.h',
'unicode/simpleformatter.h',
'unicode/std_string.h',
'unicode/strenum.h',
'unicode/stringoptions.h',
'unicode/stringpiece.h',
'unicode/stringtriebuilder.h',
'unicode/symtable.h',
'unicode/ubidi.h',
'unicode/ubiditransform.h',
'unicode/ubrk.h',
'unicode/ucasemap.h',
'unicode/ucat.h',
'unicode/uchar.h',
'unicode/ucharstriebuilder.h',
'unicode/ucharstrie.h',
'unicode/uchriter.h',
'unicode/uclean.h',
'unicode/ucnv_cb.h',
'unicode/ucnv_err.h',
'unicode/ucnv.h',
'unicode/ucnvsel.h',
'unicode/uconfig.h',
'unicode/ucpmap.h',
'unicode/ucptrie.h',
'unicode/ucurr.h',
'unicode/udata.h',
'unicode/udisplaycontext.h',
'unicode/uenum.h',
'unicode/uidna.h',
'unicode/uiter.h',
'unicode/uldnames.h',
'unicode/uloc.h',
'unicode/umachine.h',
'unicode/umisc.h',
'unicode/umutablecptrie.h',
'unicode/unifilt.h',
'unicode/unifunct.h',
'unicode/unimatch.h',
'unicode/uniset.h',
'unicode/unistr.h',
'unicode/unorm2.h',
'unicode/unorm.h',
'unicode/uobject.h',
'unicode/urename.h',
'unicode/urep.h',
'unicode/ures.h',
'unicode/uscript.h',
'unicode/uset.h',
'unicode/usetiter.h',
'unicode/ushape.h',
'unicode/usprep.h',
'unicode/ustring.h',
'unicode/ustringtrie.h',
'unicode/utext.h',
'unicode/utf16.h',
'unicode/utf32.h',
'unicode/utf8.h',
'unicode/utf.h',
'unicode/utf_old.h',
'unicode/utrace.h',
'unicode/utypes.h',
'unicode/uvernum.h',
'unicode/uversion.h',
# COMMON_HDR_END
],
},
'includes': [
'shim_headers.gypi',
],
'toolsets': ['target'],
},
], # targets
}],
], # conditions
}