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