• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) IBM Corporation and Others. All Rights Reserved.
2# very loosely based on icu.gyp from Chromium:
3# Copyright (c) 2012 The Chromium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7
8{
9  'variables': {
10    'icu_src_derb': [
11      '<(icu_path)/source/tools/genrb/derb.c',
12      '<(icu_path)/source/tools/genrb/derb.cpp'
13    ],
14  },
15  'includes': [ '../../icu_config.gypi' ],
16  'targets': [
17    {
18      # a target for additional uconfig defines, target only
19      'target_name': 'icu_uconfig_target',
20      'type': 'none',
21      'toolsets': [ 'target' ],
22      'direct_dependent_settings': {
23        'defines': []
24      },
25    },
26    {
27      # a target to hold uconfig defines.
28      # for now these are hard coded, but could be defined.
29      'target_name': 'icu_uconfig',
30      'type': 'none',
31      'toolsets': [ 'host', 'target' ],
32      'direct_dependent_settings': {
33        'defines': [
34          'UCONFIG_NO_SERVICE=1',
35          'U_ENABLE_DYLOAD=0',
36          'U_STATIC_IMPLEMENTATION=1',
37          'U_HAVE_STD_STRING=1',
38          # TODO(srl295): reenable following pending
39          # https://code.google.com/p/v8/issues/detail?id=3345
40          # (saves some space)
41          'UCONFIG_NO_BREAK_ITERATION=0',
42        ],
43      }
44    },
45    {
46      # a target to hold common settings.
47      # make any target that is ICU implementation depend on this.
48      'target_name': 'icu_implementation',
49      'toolsets': [ 'host', 'target' ],
50      'type': 'none',
51      'direct_dependent_settings': {
52        'conditions': [
53          [ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
54            'cflags': [ '-Wno-deprecated-declarations', '-Wno-strict-aliasing' ],
55            'cflags_cc': [ '-frtti' ],
56            'cflags_cc!': [ '-fno-rtti' ],
57          }],
58          [ 'OS == "mac" or OS == "ios"', {
59            'xcode_settings': {'GCC_ENABLE_CPP_RTTI': 'YES' },
60          }],
61          [ 'OS == "win"', {
62            'msvs_settings': {
63              'VCCLCompilerTool': {'RuntimeTypeInfo': 'true'},
64            }
65          }],
66        ],
67        'msvs_settings': {
68          'VCCLCompilerTool': {
69            'RuntimeTypeInfo': 'true',
70            'ExceptionHandling': '1',
71            'AdditionalOptions': [ '/source-charset:utf-8' ],
72          },
73        },
74        'configurations': {
75          # TODO: why does this need to be redefined for Release and Debug?
76          # Maybe this should be pushed into common.gypi with an "if v8 i18n"?
77          'Release': {
78            'msvs_settings': {
79              'VCCLCompilerTool': {
80                'RuntimeTypeInfo': 'true',
81                'ExceptionHandling': '1',
82              },
83            },
84          },
85          'Debug': {
86            'msvs_settings': {
87              'VCCLCompilerTool': {
88                'RuntimeTypeInfo': 'true',
89                'ExceptionHandling': '1',
90              },
91            },
92          },
93        },
94        'defines': [
95          'U_ATTRIBUTE_DEPRECATED=',
96          '_CRT_SECURE_NO_DEPRECATE=',
97          'U_STATIC_IMPLEMENTATION=1',
98        ],
99      },
100    },
101    {
102      'target_name': 'icui18n',
103      'toolsets': [ 'target', 'host' ],
104      'conditions' : [
105        ['_toolset=="target"', {
106          'type': '<(library)',
107          'sources': [
108            '<@(icu_src_i18n)'
109          ],
110          ## if your compiler can dead-strip, these exclusions will
111          ## make ZERO difference to binary size.
112          ## Made ICU-specific for future-proofing.
113          'conditions': [
114            [ 'icu_ver_major == 55', { 'sources!': [
115              # alphabetic index
116              '<(icu_path)/source/i18n/alphaindex.cpp',
117              # BOCSU
118              # misc
119              '<(icu_path)/source/i18n/regexcmp.cpp',
120              '<(icu_path)/source/i18n/regexcmp.h',
121              '<(icu_path)/source/i18n/regexcst.h',
122              '<(icu_path)/source/i18n/regeximp.cpp',
123              '<(icu_path)/source/i18n/regeximp.h',
124              '<(icu_path)/source/i18n/regexst.cpp',
125              '<(icu_path)/source/i18n/regexst.h',
126              '<(icu_path)/source/i18n/regextxt.cpp',
127              '<(icu_path)/source/i18n/regextxt.h',
128              '<(icu_path)/source/i18n/region.cpp',
129              '<(icu_path)/source/i18n/region_impl.h',
130              '<(icu_path)/source/i18n/reldatefmt.cpp',
131              '<(icu_path)/source/i18n/reldatefmt.h'
132              '<(icu_path)/source/i18n/scientificformathelper.cpp',
133              '<(icu_path)/source/i18n/tmunit.cpp',
134              '<(icu_path)/source/i18n/tmutamt.cpp',
135              '<(icu_path)/source/i18n/tmutfmt.cpp',
136              '<(icu_path)/source/i18n/uregex.cpp',
137              '<(icu_path)/source/i18n/uregexc.cpp',
138              '<(icu_path)/source/i18n/uregion.cpp',
139              '<(icu_path)/source/i18n/uspoof.cpp',
140              '<(icu_path)/source/i18n/uspoof_build.cpp',
141              '<(icu_path)/source/i18n/uspoof_conf.cpp',
142              '<(icu_path)/source/i18n/uspoof_conf.h',
143              '<(icu_path)/source/i18n/uspoof_impl.cpp',
144              '<(icu_path)/source/i18n/uspoof_impl.h',
145              '<(icu_path)/source/i18n/uspoof_wsconf.cpp',
146              '<(icu_path)/source/i18n/uspoof_wsconf.h',
147            ]}],
148            [ 'icu_ver_major == 57', { 'sources!': [
149
150              # alphabetic index
151              '<(icu_path)/source/i18n/alphaindex.cpp',
152              # BOCSU
153              # misc
154              '<(icu_path)/source/i18n/regexcmp.cpp',
155              '<(icu_path)/source/i18n/regexcmp.h',
156              '<(icu_path)/source/i18n/regexcst.h',
157              '<(icu_path)/source/i18n/regeximp.cpp',
158              '<(icu_path)/source/i18n/regeximp.h',
159              '<(icu_path)/source/i18n/regexst.cpp',
160              '<(icu_path)/source/i18n/regexst.h',
161              '<(icu_path)/source/i18n/regextxt.cpp',
162              '<(icu_path)/source/i18n/regextxt.h',
163              '<(icu_path)/source/i18n/region.cpp',
164              '<(icu_path)/source/i18n/region_impl.h',
165              '<(icu_path)/source/i18n/reldatefmt.cpp',
166              '<(icu_path)/source/i18n/reldatefmt.h'
167              '<(icu_path)/source/i18n/scientificformathelper.cpp',
168              '<(icu_path)/source/i18n/tmunit.cpp',
169              '<(icu_path)/source/i18n/tmutamt.cpp',
170              '<(icu_path)/source/i18n/tmutfmt.cpp',
171              '<(icu_path)/source/i18n/uregex.cpp',
172              '<(icu_path)/source/i18n/uregexc.cpp',
173              '<(icu_path)/source/i18n/uregion.cpp',
174              '<(icu_path)/source/i18n/uspoof.cpp',
175              '<(icu_path)/source/i18n/uspoof_build.cpp',
176              '<(icu_path)/source/i18n/uspoof_conf.cpp',
177              '<(icu_path)/source/i18n/uspoof_conf.h',
178              '<(icu_path)/source/i18n/uspoof_impl.cpp',
179              '<(icu_path)/source/i18n/uspoof_impl.h',
180              '<(icu_path)/source/i18n/uspoof_wsconf.cpp',
181              '<(icu_path)/source/i18n/uspoof_wsconf.h',
182            ]}],
183            ],
184          'include_dirs': [
185            '<(icu_path)/source/i18n',
186          ],
187          'defines': [
188            'U_I18N_IMPLEMENTATION=1',
189          ],
190          'dependencies': [ 'icuucx', 'icu_implementation', 'icu_uconfig', 'icu_uconfig_target' ],
191          'direct_dependent_settings': {
192            'include_dirs': [
193              '<(icu_path)/source/i18n',
194            ],
195          },
196          'export_dependent_settings': [ 'icuucx', 'icu_uconfig_target' ],
197        }],
198        ['_toolset=="host"', {
199          'type': 'none',
200          'dependencies': [ 'icutools' ],
201          'export_dependent_settings': [ 'icutools' ],
202        }],
203      ],
204    },
205    # This exports actual ICU data
206    {
207      'target_name': 'icudata',
208      'type': '<(library)',
209      'toolsets': [ 'target' ],
210      'conditions': [
211        [ 'OS == "win"', {
212          'conditions': [
213            [ 'icu_small == "false"', { # and OS=win
214              # full data - just build the full data file, then we are done.
215              'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.obj' ],
216              'dependencies': [ 'genccode#host' ],
217              'actions': [
218                {
219                  'action_name': 'icudata',
220                  'msvs_quote_cmd': 0,
221                  'inputs': [ '<(icu_data_in)' ],
222                  'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.obj' ],
223                  'action': [ '<(PRODUCT_DIR)/genccode',
224                              '-o',
225                              '-d', '<(SHARED_INTERMEDIATE_DIR)',
226                              '-n', 'icudata',
227                              '-e', 'icudt<(icu_ver_major)',
228                              '<@(_inputs)' ],
229                },
230              ],
231            }, { # icu_small == TRUE and OS == win
232              # link against stub data primarily
233              # then, use icupkg and genccode to rebuild data
234              'dependencies': [ 'icustubdata', 'genccode#host', 'icupkg#host', 'genrb#host', 'iculslocs#host' ],
235              'export_dependent_settings': [ 'icustubdata' ],
236              'actions': [
237                {
238                  # trim down ICU
239                  'action_name': 'icutrim',
240                  'msvs_quote_cmd': 0,
241                  'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
242                  'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
243                  'action': [ 'python',
244                              'icutrim.py',
245                              '-P', '<(PRODUCT_DIR)/.', # '.' suffix is a workaround against GYP assumptions :(
246                              '-D', '<(icu_data_in)',
247                              '--delete-tmp',
248                              '-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
249                              '-F', 'icu_small.json',
250                              '-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
251                              '-v',
252                              '-L', '<(icu_locales)'],
253                },
254                {
255                  # build final .dat -> .obj
256                  'action_name': 'genccode',
257                  'msvs_quote_cmd': 0,
258                  'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
259                  'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.obj' ],
260                  'action': [ '<(PRODUCT_DIR)/genccode',
261                              '-o',
262                              '-d', '<(SHARED_INTERMEDIATE_DIR)/',
263                              '-n', 'icudata',
264                              '-e', 'icusmdt<(icu_ver_major)',
265                              '<@(_inputs)' ],
266                },
267              ],
268              # This file contains the small ICU data.
269              'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.obj' ],
270            } ] ], #end of OS==win and icu_small == true
271        }, { # OS != win
272          'conditions': [
273            [ 'icu_small == "false"', {
274              # full data - just build the full data file, then we are done.
275              'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)_dat.c' ],
276              'dependencies': [ 'genccode#host', 'icupkg#host', 'icu_implementation#host', 'icu_uconfig' ],
277              'include_dirs': [
278                '<(icu_path)/source/common',
279              ],
280              'actions': [
281                {
282                   # Swap endianness (if needed), or at least copy the file
283                   'action_name': 'icupkg',
284                   'inputs': [ '<(icu_data_in)' ],
285                   'outputs':[ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness).dat' ],
286                   'action': [ '<(PRODUCT_DIR)/icupkg',
287                               '-t<(icu_endianness)',
288                               '<@(_inputs)',
289                               '<@(_outputs)',
290                             ],
291                },
292                {
293                   # Rename without the endianness marker
294                   'action_name': 'copy',
295                   'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness).dat' ],
296                   'outputs':[ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major).dat' ],
297                   'action': [ 'cp',
298                               '<@(_inputs)',
299                               '<@(_outputs)',
300                             ],
301                },
302                {
303                  'action_name': 'icudata',
304                  'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major).dat' ],
305                  'outputs':[ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)_dat.c' ],
306                  'action': [ '<(PRODUCT_DIR)/genccode',
307                              '-e', 'icudt<(icu_ver_major)',
308                              '-d', '<(SHARED_INTERMEDIATE_DIR)',
309                              '-f', 'icudt<(icu_ver_major)_dat',
310                              '<@(_inputs)' ],
311                },
312              ], # end actions
313            }, { # icu_small == true ( and OS != win )
314              # link against stub data (as primary data)
315              # then, use icupkg and genccode to rebuild small data
316              'dependencies': [ 'icustubdata', 'genccode#host', 'icupkg#host', 'genrb#host', 'iculslocs#host',
317                               'icu_implementation', 'icu_uconfig' ],
318              'export_dependent_settings': [ 'icustubdata' ],
319              'actions': [
320                {
321                  # trim down ICU
322                  'action_name': 'icutrim',
323                  'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
324                  'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
325                  'action': [ 'python',
326                              'icutrim.py',
327                              '-P', '<(PRODUCT_DIR)',
328                              '-D', '<(icu_data_in)',
329                              '--delete-tmp',
330                              '-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
331                              '-F', 'icu_small.json',
332                              '-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
333                              '-v',
334                              '-L', '<(icu_locales)'],
335                }, {
336                  # rename to get the final entrypoint name right
337                   'action_name': 'rename',
338                   'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
339                   'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
340                   'action': [ 'cp',
341                               '<@(_inputs)',
342                               '<@(_outputs)',
343                             ],
344                }, {
345                  # build final .dat -> .obj
346                  'action_name': 'genccode',
347                  'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icusmdt<(icu_ver_major).dat' ],
348                  'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.c' ],
349                  'action': [ '<(PRODUCT_DIR)/genccode',
350                              '-d', '<(SHARED_INTERMEDIATE_DIR)',
351                              '<@(_inputs)' ],
352                },
353              ],
354              # This file contains the small ICU data
355              'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icusmdt<(icu_ver_major)_dat.c' ],
356              # for umachine.h
357              'include_dirs': [
358                '<(icu_path)/source/common',
359              ],
360            }]], # end icu_small == true
361        }]], # end OS != win
362    }, # end icudata
363    # icustubdata is a tiny (~1k) symbol with no ICU data in it.
364    # tools must link against it as they are generating the full data.
365    {
366      'target_name': 'icustubdata',
367      'type': '<(library)',
368      'toolsets': [ 'target' ],
369      'dependencies': [ 'icu_implementation' ],
370      'sources': [
371        '<@(icu_src_stubdata)'
372      ],
373      'include_dirs': [
374        '<(icu_path)/source/common',
375      ],
376    },
377    # this target is for v8 consumption.
378    # it is icuuc + stubdata
379    # it is only built for target
380    {
381      'target_name': 'icuuc',
382      'type': 'none',
383      'toolsets': [ 'target', 'host' ],
384      'conditions' : [
385        ['_toolset=="host"', {
386          'dependencies': [ 'icutools' ],
387          'export_dependent_settings': [ 'icutools' ],
388        }],
389        ['_toolset=="target"', {
390          'dependencies': [ 'icuucx', 'icudata' ],
391          'export_dependent_settings': [ 'icuucx', 'icudata' ],
392        }],
393      ],
394    },
395    # This is the 'real' icuuc.
396    {
397      'target_name': 'icuucx',
398      'type': '<(library)',
399      'dependencies': [ 'icu_implementation', 'icu_uconfig', 'icu_uconfig_target' ],
400      'toolsets': [ 'target' ],
401      'sources': [
402        '<@(icu_src_common)',
403      ],
404          ## if your compiler can dead-strip, this will
405          ## make ZERO difference to binary size.
406          ## Made ICU-specific for future-proofing.
407      'conditions': [
408        [ 'icu_ver_major == 55', { 'sources!': [
409
410          # bidi- not needed (yet!)
411          '<(icu_path)/source/common/ubidi.c',
412          '<(icu_path)/source/common/ubidiimp.h',
413          '<(icu_path)/source/common/ubidiln.c',
414          '<(icu_path)/source/common/ubidiwrt.c',
415          #'<(icu_path)/source/common/ubidi_props.c',
416          #'<(icu_path)/source/common/ubidi_props.h',
417          #'<(icu_path)/source/common/ubidi_props_data.h',
418          # and the callers
419          '<(icu_path)/source/common/ushape.cpp',
420        ]}],
421        [ 'icu_ver_major == 57', { 'sources!': [
422          # work around http://bugs.icu-project.org/trac/ticket/12451
423          # (benign afterwards)
424          '<(icu_path)/source/common/cstr.cpp',
425
426          # bidi- not needed (yet!)
427          '<(icu_path)/source/common/ubidi.c',
428          '<(icu_path)/source/common/ubidiimp.h',
429          '<(icu_path)/source/common/ubidiln.c',
430          '<(icu_path)/source/common/ubidiwrt.c',
431          #'<(icu_path)/source/common/ubidi_props.c',
432          #'<(icu_path)/source/common/ubidi_props.h',
433          #'<(icu_path)/source/common/ubidi_props_data.h',
434          # and the callers
435          '<(icu_path)/source/common/ushape.cpp',
436        ]}],
437        [ 'OS == "solaris"', { 'defines': [
438          '_XOPEN_SOURCE_EXTENDED=0',
439        ]}],
440      ],
441      'include_dirs': [
442        '<(icu_path)/source/common',
443      ],
444      'defines': [
445        'U_COMMON_IMPLEMENTATION=1',
446      ],
447      'cflags_c': ['-std=c99'],
448      'export_dependent_settings': [ 'icu_uconfig', 'icu_uconfig_target' ],
449      'direct_dependent_settings': {
450        'include_dirs': [
451          '<(icu_path)/source/common',
452        ],
453        'conditions': [
454          [ 'OS=="win"', {
455            'link_settings': {
456              'libraries': [ '-lAdvAPI32.lib', '-lUser32.lib' ],
457            },
458          }],
459        ],
460      },
461    },
462    # tools library. This builds all of ICU together.
463    {
464      'target_name': 'icutools',
465      'type': '<(library)',
466      'toolsets': [ 'host' ],
467      'dependencies': [ 'icu_implementation', 'icu_uconfig' ],
468      'sources': [
469        '<@(icu_src_tools)',
470        '<@(icu_src_common)',
471        '<@(icu_src_i18n)',
472        '<@(icu_src_stubdata)',
473      ],
474      'sources!': [
475        '<(icu_path)/source/tools/toolutil/udbgutil.cpp',
476        '<(icu_path)/source/tools/toolutil/udbgutil.h',
477        '<(icu_path)/source/tools/toolutil/dbgutil.cpp',
478        '<(icu_path)/source/tools/toolutil/dbgutil.h',
479      ],
480      'include_dirs': [
481        '<(icu_path)/source/common',
482        '<(icu_path)/source/i18n',
483        '<(icu_path)/source/tools/toolutil',
484      ],
485      'defines': [
486        'U_COMMON_IMPLEMENTATION=1',
487        'U_I18N_IMPLEMENTATION=1',
488        'U_IO_IMPLEMENTATION=1',
489        'U_TOOLUTIL_IMPLEMENTATION=1',
490        #'DEBUG=0', # http://bugs.icu-project.org/trac/ticket/10977
491      ],
492      'cflags_c': ['-std=c99'],
493      'conditions': [
494        ['OS == "solaris"', {
495          'defines': [ '_XOPEN_SOURCE_EXTENDED=0' ]
496        }]
497      ],
498      'direct_dependent_settings': {
499        'include_dirs': [
500          '<(icu_path)/source/common',
501          '<(icu_path)/source/i18n',
502          '<(icu_path)/source/tools/toolutil',
503        ],
504        'conditions': [
505          [ 'OS=="win"', {
506            'link_settings': {
507              'libraries': [ '-lAdvAPI32.lib', '-lUser32.lib' ],
508            },
509          }],
510        ],
511      },
512      'export_dependent_settings': [ 'icu_uconfig' ],
513    },
514    # This tool is needed to rebuild .res files from .txt,
515    # or to build index (res_index.txt) files for small-icu
516    {
517      'target_name': 'genrb',
518      'type': 'executable',
519      'toolsets': [ 'host' ],
520      'dependencies': [ 'icutools' ],
521      'sources': [
522        '<@(icu_src_genrb)'
523      ],
524      # derb is a separate executable
525      # (which is not currently built)
526      'sources!': [
527        '<@(icu_src_derb)',
528        'no-op.cc',
529      ],
530    },
531    # This tool is used to rebuild res_index.res manifests
532    {
533      'target_name': 'iculslocs',
534      'toolsets': [ 'host' ],
535      'type': 'executable',
536      'dependencies': [ 'icutools' ],
537      'sources': [
538        'iculslocs.cc',
539        'no-op.cc',
540      ],
541    },
542    # This tool is used to package, unpackage, repackage .dat files
543    # and convert endianesses
544    {
545      'target_name': 'icupkg',
546      'toolsets': [ 'host' ],
547      'type': 'executable',
548      'dependencies': [ 'icutools' ],
549      'sources': [
550        '<@(icu_src_icupkg)',
551        'no-op.cc',
552      ],
553    },
554    # this is used to convert .dat directly into .obj
555    {
556      'target_name': 'genccode',
557      'toolsets': [ 'host' ],
558      'type': 'executable',
559      'dependencies': [ 'icutools' ],
560      'sources': [
561        '<@(icu_src_genccode)',
562        'no-op.cc',
563      ],
564    },
565  ],
566}
567