Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / third_party / icu / icu.gyp
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       ],
21     },
22     'defines': [
23       'U_USING_ICU_NAMESPACE=0',
24     ],
25     'conditions': [
26       ['component=="static_library"', {
27         'defines': [
28           'U_STATIC_IMPLEMENTATION',
29         ],
30       }],
31       ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
32          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
33         (target_arch=="arm" or target_arch=="ia32" or \
34          target_arch=="mipsel")', {
35         'target_conditions': [
36           ['_toolset=="host"', {
37             'cflags': [ '-m32' ],
38             'ldflags': [ '-m32' ],
39             'asflags': [ '-32' ],
40             'xcode_settings': {
41               'ARCHS': [ 'i386' ],
42             },
43           }],
44         ],
45       }],
46     ],
47     'include_dirs': [
48       'source/common',
49       'source/i18n',
50     ],
51     'msvs_disabled_warnings': [4005, 4068, 4355, 4996, 4267],
52   },
53   'conditions': [
54     ['use_system_icu==0 or want_separate_host_toolset==1', {
55       'targets': [
56         {
57           'target_name': 'icudata',
58           'type': 'static_library',
59           'defines': [
60             'U_HIDE_DATA_SYMBOL',
61           ],
62           'sources': [
63              # These are hand-generated, but will do for now.  The linux
64              # version is an identical copy of the (mac) icudt46l_dat.S file,
65              # modulo removal of the .private_extern and .const directives and
66              # with no leading underscore on the icudt46_dat symbol.
67              'android/icudt46l_dat.S',
68              'linux/icudt46l_dat.S',
69              'mac/icudt46l_dat.S',
70           ],
71           'conditions': [
72             [ 'use_system_icu==1 and want_separate_host_toolset==1', {
73               'toolsets': ['host'],
74             }],
75             [ 'use_system_icu==0 and want_separate_host_toolset==1', {
76               'toolsets': ['host', 'target'],
77             }],
78             [ 'use_system_icu==0 and want_separate_host_toolset==0', {
79               'toolsets': ['target'],
80             }],
81             [ 'OS == "win" and icu_use_data_file_flag==0', {
82               'type': 'none',
83               'copies': [
84                 {
85                   'destination': '<(PRODUCT_DIR)',
86                   'files': [
87                     'windows/icudt.dll',
88                   ],
89                 },
90               ],
91             }],
92             [ 'icu_use_data_file_flag==1', {
93               # Remove any assembly data file.
94               'sources/': [['exclude', 'icudt46l_dat']],
95               # Compile in the stub data symbol.
96               'sources': ['source/stubdata/stubdata.c'],
97              
98               # Make sure any binary depending on this gets the data file.
99               'conditions': [
100                 ['OS != "ios"', {
101                   'copies': [{
102                     'destination': '<(PRODUCT_DIR)',
103                     'conditions': [
104                       ['OS == "android"', {
105                         'files': [
106                           'android/icudtl.dat',
107                         ],
108                       } , { # else: OS != android
109                         'files': [
110                           'source/data/in/icudtl.dat',
111                         ],
112                       }],
113                     ],
114                   }],
115                 } , { # else: OS=="ios"
116                   'link_settings': {
117                     'mac_bundle_resources': [
118                       'source/data/in/icudtl.dat',
119                     ],
120                   },
121                 }], # OS!=ios
122               ], # conditions
123             }], # icu_use_data_file_flag 
124           ], # conditions
125           'target_conditions': [
126             [ 'OS == "win" or OS == "mac" or OS == "ios" or '
127               '(OS == "android" and (_toolset != "host" or host_os != "linux")) or '
128               '(OS == "qnx" and (_toolset == "host" and host_os != "linux"))', {
129               'sources!': ['linux/icudt46l_dat.S'],
130             }],
131             [ 'OS != "android" or _toolset == "host"', {
132               'sources!': ['android/icudt46l_dat.S'],
133             }],
134             [ 'OS != "mac" and OS != "ios" and '
135               '((OS != "android" and OS != "qnx") or '
136               '_toolset != "host" or host_os != "mac")', {
137               'sources!': ['mac/icudt46l_dat.S'],
138             }],
139           ], # target_conditions
140         },
141         {
142           'target_name': 'icui18n',
143           'type': '<(component)',
144           'sources': [
145             '<@(icui18n_sources)',
146           ],
147           'defines': [
148             'U_I18N_IMPLEMENTATION',
149           ],
150           'dependencies': [
151             'icuuc',
152           ],
153           'direct_dependent_settings': {
154             'include_dirs': [
155               'source/i18n',
156             ],
157           },
158           'conditions': [
159             [ 'use_system_icu==1 and want_separate_host_toolset==1', {
160               'toolsets': ['host'],
161             }],
162             [ 'use_system_icu==0 and want_separate_host_toolset==1', {
163               'toolsets': ['host', 'target'],
164             }],
165             [ 'use_system_icu==0 and want_separate_host_toolset==0', {
166               'toolsets': ['target'],
167             }],
168             [ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
169               # Since ICU wants to internally use its own deprecated APIs, don't
170               # complain about it.
171               'cflags': [
172                 '-Wno-deprecated-declarations',
173               ],
174               'cflags_cc': [
175                 '-frtti',
176               ],
177             }],
178             ['OS == "mac" or OS == "ios"', {
179               'xcode_settings': {
180                 'GCC_ENABLE_CPP_RTTI': 'YES',       # -frtti
181               },
182             }],
183             ['OS == "win"', {
184               'msvs_settings': {
185                 'VCCLCompilerTool': {
186                   'RuntimeTypeInfo': 'true',
187                 },
188               }
189             }],
190             ['clang==1', {
191               'xcode_settings': {
192                 'WARNING_CFLAGS': [
193                   # ICU uses its own deprecated functions.
194                   '-Wno-deprecated-declarations',
195                   # ICU prefers `a && b || c` over `(a && b) || c`.
196                   '-Wno-logical-op-parentheses',
197                   # ICU has some `unsigned < 0` checks.
198                   '-Wno-tautological-compare',
199                   # uspoof.h has a U_NAMESPACE_USE macro. That's a bug,
200                   # the header should use U_NAMESPACE_BEGIN instead.
201                   # http://bugs.icu-project.org/trac/ticket/9054
202                   '-Wno-header-hygiene',
203                   # Looks like a real issue, see http://crbug.com/114660
204                   '-Wno-return-type-c-linkage',
205                 ],
206               },
207               'cflags': [
208                 '-Wno-deprecated-declarations',
209                 '-Wno-logical-op-parentheses',
210                 '-Wno-tautological-compare',
211                 '-Wno-header-hygiene',
212                 '-Wno-return-type-c-linkage',
213               ],
214             }],
215             ['OS == "android" and clang==0', {
216                 # Disable sincos() optimization to avoid a linker error since
217                 # Android's math library doesn't have sincos().  Either
218                 # -fno-builtin-sin or -fno-builtin-cos works.
219                 'cflags': [
220                     '-fno-builtin-sin',
221                 ],
222             }],
223             ['OS == "android" and use_system_stlport == 1', {
224               'target_conditions': [
225                 ['_toolset == "target"', {
226                   # ICU requires RTTI, which is not present in the system's
227                   # stlport, so we have to include gabi++.
228                   'include_dirs': [
229                     '<(android_src)/abi/cpp/include',
230                   ],
231                   'link_settings': {
232                     'libraries': [
233                       '-lgabi++',
234                     ],
235                   },
236                 }],
237               ],
238             }],
239           ], # conditions
240         },
241         {
242           'target_name': 'icuuc',
243           'type': '<(component)',
244           'sources': [
245             '<@(icuuc_sources)',
246           ],
247           'defines': [
248             'U_COMMON_IMPLEMENTATION',
249           ],
250           'dependencies': [
251             'icudata',
252           ],
253           'direct_dependent_settings': {
254             'include_dirs': [
255               'source/common',
256             ],
257             'conditions': [
258               [ 'component=="static_library"', {
259                 'defines': [
260                   'U_STATIC_IMPLEMENTATION',
261                 ],
262               }],
263             ],
264           },
265           'conditions': [
266             [ 'use_system_icu==1 and want_separate_host_toolset==1', {
267               'toolsets': ['host'],
268             }],
269             [ 'use_system_icu==0 and want_separate_host_toolset==1', {
270               'toolsets': ['host', 'target'],
271             }],
272             [ 'use_system_icu==0 and want_separate_host_toolset==0', {
273               'toolsets': ['target'],
274             }],
275             [ 'OS == "win"', {
276               'sources': [
277                 'source/stubdata/stubdata.c',
278               ],
279             }],
280             [ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
281               'cflags': [
282                 # Since ICU wants to internally use its own deprecated APIs,
283                 # don't complain about it.
284                 '-Wno-deprecated-declarations',
285                 '-Wno-unused-function',
286               ],
287               'cflags_cc': [
288                 '-frtti',
289               ],
290             }],
291             ['OS == "mac" or OS == "ios"', {
292               'xcode_settings': {
293                 'GCC_ENABLE_CPP_RTTI': 'YES',       # -frtti
294               },
295             }],
296             ['OS == "win"', {
297               'msvs_settings': {
298                 'VCCLCompilerTool': {
299                   'RuntimeTypeInfo': 'true',
300                 },
301               },
302             }],
303             ['OS == "android" and use_system_stlport == 1', {
304               'target_conditions': [
305                 ['_toolset == "target"', {
306                   # ICU requires RTTI, which is not present in the system's
307                   # stlport, so we have to include gabi++.
308                   'include_dirs': [
309                     '<(android_src)/abi/cpp/include',
310                   ],
311                   'link_settings': {
312                     'libraries': [
313                       '-lgabi++',
314                     ],
315                   },
316                 }],
317               ],
318             }],
319             ['clang==1', {
320               'xcode_settings': {
321                 'WARNING_CFLAGS': [
322                   # ICU uses its own deprecated functions.
323                   '-Wno-deprecated-declarations',
324                   # ICU prefers `a && b || c` over `(a && b) || c`.
325                   '-Wno-logical-op-parentheses',
326                   # ICU has some `unsigned < 0` checks.
327                   '-Wno-tautological-compare',
328                   # uresdata.c has switch(RES_GET_TYPE(x)) code. The
329                   # RES_GET_TYPE macro returns an UResType enum, but some switch
330                   # statement contains case values that aren't part of that
331                   # enum (e.g. URES_TABLE32 which is in UResInternalType). This
332                   # is on purpose.
333                   '-Wno-switch',
334                 ],
335               },
336               'cflags': [
337                 '-Wno-deprecated-declarations',
338                 '-Wno-logical-op-parentheses',
339                 '-Wno-tautological-compare',
340                 '-Wno-switch',
341               ],
342             }],
343           ], # conditions
344         },
345       ], # targets
346     }],
347     ['use_system_icu==1', {
348       'targets': [
349         {
350           'target_name': 'system_icu',
351           'type': 'none',
352           'conditions': [
353             ['OS=="android"', {
354               'direct_dependent_settings': {
355                 'include_dirs': [
356                   '<(android_src)/external/icu4c/common',
357                   '<(android_src)/external/icu4c/i18n',
358                 ],
359               },
360               'link_settings': {
361                 'libraries': [
362                   '-licui18n',
363                   '-licuuc',
364                 ],
365               },
366             }],
367             ['OS=="qnx"', {
368               'link_settings': {
369                 'libraries': [
370                   '-licui18n',
371                   '-licuuc',
372                 ],
373               },
374             }],
375             ['OS!="android" and OS!="qnx"', {
376               'link_settings': {
377                 'ldflags': [
378                   '<!@(icu-config --ldflags)',
379                 ],
380                 'libraries': [
381                   '<!@(icu-config --ldflags-libsonly)',
382                 ],
383               },
384             }],
385           ],
386         },
387         {
388           'target_name': 'icudata',
389           'type': 'none',
390           'dependencies': ['system_icu'],
391           'export_dependent_settings': ['system_icu'],
392           'toolsets': ['target'],
393         },
394         {
395           'target_name': 'icui18n',
396           'type': 'none',
397           'dependencies': ['system_icu'],
398           'export_dependent_settings': ['system_icu'],
399           'variables': {
400             'headers_root_path': 'source/i18n',
401             'header_filenames': [
402               # This list can easily be updated using the command below:
403               # find third_party/icu/source/i18n/unicode -iname '*.h' \
404               # -printf "'%p',\n" | \
405               # sed -e 's|third_party/icu/source/i18n/||' | sort -u
406               'unicode/basictz.h',
407               'unicode/bmsearch.h',
408               'unicode/bms.h',
409               'unicode/calendar.h',
410               'unicode/choicfmt.h',
411               'unicode/coleitr.h',
412               'unicode/colldata.h',
413               'unicode/coll.h',
414               'unicode/curramt.h',
415               'unicode/currpinf.h',
416               'unicode/currunit.h',
417               'unicode/datefmt.h',
418               'unicode/dcfmtsym.h',
419               'unicode/decimfmt.h',
420               'unicode/dtfmtsym.h',
421               'unicode/dtitvfmt.h',
422               'unicode/dtitvinf.h',
423               'unicode/dtptngen.h',
424               'unicode/dtrule.h',
425               'unicode/fieldpos.h',
426               'unicode/fmtable.h',
427               'unicode/format.h',
428               'unicode/fpositer.h',
429               'unicode/gregocal.h',
430               'unicode/locdspnm.h',
431               'unicode/measfmt.h',
432               'unicode/measunit.h',
433               'unicode/measure.h',
434               'unicode/msgfmt.h',
435               'unicode/numfmt.h',
436               'unicode/numsys.h',
437               'unicode/plurfmt.h',
438               'unicode/plurrule.h',
439               'unicode/rbnf.h',
440               'unicode/rbtz.h',
441               'unicode/regex.h',
442               'unicode/search.h',
443               'unicode/selfmt.h',
444               'unicode/simpletz.h',
445               'unicode/smpdtfmt.h',
446               'unicode/sortkey.h',
447               'unicode/stsearch.h',
448               'unicode/tblcoll.h',
449               'unicode/timezone.h',
450               'unicode/tmunit.h',
451               'unicode/tmutamt.h',
452               'unicode/tmutfmt.h',
453               'unicode/translit.h',
454               'unicode/tzrule.h',
455               'unicode/tztrans.h',
456               'unicode/ucal.h',
457               'unicode/ucoleitr.h',
458               'unicode/ucol.h',
459               'unicode/ucsdet.h',
460               'unicode/ucurr.h',
461               'unicode/udat.h',
462               'unicode/udatpg.h',
463               'unicode/uldnames.h',
464               'unicode/ulocdata.h',
465               'unicode/umsg.h',
466               'unicode/unirepl.h',
467               'unicode/unum.h',
468               'unicode/uregex.h',
469               'unicode/usearch.h',
470               'unicode/uspoof.h',
471               'unicode/utmscale.h',
472               'unicode/utrans.h',
473               'unicode/vtzone.h',
474             ],
475           },
476           'includes': [
477             '../../build/shim_headers.gypi',
478           ],
479           'toolsets': ['target'],
480         },
481         {
482           'target_name': 'icuuc',
483           'type': 'none',
484           'dependencies': ['system_icu'],
485           'export_dependent_settings': ['system_icu'],
486           'variables': {
487             'headers_root_path': 'source/common',
488             'header_filenames': [
489               # This list can easily be updated using the command below:
490               # find third_party/icu/source/common/unicode -iname '*.h' \
491               # -printf "'%p',\n" | \
492               # sed -e 's|third_party/icu/source/common/||' | sort -u
493               'unicode/brkiter.h',
494               'unicode/bytestream.h',
495               'unicode/caniter.h',
496               'unicode/chariter.h',
497               'unicode/dbbi.h',
498               'unicode/docmain.h',
499               'unicode/dtintrv.h',
500               'unicode/errorcode.h',
501               'unicode/icudataver.h',
502               'unicode/icuplug.h',
503               'unicode/idna.h',
504               'unicode/localpointer.h',
505               'unicode/locid.h',
506               'unicode/normalizer2.h',
507               'unicode/normlzr.h',
508               'unicode/pandroid.h',
509               'unicode/parseerr.h',
510               'unicode/parsepos.h',
511               'unicode/pfreebsd.h',
512               'unicode/plinux.h',
513               'unicode/pmac.h',
514               'unicode/popenbsd.h',
515               'unicode/ppalmos.h',
516               'unicode/ptypes.h',
517               'unicode/putil.h',
518               'unicode/pwin32.h',
519               'unicode/rbbi.h',
520               'unicode/rep.h',
521               'unicode/resbund.h',
522               'unicode/schriter.h',
523               'unicode/std_string.h',
524               'unicode/strenum.h',
525               'unicode/stringpiece.h',
526               'unicode/symtable.h',
527               'unicode/ubidi.h',
528               'unicode/ubrk.h',
529               'unicode/ucasemap.h',
530               'unicode/ucat.h',
531               'unicode/uchar.h',
532               'unicode/uchriter.h',
533               'unicode/uclean.h',
534               'unicode/ucnv_cb.h',
535               'unicode/ucnv_err.h',
536               'unicode/ucnv.h',
537               'unicode/ucnvsel.h',
538               'unicode/uconfig.h',
539               'unicode/udata.h',
540               'unicode/udeprctd.h',
541               'unicode/udraft.h',
542               'unicode/uenum.h',
543               'unicode/uidna.h',
544               'unicode/uintrnal.h',
545               'unicode/uiter.h',
546               'unicode/uloc.h',
547               'unicode/umachine.h',
548               'unicode/umisc.h',
549               'unicode/unifilt.h',
550               'unicode/unifunct.h',
551               'unicode/unimatch.h',
552               'unicode/uniset.h',
553               'unicode/unistr.h',
554               'unicode/unorm2.h',
555               'unicode/unorm.h',
556               'unicode/uobject.h',
557               'unicode/uobslete.h',
558               'unicode/urename.h',
559               'unicode/urep.h',
560               'unicode/ures.h',
561               'unicode/uscript.h',
562               'unicode/uset.h',
563               'unicode/usetiter.h',
564               'unicode/ushape.h',
565               'unicode/usprep.h',
566               'unicode/ustring.h',
567               'unicode/usystem.h',
568               'unicode/utext.h',
569               'unicode/utf16.h',
570               'unicode/utf32.h',
571               'unicode/utf8.h',
572               'unicode/utf.h',
573               'unicode/utf_old.h',
574               'unicode/utrace.h',
575               'unicode/utypeinfo.h',
576               'unicode/utypes.h',
577               'unicode/uvernum.h',
578               'unicode/uversion.h',
579             ],
580           },
581           'includes': [
582             '../../build/shim_headers.gypi',
583           ],
584           'toolsets': ['target'],
585         },
586       ], # targets
587     }],
588   ], # conditions
589 }